Skip to content

Commit

Permalink
Unrolled build for rust-lang#125355
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#125355 - michaelwoerister:rust_log_force_capture, r=nnethercote

Use Backtrace::force_capture instead of Backtrace::capture in rustc_log

After rust-lang#125063, the compiler and custom drivers won't automatically set the RUST_BACKTRACE environment variable anymore, so we have to call `Backtrace::force_capture` instead of `Backtrace::capture` to unconditionally capture a backtrace.

rustc_log handles enabling backtraces via env vars itself, so we don't want RUST_BACKTRACE to make a difference.
  • Loading branch information
rust-timer authored May 22, 2024
2 parents 93e7cb8 + 8f11f48 commit 992f54e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ where
if !target.contains(&self.backtrace_target) {
return Ok(());
}
let backtrace = std::backtrace::Backtrace::capture();
// Use Backtrace::force_capture because we don't want to depend on the
// RUST_BACKTRACE environment variable being set.
let backtrace = std::backtrace::Backtrace::force_capture();
writeln!(writer, "stack backtrace: \n{backtrace:?}")
}
}
Expand Down

0 comments on commit 992f54e

Please sign in to comment.