about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2023-03-19 15:33:56 +0530
committerGitHub <noreply@github.com>2023-03-19 15:33:56 +0530
commite458a7949ffa5fe4280fcf7cae4daf6ff80269c9 (patch)
tree92378043b8bf193fed960405ab0328a58dc7f2a6
parente9c25b4ad5a78e7a125efec5bc050abe1eff293e (diff)
parent3ae03c7aee740eda1f18ec7c189bc705cfb44964 (diff)
downloadrust-e458a7949ffa5fe4280fcf7cae4daf6ff80269c9.tar.gz
rust-e458a7949ffa5fe4280fcf7cae4daf6ff80269c9.zip
Rollup merge of #108798 - devsnek:panic-pal-exception, r=workingjubilee
move default backtrace setting to sys

another PAL exception. moves the default backtrace setting to sys.
-rw-r--r--library/std/src/panic.rs3
-rw-r--r--library/std/src/sys/mod.rs9
-rw-r--r--src/tools/tidy/src/pal.rs1
3 files changed, 10 insertions, 3 deletions
diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs
index 9fa8f5702a8..345d72ef867 100644
--- a/library/std/src/panic.rs
+++ b/library/std/src/panic.rs
@@ -308,8 +308,7 @@ pub fn get_backtrace_style() -> Option<BacktraceStyle> {
                 BacktraceStyle::Short
             }
         })
-        .unwrap_or(if cfg!(target_os = "fuchsia") {
-            // Fuchsia components default to full backtrace.
+        .unwrap_or(if crate::sys::FULL_BACKTRACE_DEFAULT {
             BacktraceStyle::Full
         } else {
             BacktraceStyle::Off
diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs
index c080c176a2a..e767b2866cb 100644
--- a/library/std/src/sys/mod.rs
+++ b/library/std/src/sys/mod.rs
@@ -76,3 +76,12 @@ cfg_if::cfg_if! {
         pub mod c;
     }
 }
+
+cfg_if::cfg_if! {
+    // Fuchsia components default to full backtrace.
+    if #[cfg(target_os = "fuchsia")] {
+        pub const FULL_BACKTRACE_DEFAULT: bool = true;
+    } else {
+        pub const FULL_BACKTRACE_DEFAULT: bool = false;
+    }
+}
diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs
index 868579b4b1a..6b7b27fd526 100644
--- a/src/tools/tidy/src/pal.rs
+++ b/src/tools/tidy/src/pal.rs
@@ -59,7 +59,6 @@ const EXCEPTION_PATHS: &[&str] = &[
     "library/std/src/path.rs",
     "library/std/src/sys_common", // Should only contain abstractions over platforms
     "library/std/src/net/test.rs", // Utility helpers for tests
-    "library/std/src/panic.rs",   // fuchsia-specific panic backtrace handling
     "library/std/src/personality.rs",
     "library/std/src/personality/",
 ];