From d221711b00c51a7983090311176011b20239d663 Mon Sep 17 00:00:00 2001 From: f001 Date: Sun, 14 May 2017 09:40:22 +0800 Subject: [PATCH] update backtrace formating text tips Follow up with PR 38165 --- src/librustc_driver/lib.rs | 4 ++-- src/libstd/panicking.rs | 2 +- src/libstd/sys_common/backtrace.rs | 2 +- src/test/run-pass/multi-panic.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 024fc546a158e..b69e45f6ebb29 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -1114,11 +1114,11 @@ pub fn monitor(f: F) { errors::Level::Note); } if match env::var_os("RUST_BACKTRACE") { - Some(val) => &val != "0", + Some(val) => (&val != "0") && (&val != "no"), None => false, } { handler.emit(&MultiSpan::new(), - "run with `RUST_BACKTRACE=1` for a backtrace", + "run with `RUST_BACKTRACE=yes` for a backtrace", errors::Level::Note); } diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 6f46a73698f35..020d4563da98f 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -354,7 +354,7 @@ fn default_hook(info: &PanicInfo) { if let Some(format) = log_backtrace { let _ = backtrace::print(err, format); } else if FIRST_PANIC.compare_and_swap(true, false, Ordering::SeqCst) { - let _ = writeln!(err, "note: Run with `RUST_BACKTRACE=1` for a backtrace."); + let _ = writeln!(err, "note: Run with `RUST_BACKTRACE=yes` for a backtrace."); } } }; diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 617218fe7a5a6..ceb61c162feeb 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -158,7 +158,7 @@ pub fn log_enabled() -> Option { } let val = match env::var_os("RUST_BACKTRACE") { - Some(x) => if &x == "0" { + Some(x) => if &x == "0" || &x == "no" { None } else if &x == "full" { Some(PrintFormat::Full) diff --git a/src/test/run-pass/multi-panic.rs b/src/test/run-pass/multi-panic.rs index 86fe06b176532..65de1b11d0ba9 100644 --- a/src/test/run-pass/multi-panic.rs +++ b/src/test/run-pass/multi-panic.rs @@ -16,7 +16,7 @@ fn check_for_no_backtrace(test: std::process::Output) { let mut it = err.lines(); assert_eq!(it.next().map(|l| l.starts_with("thread '' panicked at")), Some(true)); - assert_eq!(it.next(), Some("note: Run with `RUST_BACKTRACE=1` for a backtrace.")); + assert_eq!(it.next(), Some("note: Run with `RUST_BACKTRACE=yes` for a backtrace.")); assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true)); assert_eq!(it.next(), None); }