Skip to content

Commit d1712f4

Browse files
committed
move default backtrace setting to sys
1 parent 13afbda commit d1712f4

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

library/std/src/panic.rs

+1-2
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::BACKTRACE_DEFAULT {
313312
BacktraceStyle::Full
314313
} else {
315314
BacktraceStyle::Off

library/std/src/sys/mod.rs

+9
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 BACKTRACE_DEFAULT: bool = true;
84+
} else {
85+
pub const BACKTRACE_DEFAULT: bool = false;
86+
}
87+
}

src/tools/tidy/src/pal.rs

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const EXCEPTION_PATHS: &[&str] = &[
5959
"library/std/src/path.rs",
6060
"library/std/src/sys_common", // Should only contain abstractions over platforms
6161
"library/std/src/net/test.rs", // Utility helpers for tests
62-
"library/std/src/panic.rs", // fuchsia-specific panic backtrace handling
6362
"library/std/src/personality.rs",
6463
"library/std/src/personality/",
6564
];

0 commit comments

Comments
 (0)