forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#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#111071 This is the change that does that for *all* panic messages.
- Loading branch information
Showing
108 changed files
with
241 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/tools/miri/tests/fail/concurrency/unwind_top_of_stack.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind1.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.extern_block.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/tools/miri/tests/fail/panic/thread_local_drop_panic.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at 'attempt to divide by zero', $DIR/div-by-zero-2.rs:LL:CC | ||
thread 'main' panicked at $DIR/div-by-zero-2.rs:LL:CC: | ||
attempt to divide by zero | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
9 changes: 6 additions & 3 deletions
9
src/tools/miri/tests/panic/function_calls/exported_symbol_good_unwind.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:LL:CC | ||
thread 'main' panicked at $DIR/exported_symbol_good_unwind.rs:LL:CC: | ||
explicit panic | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace | ||
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:LL:CC | ||
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:LL:CC | ||
thread 'main' panicked at $DIR/exported_symbol_good_unwind.rs:LL:CC: | ||
explicit panic | ||
thread 'main' panicked at $DIR/exported_symbol_good_unwind.rs:LL:CC: | ||
explicit panic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at 'range end index 5 out of range for slice of length 4', $DIR/oob_subslice.rs:LL:CC | ||
thread 'main' panicked at $DIR/oob_subslice.rs:LL:CC: | ||
range end index 5 out of range for slice of length 4 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at 'attempt to shift left with overflow', $DIR/overflowing-lsh-neg.rs:LL:CC | ||
thread 'main' panicked at $DIR/overflowing-lsh-neg.rs:LL:CC: | ||
attempt to shift left with overflow | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-1.rs:LL:CC | ||
thread 'main' panicked at $DIR/overflowing-rsh-1.rs:LL:CC: | ||
attempt to shift right with overflow | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-2.rs:LL:CC | ||
thread 'main' panicked at $DIR/overflowing-rsh-2.rs:LL:CC: | ||
attempt to shift right with overflow | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at '42-panicking from libstd', $DIR/panic2.rs:LL:CC | ||
thread 'main' panicked at $DIR/panic2.rs:LL:CC: | ||
42-panicking from libstd | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at 'panicking from libcore', $DIR/panic3.rs:LL:CC | ||
thread 'main' panicked at $DIR/panic3.rs:LL:CC: | ||
panicking from libcore | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at '42-panicking from libcore', $DIR/panic4.rs:LL:CC | ||
thread 'main' panicked at $DIR/panic4.rs:LL:CC: | ||
42-panicking from libcore | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', $DIR/transmute_fat2.rs:LL:CC | ||
thread 'main' panicked at $DIR/transmute_fat2.rs:LL:CC: | ||
index out of bounds: the len is 0 but the index is 0 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
3 changes: 2 additions & 1 deletion
3
src/tools/miri/tests/panic/unsupported_foreign_function.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at 'unsupported Miri functionality: can't call foreign function `foo` on $OS', $DIR/unsupported_foreign_function.rs:LL:CC | ||
thread 'main' panicked at $DIR/unsupported_foreign_function.rs:LL:CC: | ||
unsupported Miri functionality: can't call foreign function `foo` on $OS | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
thread 'main' panicked at 'unsupported Miri functionality: can't execute syscall with ID 0', $DIR/unsupported_syscall.rs:LL:CC | ||
thread 'main' panicked at $DIR/unsupported_syscall.rs:LL:CC: | ||
unsupported Miri functionality: can't execute syscall with ID 0 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
thread '<unnamed>' panicked at 'Hello!', $DIR/simple.rs:LL:CC | ||
thread '<unnamed>' panicked at $DIR/simple.rs:LL:CC: | ||
Hello! | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace | ||
thread 'childthread' panicked at 'Hello, world!', $DIR/simple.rs:LL:CC | ||
thread 'childthread' panicked at $DIR/simple.rs:LL:CC: | ||
Hello, world! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
thread 'main' panicked at 'Hello from panic: std', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
Hello from panic: std | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace | ||
Caught panic message (&str): Hello from panic: std | ||
thread 'main' panicked at 'Hello from panic: 1', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
Hello from panic: 1 | ||
Caught panic message (String): Hello from panic: 1 | ||
thread 'main' panicked at 'Hello from panic: 2', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
Hello from panic: 2 | ||
Caught panic message (String): Hello from panic: 2 | ||
thread 'main' panicked at 'Box<dyn Any>', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
Box<dyn Any> | ||
Failed to get caught panic message. | ||
thread 'main' panicked at 'Hello from panic: core', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
Hello from panic: core | ||
Caught panic message (&str): Hello from panic: core | ||
thread 'main' panicked at 'Hello from panic: 5', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
Hello from panic: 5 | ||
Caught panic message (String): Hello from panic: 5 | ||
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 4', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
index out of bounds: the len is 3 but the index is 4 | ||
Caught panic message (String): index out of bounds: the len is 3 but the index is 4 | ||
thread 'main' panicked at 'attempt to divide by zero', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
attempt to divide by zero | ||
Caught panic message (&str): attempt to divide by zero | ||
thread 'main' panicked at 'align_offset: align is not a power-of-two', RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC | ||
thread 'main' panicked at RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC: | ||
align_offset: align is not a power-of-two | ||
Caught panic message (&str): align_offset: align is not a power-of-two | ||
thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
assertion failed: false | ||
Caught panic message (&str): assertion failed: false | ||
thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:LL:CC | ||
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC: | ||
assertion failed: false | ||
Caught panic message (&str): assertion failed: false | ||
Success! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
Thread 1 starting, will block on mutex | ||
Thread 1 reported it has started | ||
thread '<unnamed>' panicked at 'panic in thread 2', $DIR/concurrent-panic.rs:LL:CC | ||
thread '<unnamed>' panicked at $DIR/concurrent-panic.rs:LL:CC: | ||
panic in thread 2 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace | ||
Thread 2 blocking on thread 1 | ||
Thread 2 reported it has started | ||
Unlocking mutex | ||
thread '<unnamed>' panicked at 'panic in thread 1', $DIR/concurrent-panic.rs:LL:CC | ||
thread '<unnamed>' panicked at $DIR/concurrent-panic.rs:LL:CC: | ||
panic in thread 1 | ||
Thread 1 has exited | ||
Thread 2 has exited |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
thread 'main' panicked at 'once', $DIR/nested_panic_caught.rs:LL:CC | ||
thread 'main' panicked at $DIR/nested_panic_caught.rs:LL:CC: | ||
once | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace | ||
thread 'main' panicked at 'twice', $DIR/nested_panic_caught.rs:LL:CC | ||
thread 'main' panicked at $DIR/nested_panic_caught.rs:LL:CC: | ||
twice | ||
stack backtrace: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><testsuites><testsuite name="test" package="test" id="0" errors="0" failures="1" tests="4" skipped="1" ><testcase classname="unknown" name="a" time="$TIME"/><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>
<![CDATA[thread 'b' panicked at 'assertion failed: false', f.rs:10:5]]>
<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"/><system-out/><system-err/></testsuite></testsuites> | ||
<?xml version="1.0" encoding="UTF-8"?><testsuites><testsuite name="test" package="test" id="0" errors="0" failures="1" tests="4" skipped="1" ><testcase classname="unknown" name="a" time="$TIME"/><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>
<![CDATA[thread 'b' panicked at f.rs:10:5:]]>
<![CDATA[assertion failed: false]]>
<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"/><system-out/><system-err/></testsuite></testsuites> |
Oops, something went wrong.