Improvement of RUST_BACKTRACE merged on latest nightlies


#1

The default RUST_BACKTRACE=1 output now tries to remove irrelevant frames from the backtrace. So for

fn main() {
    panic!()
}

We go from

thread 'main' panicked at 'explicit panic', t.rs:2
stack backtrace:
   0:     0x5559640c8cc3 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::h3c67687ba454b78b
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x5559640c5224 - std::sys_common::backtrace::_print::h701c2403afe49d2d
                               at /checkout/src/libstd/sys_common/backtrace.rs:71
   2:     0x5559640ca23c - std::panicking::default_hook::{{closure}}::h07b8ee04b5734d1a
                               at /checkout/src/libstd/sys_common/backtrace.rs:60
                               at /checkout/src/libstd/panicking.rs:355
   3:     0x5559640c9e06 - std::panicking::default_hook::h23eeafbf7c1c05c3
                               at /checkout/src/libstd/panicking.rs:371
   4:     0x5559640ca5db - std::panicking::rust_panic_with_hook::hd0067971b6d1240e
                               at /checkout/src/libstd/panicking.rs:549
   5:     0x5559640c0dd3 - std::panicking::begin_panic::hf4f7d3d7e8e7863f
                               at /checkout/src/libstd/panicking.rs:511
   6:     0x5559640c0f82 - t::main::hf31397ea67eea730
                               at /tmp/t.rs:2
   7:     0x5559640d1fca - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:98
   8:     0x5559640cab26 - std::rt::lang_start::hb7fc7ec87b663023
                               at /checkout/src/libstd/panicking.rs:433
                               at /checkout/src/libstd/panic.rs:361
                               at /checkout/src/libstd/rt.rs:57
   9:     0x5559640c0fc2 - main
  10:     0x7f0af7240290 - __libc_start_main
  11:     0x5559640c0bf9 - _start
  12:                0x0 - <unknown>

to

thread 'main' panicked at 'explicit panic', t.rs:2
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: t::main
             at ./t.rs:2

Use RUST_BACKTRACE=full for the old behaviour.

Please reports cases where the backtrace is not cleaned properly. For example, panics in tests and threads other that the main are known to have trouble with this.


#2

This was an execellent improvement @Yamakaky. I added it to the release milestone predictions for 1.17.


#3

Thanks :wink: