about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-12-25 17:25:58 +0800
committerGitHub <noreply@github.com>2024-12-25 17:25:58 +0800
commitaef9d6b0a828a8a1919db5e58abbbc7fe95114cc (patch)
treedeeccf60637067c77ca2e15d54d4ceb4b8254890
parent68b9e4f5f5566424b8edc2c75feefe3a4ee2fa72 (diff)
parentc7a28d579b8209337fe959e2384d3884878d887c (diff)
downloadrust-aef9d6b0a828a8a1919db5e58abbbc7fe95114cc.tar.gz
rust-aef9d6b0a828a8a1919db5e58abbbc7fe95114cc.zip
Rollup merge of #134743 - jyn514:rustc-dev-short-backtraces, r=jieyouxu
Default to short backtraces for dev builds of rustc itself

A dev build almost certainly means that whoever's built the compiler has the opportunity to rerun it to collect a more complete trace. So we don't need to default to a complete trace; we should hide irrelevant details by default.
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index 3dc39fc131a..b13cc4d0b06 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -1388,7 +1388,11 @@ pub fn install_ice_hook(
     // opt in to less-verbose backtraces by manually setting "RUST_BACKTRACE"
     // (e.g. `RUST_BACKTRACE=1`)
     if env::var_os("RUST_BACKTRACE").is_none() {
-        panic::set_backtrace_style(panic::BacktraceStyle::Full);
+        if env!("CFG_RELEASE_CHANNEL") == "dev" {
+            panic::set_backtrace_style(panic::BacktraceStyle::Short);
+        } else {
+            panic::set_backtrace_style(panic::BacktraceStyle::Full);
+        }
     }
 
     let using_internal_features = Arc::new(std::sync::atomic::AtomicBool::default());