Zig has a very cool feature I just learned about:
The basic idea seems to be that the runtime automatically records every time a function returns an error, so that if the program exits with an error, the entire chain of "error events" can be printed, even if those errors were recovered from. (It may clear the record once a function returns without an error; I'm not sure.)
This is of course quite a bit of compiler magic, probably more than Rust can afford to add to all error types globally. But perhaps there's a way to achieve something similar in an opt-in way?
I wrote a pre rfc for this a while ago and it's already mentioned on the charter
but yea, I think we can definitely have error return traces in rust
Oh! I must have glossed over that before. Nice.
Last updated: Jan 29 2022 at 09:51 UTC