Reverse stack trace order

+1

Ignoring precedent, I think reversing is much more natural from a "what a stack is" perspective and more efficient in terms of dev time.

Python does it right.

Perhaps it could be a dynamic option? So RUST_BACKTRACE=1 would remain unchanged, but RUST_BACKTRACE=2 could reverse it.

1 Like

Both those solutions are sub-optimal for current technological standards.
Ideally you would compile and run your program under the IDE in debug mode, and the debugger would automatically break the execution under a panic. This would not only open the editor in assert location, but also allow you to inspect program state (variables, etc.) at the assertion failure, as well as navigating up and down the debug frames, etc..

The current ordering bugs me with every stack trace I have to read. I also usually run the compiler in the terminal, and scrolling up is annoying. The actually relevant line is usually much closer to the top of the stack than to the bottom. (so, closer to the top with the current order).

A flag to switch the order would be nice.

Okay! It seems that some people are in favour, and some against.

The arguments against changing the status quo seems to be mostly on the line "this is what I'm used to" and "this is how it's done elsewhere" - arguments that should be respected. We should not turn something upside down willy-nilly!

I think a decent compromise for now is a PR with an option to reverse it, set by an environment variable – e.g. RUST_BACKTRACE_REVERSED
...though I would argue the CURRENT system is the reversed one :wink:

In any case, as Yamakaky mentioned it would be wise to wait for #38165 to be merged first.

3 Likes