Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rune: Do not trace return value (causes panic on Result:Err) #748

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

VorpalBlade
Copy link
Contributor

This is the fix for #747 on the main branch (removal of instrumenting the return value). I left the instrument itself in, though this could be removed instead if it isn't useful to keep that around.

@udoprog
Copy link
Collaborator

udoprog commented Jul 17, 2024

Thanks!

Wouldn't fixing the fmt::Debug impl for Value make this unnecessary?

@VorpalBlade
Copy link
Contributor Author

Hm, fair point, I work primarily on 0.13.x, not main. So that variant is more well tested. However I don't think it would currently crash on main. But if you somehow manage to return a moved value it would. Not sure if that is possible.

Instead attempt to print *something*
@VorpalBlade
Copy link
Contributor Author

Do you want to remove the tracing change now? It shouldn't crash without that any more, but I admit to not having tested that yet. Even if it doesn't crash, how does every return attempting to format the value affect the performance?

@udoprog
Copy link
Collaborator

udoprog commented Jul 17, 2024

Do you want to remove the tracing change now? It shouldn't crash without that any more, but I admit to not having tested that yet. Even if it doesn't crash, how does every return attempting to format the value affect the performance?

It should only affect performance if tracing is enabled. Otherwise it should be negligible. Tracing can also be statically compiled away with feature flags if we want to maximize performance.

@@ -2137,7 +2137,15 @@ impl fmt::Debug for Value {
let mut o = Formatter::new();

if self.string_debug(&mut o).is_err() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be useful to include this error as well?

@udoprog udoprog merged commit e3ca8ab into rune-rs:main Jul 17, 2024
21 checks passed
@udoprog udoprog added the bug Something isn't working label Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants