Skip to content

Commit 123b72a

Browse files
committed
Rollup merge of rust-lang#56748 - kinnison:kinnison/fix-56734, r=dtolnay
Update panic message to be clearer about env-vars Esteban Kuber requested that the panic message make it clear that `RUST_BACKTRACE=1` is an environment variable. This change makes that clear. I understand that this may simply be closed if the concept isn't accepted, and I'd be fine with that :-) Fixes rust-lang#56734
2 parents 7ec1faa + 6057147 commit 123b72a

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/libstd/panicking.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ fn default_hook(info: &PanicInfo) {
209209
if let Some(format) = log_backtrace {
210210
let _ = backtrace::print(err, format);
211211
} else if FIRST_PANIC.compare_and_swap(true, false, Ordering::SeqCst) {
212-
let _ = writeln!(err, "note: Run with `RUST_BACKTRACE=1` for a backtrace.");
212+
let _ = writeln!(err, "note: Run with `RUST_BACKTRACE=1` \
213+
environment variable to display a backtrace.");
213214
}
214215
}
215216
};

src/test/run-make-fulldeps/libtest-json/output.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{ "type": "test", "event": "started", "name": "a" }
33
{ "type": "test", "name": "a", "event": "ok" }
44
{ "type": "test", "event": "started", "name": "b" }
5-
{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:18:5\nnote: Run with `RUST_BACKTRACE=1` for a backtrace.\n" }
5+
{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:18:5\nnote: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.\n" }
66
{ "type": "test", "event": "started", "name": "c" }
77
{ "type": "test", "name": "c", "event": "ok" }
88
{ "type": "test", "event": "started", "name": "d" }

src/test/run-pass/multi-panic.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ fn check_for_no_backtrace(test: std::process::Output) {
1717
let mut it = err.lines();
1818

1919
assert_eq!(it.next().map(|l| l.starts_with("thread '<unnamed>' panicked at")), Some(true));
20-
assert_eq!(it.next(), Some("note: Run with `RUST_BACKTRACE=1` for a backtrace."));
20+
assert_eq!(it.next(), Some("note: Run with `RUST_BACKTRACE=1` \
21+
environment variable to display a backtrace."));
2122
assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true));
2223
assert_eq!(it.next(), None);
2324
}

src/test/rustdoc-ui/failed-doctest-output.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ error[E0425]: cannot find value `no` in this scope
1313
| ^^ not found in this scope
1414

1515
thread '$DIR/failed-doctest-output.rs - OtherStruct (line 27)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:326:13
16-
note: Run with `RUST_BACKTRACE=1` for a backtrace.
16+
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
1717

1818
---- $DIR/failed-doctest-output.rs - SomeStruct (line 21) stdout ----
1919
thread '$DIR/failed-doctest-output.rs - SomeStruct (line 21)' panicked at 'test executable failed:
2020

2121
thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:3:1
22-
note: Run with `RUST_BACKTRACE=1` for a backtrace.
22+
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2323

2424
', src/librustdoc/test.rs:361:17
2525

0 commit comments

Comments
 (0)