sentry-rust icon indicating copy to clipboard operation
sentry-rust copied to clipboard

std::backtrace compatibility

Open pjenvey opened this issue 2 years ago • 4 comments

Rust as of 1.65.0 (released in 2022-11) now ships with a Backtrace in std. sentry-backtrace should support its usage by providing another backtrace_to_stacktrace function that accepts a std::backtrace::Backtrace instead of backtrace::Backtrace.

pjenvey avatar Jul 20 '23 18:07 pjenvey

It looks like one potential option for using the new std Backtrace would be to render it via e.g. format!("{:#?}", backtrace) and passing that to parse_stacktrace. Its own backtrace_to_stacktrace impl would be more efficient though.

pjenvey avatar Jul 20 '23 23:07 pjenvey

As you mentioned, the only thing you can do with std::backtrace::Backtrace right now is Debug-format it, so I doubt it would be useful to have a separate function for it right now.

It might make sense to even completely replace the current usage of backtrace::Backtrace once the std variant is on par with it, and possibly the wider ecosystem would also move to the std variant as well, like the anyhow integration, etc.

Swatinem avatar Jul 21 '23 09:07 Swatinem

I hadn't noticed Backtrace::frames has not stabilized yet, thanks. Agreed that that is a blocker for this.

pjenvey avatar Jul 21 '23 18:07 pjenvey

Not only is Backtrace::frames not stabilized yet, it is also pretty useless in its current form, as the only thing you can do with it is Debug-format it.

Swatinem avatar Jul 24 '23 07:07 Swatinem