Open VorpalBlade opened 1 month ago
Before I switched from log to tracing for my project I would get this when attempting to unwrap the returned result in my user code. I came up with this monstrosity as a workaround. But this doesn't help now that it crashes internally in tracing.
Well, Value
returns fmt::Error
if debug printing errors. For non-builtin values, this would be the case if it's called outside of a vm.
For some reason we've also opted to instrument the return value here. This is not correct and should be removed since formatting might fail.
It is convenient for Value
to implement fmt::Debug
, but maybe it shouldn't return fmt::Error
and instead debug print the errors that occurred to avoid issues like these. It's also a footgun since it definitely will not work unless called inside a vm externally with Vm::with
.
It is convenient for
Value
to implementfmt::Debug
, but maybe it shouldn't returnfmt::Error
and instead debug print the errors that occurred to avoid issues like these. It's also a footgun since it definitely will not work unless called inside a vm externally withVm::with
.
My understanding is that std::fmt::Error is for when the formatting itself fails. And the Rust standard library will in fact panic in format!()
when this happen.
So if I understand you correctly and it error when printing an error (as opposed when to the formatting fails) this seems incorrect and like a misunderstanding.
Yeah, we should fix it.
I'll make a PR later today
Given the following example code (full reproducer project attached as tar.gz below):
we get the following panic while running it:
Example project triggering this: rune_fmt_panic.tar.gz