Skip to content

Commit ae7b16c

Browse files
authored
Rollup merge of rust-lang#108798 - devsnek:panic-pal-exception, r=workingjubilee
move default backtrace setting to sys another PAL exception. moves the default backtrace setting to sys.
2 parents 65a1645 + 51f083b commit ae7b16c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

std/src/panic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,7 @@ pub fn get_backtrace_style() -> Option<BacktraceStyle> {
308308
BacktraceStyle::Short
309309
}
310310
})
311-
.unwrap_or(if cfg!(target_os = "fuchsia") {
312-
// Fuchsia components default to full backtrace.
311+
.unwrap_or(if crate::sys::FULL_BACKTRACE_DEFAULT {
313312
BacktraceStyle::Full
314313
} else {
315314
BacktraceStyle::Off

std/src/sys/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,12 @@ cfg_if::cfg_if! {
7676
pub mod c;
7777
}
7878
}
79+
80+
cfg_if::cfg_if! {
81+
// Fuchsia components default to full backtrace.
82+
if #[cfg(target_os = "fuchsia")] {
83+
pub const FULL_BACKTRACE_DEFAULT: bool = true;
84+
} else {
85+
pub const FULL_BACKTRACE_DEFAULT: bool = false;
86+
}
87+
}

0 commit comments

Comments
 (0)