Skip to content

Commit bb982d7

Browse files
committed
Auto merge of #112849 - m-ou-se:panic-message-format, r=thomcc
Change default panic handler message format. This changes the default panic hook's message format from: ``` thread '{thread}' panicked at '{message}', {location} ``` to ``` thread '{thread}' panicked at {location}: {message} ``` This puts the message on its own line without surrounding quotes, making it easiser to read. For example: Before: ``` thread 'main' panicked at 'env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`', src/main.rs:4:6 ``` After: ``` thread 'main' panicked at src/main.rs:4:6: env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh` ``` --- See this PR by `@nyurik,` which does that for only multi-line messages (specifically because of `assert_eq`): rust-lang/rust#111071 This is the change that does that for *all* panic messages.
2 parents ff1e280 + 24bc56b commit bb982d7

33 files changed

+98
-49
lines changed

tests/fail/concurrency/unwind_top_of_stack.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread '<unnamed>' panicked at 'explicit panic', $DIR/unwind_top_of_stack.rs:LL:CC
1+
thread '<unnamed>' panicked at $DIR/unwind_top_of_stack.rs:LL:CC:
2+
explicit panic
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
34
error: Undefined Behavior: unwinding past the topmost frame of the stack
45
--> $DIR/unwind_top_of_stack.rs:LL:CC

tests/fail/function_calls/exported_symbol_bad_unwind1.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_bad_unwind1.rs:LL:CC
1+
thread 'main' panicked at $DIR/exported_symbol_bad_unwind1.rs:LL:CC:
2+
explicit panic
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
34
error: Undefined Behavior: unwinding past a stack frame that does not allow unwinding
45
--> $DIR/exported_symbol_bad_unwind1.rs:LL:CC

tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_bad_unwind2.rs:LL:CC
1+
thread 'main' panicked at $DIR/exported_symbol_bad_unwind2.rs:LL:CC:
2+
explicit panic
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
34
error: abnormal termination: panic in a function that cannot unwind
45
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC

tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_bad_unwind2.rs:LL:CC
1+
thread 'main' panicked at $DIR/exported_symbol_bad_unwind2.rs:LL:CC:
2+
explicit panic
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
34
error: abnormal termination: panic in a function that cannot unwind
45
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC

tests/fail/function_calls/exported_symbol_bad_unwind2.extern_block.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_bad_unwind2.rs:LL:CC
1+
thread 'main' panicked at $DIR/exported_symbol_bad_unwind2.rs:LL:CC:
2+
explicit panic
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
34
error: Undefined Behavior: unwinding past a stack frame that does not allow unwinding
45
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC

tests/fail/panic/bad_unwind.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at 'explicit panic', $DIR/bad_unwind.rs:LL:CC
1+
thread 'main' panicked at $DIR/bad_unwind.rs:LL:CC:
2+
explicit panic
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
34
error: Undefined Behavior: unwinding past a stack frame that does not allow unwinding
45
--> $DIR/bad_unwind.rs:LL:CC

tests/fail/panic/double_panic.stderr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
thread 'main' panicked at 'first', $DIR/double_panic.rs:LL:CC
1+
thread 'main' panicked at $DIR/double_panic.rs:LL:CC:
2+
first
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3-
thread 'main' panicked at 'second', $DIR/double_panic.rs:LL:CC
4+
thread 'main' panicked at $DIR/double_panic.rs:LL:CC:
5+
second
46
stack backtrace:
57
error: abnormal termination: panic in a function that cannot unwind
68
--> $DIR/double_panic.rs:LL:CC

tests/fail/panic/no_std.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
panicked at 'blarg I am dead', $DIR/no_std.rs:LL:CC
1+
panicked at $DIR/no_std.rs:LL:CC:
2+
blarg I am dead
23
error: abnormal termination: the program aborted execution
34
--> $DIR/no_std.rs:LL:CC
45
|

tests/fail/panic/panic_abort1.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at 'panicking from libstd', $DIR/panic_abort1.rs:LL:CC
1+
thread 'main' panicked at $DIR/panic_abort1.rs:LL:CC:
2+
panicking from libstd
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
34
error: abnormal termination: the program aborted execution
45
--> RUSTLIB/panic_abort/src/lib.rs:LL:CC

tests/fail/panic/panic_abort2.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at '42-panicking from libstd', $DIR/panic_abort2.rs:LL:CC
1+
thread 'main' panicked at $DIR/panic_abort2.rs:LL:CC:
2+
42-panicking from libstd
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
34
error: abnormal termination: the program aborted execution
45
--> RUSTLIB/panic_abort/src/lib.rs:LL:CC

0 commit comments

Comments
 (0)