Don't enable anyhow's backtrace feature in opt-dist by Zalathar · Pull Request #135146 · rust-lang/rust (original) (raw)

As far as I can tell, the stack traces printed by opt-dist look identical with and without this PR, right down to the first line of the backtrace being this in both cases:

   0: std::backtrace_rs::backtrace::libunwind::trace

Here's the full stderr of an erroneous invocation of opt-dist. It's identical (other than timestamps) to the same invocation without this PR.

[2025-01-06T07:03:16.926Z INFO  opt_dist::utils::io] Resetting directory opt-artifacts
[2025-01-06T07:03:17.403Z INFO  opt_dist::utils::io] Copying directory ./src/tools/rustc-perf to opt-artifacts/rustc-perf
[2025-01-06T07:03:18.722Z INFO  opt_dist::exec] Executing `RUSTC=./build/bogus/stage0/bin/rustc RUSTC_BOOTSTRAP=1 ./build/bogus/stage0/bin/cargo build -p collector [at opt-artifacts/rustc-perf]`
[2025-01-06T07:03:18.723Z INFO  opt_dist] Timer results
    -----------------------------------------
    
    Total duration:                        0s
    -----------------------------------------
    
[2025-01-06T07:03:18.752Z INFO  opt_dist::utils] Free disk space: 994.42 GiB out of total 1.81 TiB (46.33% used)
Error: Optimized build pipeline has failed

Caused by:
    No such file or directory (os error 2)

Stack backtrace:
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2: std::backtrace::Backtrace::create
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/backtrace.rs:331:13
   3: from<std::io::error::Error>
             at /Users/stuart/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.95/src/backtrace.rs:27:14
   4: from_residual<(), std::io::error::Error, anyhow::Error>
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/core/src/result.rs:2009:27
   5: run
             at ./src/tools/opt-dist/src/exec.rs:78:27
   6: build_rustc_perf
             at ./src/tools/opt-dist/src/main.rs:422:5
   7: copy_rustc_perf
             at ./src/tools/opt-dist/src/main.rs:418:5
   8: {closure#0}
             at ./src/tools/opt-dist/src/main.rs:205:9
   9: execute_pipeline
             at ./src/tools/opt-dist/src/main.rs:200:5
  10: main
             at ./src/tools/opt-dist/src/main.rs:401:18
  11: call_once<fn() -> core::result::Result<(), anyhow::Error>, ()>
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/core/src/ops/function.rs:250:5
  12: __rust_begin_short_backtrace<fn() -> core::result::Result<(), anyhow::Error>, core::result::Result<(), anyhow::Error>>
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/sys/backtrace.rs:154:18
  13: std::rt::lang_start::<core::result::Result<(), anyhow::Error>>::{closure#0}
  14: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/core/src/ops/function.rs:284:13
  15: std::panicking::try::do_call
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:557:40
  16: std::panicking::try
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:520:19
  17: std::panic::catch_unwind
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panic.rs:358:14
  18: std::rt::lang_start_internal::{{closure}}
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/rt.rs:174:48
  19: std::panicking::try::do_call
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:557:40
  20: std::panicking::try
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:520:19
  21: std::panic::catch_unwind
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panic.rs:358:14
  22: std::rt::lang_start_internal
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/rt.rs:174:20
  23: _main