From 8f11f48a027888b71efbb1769b432606e824e577 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Tue, 21 May 2024 10:54:36 +0200 Subject: [PATCH] Use Backtrace::force_capture instead of Backtrace::capture in rustc_log --- compiler/rustc_log/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_log/src/lib.rs b/compiler/rustc_log/src/lib.rs index 81257f9be8823..e11c45b66e6df 100644 --- a/compiler/rustc_log/src/lib.rs +++ b/compiler/rustc_log/src/lib.rs @@ -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:?}") } }