eyre-rs / color-eyre

Custom hooks for colorful human oriented error reports via panics and the eyre crate
Other
960 stars 56 forks source link

color-eyre uses the same inexplicable information order as standard backtraces #139

Open safinaskar opened 1 year ago

safinaskar commented 1 year ago

Consider this code:

fn g() {
    panic!();
}

fn f() {
    g();
}

fn main() {
    color_eyre::install().unwrap(); f();
}

Here is output of RUST_BACKTRACE=1 cargo run --release:

The application panicked (crashed).
Message:  explicit panic
Location: src/main.rs:2

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 8 frames hidden ⋮                               
   9: core::panicking::panic::h1b0af24502591aff
      at /rustc/13e6f24b9adda67852fb86538541adaa68aff6e8/library/core/src/panicking.rs:127
  10: fastertha::g::hbcd4195430211455
      at /tmp/fastertha/src/main.rs:2
  11: fastertha::f::hb05321583c5f1adf
      at /tmp/fastertha/src/main.rs:6
  12: fastertha::main::h74d25b490126aede
      at /tmp/fastertha/src/main.rs:10
  13: core::ops::function::FnOnce::call_once::h2ea4dee289c5a1d9
      at /rustc/13e6f24b9adda67852fb86538541adaa68aff6e8/library/core/src/ops/function.rs:250
                                ⋮ 14 frames hidden ⋮                              

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.

Unfortunately, the output above uses the same inexplicable, impossible to understand structure as standard backtraces use. To understand what I mean, please read my bug report on standard backtraces: https://github.com/rust-lang/rust/issues/99560 , especially this comment: https://github.com/rust-lang/rust/issues/99560#issuecomment-1752992025 (first comment may be useful, too: https://github.com/rust-lang/rust/issues/99560#issue-1313328038 ).

color-eyre 0.6.2

safinaskar commented 1 year ago

I used this:

[profile.release]
debug = 1