Skip to content

Commit 88baf8f

Browse files
committed
Adding backtrace off option for fuchsia targets
1 parent 78a891d commit 88baf8f

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

library/std/src/panic.rs

+16-17
Original file line numberDiff line numberDiff line change
@@ -295,23 +295,22 @@ pub fn get_backtrace_style() -> Option<BacktraceStyle> {
295295
return Some(style);
296296
}
297297

298-
// Setting environment variables for Fuchsia components isn't a standard
299-
// or easily supported workflow. For now, display backtraces by default.
300-
let format = if cfg!(target_os = "fuchsia") {
301-
BacktraceStyle::Full
302-
} else {
303-
crate::env::var_os("RUST_BACKTRACE")
304-
.map(|x| {
305-
if &x == "0" {
306-
BacktraceStyle::Off
307-
} else if &x == "full" {
308-
BacktraceStyle::Full
309-
} else {
310-
BacktraceStyle::Short
311-
}
312-
})
313-
.unwrap_or(BacktraceStyle::Off)
314-
};
298+
let format = crate::env::var_os("RUST_BACKTRACE")
299+
.map(|x| {
300+
if &x == "0" {
301+
BacktraceStyle::Off
302+
} else if &x == "full" {
303+
BacktraceStyle::Full
304+
} else {
305+
BacktraceStyle::Short
306+
}
307+
})
308+
.unwrap_or(if cfg!(target_os = "fuchsia") {
309+
// Fuchsia components default to full backtrace.
310+
BacktraceStyle::Full
311+
} else {
312+
BacktraceStyle::Off
313+
});
315314
set_backtrace_style(format);
316315
Some(format)
317316
}

0 commit comments

Comments
 (0)