Skip to content

Commit 828bdc2

Browse files
committed
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.
2 parents c435af0 + 2c5ecf2 commit 828bdc2

File tree

108 files changed

+241
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+241
-134
lines changed

library/core/src/error.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ information that is already communicated by the source error being
9393
unwrapped:
9494

9595
```text
96-
thread 'main' panicked at 'env variable `IMPORTANT_PATH` is not set: NotPresent', src/main.rs:4:6
96+
thread 'main' panicked at src/main.rs:4:6:
97+
env variable `IMPORTANT_PATH` is not set: NotPresent
9798
```
9899

99100
In this example we end up mentioning that an env variable is not set,
@@ -109,7 +110,8 @@ prevent the source error, we end up introducing new information that is
109110
independent from our source error.
110111

111112
```text
112-
thread 'main' panicked at 'env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`: NotPresent', src/main.rs:4:6
113+
thread 'main' panicked at src/main.rs:4:6:
114+
env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`: NotPresent
113115
```
114116

115117
In this example we are communicating not only the name of the

library/core/src/panic/panic_info.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,18 @@ impl<'a> PanicInfo<'a> {
147147
impl fmt::Display for PanicInfo<'_> {
148148
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
149149
formatter.write_str("panicked at ")?;
150+
self.location.fmt(formatter)?;
150151
if let Some(message) = self.message {
151-
write!(formatter, "'{}', ", message)?
152+
formatter.write_str(":\n")?;
153+
formatter.write_fmt(*message)?;
152154
} else if let Some(payload) = self.payload.downcast_ref::<&'static str>() {
153-
write!(formatter, "'{}', ", payload)?
155+
formatter.write_str(":\n")?;
156+
formatter.write_str(payload)?;
154157
}
155158
// NOTE: we cannot use downcast_ref::<String>() here
156159
// since String is not available in core!
157160
// The payload is a String when `std::panic!` is called with multiple arguments,
158161
// but in that case the message is also available.
159-
160-
self.location.fmt(formatter)
162+
Ok(())
161163
}
162164
}

library/std/src/error.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ mod private {
121121
/// This example produces the following output:
122122
///
123123
/// ```console
124-
/// thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SuperError is here!: SuperErrorSideKick is here!', src/error.rs:34:40
124+
/// thread 'main' panicked at src/error.rs:34:40:
125+
/// called `Result::unwrap()` on an `Err` value: SuperError is here!: SuperErrorSideKick is here!
125126
/// note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
126127
/// ```
127128
///

library/std/src/panicking.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::path
266266
let name = thread.as_ref().and_then(|t| t.name()).unwrap_or("<unnamed>");
267267

268268
let write = |err: &mut dyn crate::io::Write, backtrace: Option<BacktraceStyle>| {
269-
let _ = writeln!(err, "thread '{name}' panicked at '{msg}', {location}");
269+
let _ = writeln!(err, "thread '{name}' panicked at {location}:\n{msg}");
270270

271271
static FIRST_PANIC: AtomicBool = AtomicBool::new(true);
272272

src/tools/miri/tests/fail/concurrency/unwind_top_of_stack.stderr

+2-1
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

src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind1.stderr

+2-1
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

src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr

+2-1
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

src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr

+2-1
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

src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.extern_block.stderr

+2-1
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

src/tools/miri/tests/fail/panic/bad_unwind.stderr

+2-1
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

src/tools/miri/tests/fail/panic/double_panic.stderr

+4-2
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

src/tools/miri/tests/fail/panic/no_std.stderr

+2-1
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
|

src/tools/miri/tests/fail/panic/panic_abort1.stderr

+2-1
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

src/tools/miri/tests/fail/panic/panic_abort2.stderr

+2-1
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

src/tools/miri/tests/fail/panic/panic_abort3.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at 'panicking from libcore', $DIR/panic_abort3.rs:LL:CC
1+
thread 'main' panicked at $DIR/panic_abort3.rs:LL:CC:
2+
panicking from libcore
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

src/tools/miri/tests/fail/panic/panic_abort4.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at '42-panicking from libcore', $DIR/panic_abort4.rs:LL:CC
1+
thread 'main' panicked at $DIR/panic_abort4.rs:LL:CC:
2+
42-panicking from libcore
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

src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread $NAME panicked at 'ow', $DIR/thread_local_const_drop_panic.rs:LL:CC
1+
thread $NAME panicked at $DIR/thread_local_const_drop_panic.rs:LL:CC:
2+
ow
23
fatal runtime error: thread local panicked on drop
34
error: abnormal termination: the program aborted execution
45

src/tools/miri/tests/fail/panic/thread_local_drop_panic.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread $NAME panicked at 'ow', $DIR/thread_local_drop_panic.rs:LL:CC
1+
thread $NAME panicked at $DIR/thread_local_drop_panic.rs:LL:CC:
2+
ow
23
fatal runtime error: thread local panicked on drop
34
error: abnormal termination: the program aborted execution
45

src/tools/miri/tests/fail/terminate-terminator.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
warning: You have explicitly enabled MIR optimizations, overriding Miri's default which is to completely disable them. Any optimizations may hide UB that Miri would otherwise detect, and it is not necessarily possible to predict what kind of UB will be missed. If you are enabling optimizations to make Miri run faster, we advise using cfg(miri) to shrink your workload instead. The performance benefit of enabling MIR optimizations is usually marginal at best.
22

3-
thread 'main' panicked at 'explicit panic', $DIR/terminate-terminator.rs:LL:CC
3+
thread 'main' panicked at $DIR/terminate-terminator.rs:LL:CC:
4+
explicit panic
45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
56
error: abnormal termination: panic in a function that cannot unwind
67
--> $DIR/terminate-terminator.rs:LL:CC

src/tools/miri/tests/fail/unwind-action-terminate.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at 'explicit panic', $DIR/unwind-action-terminate.rs:LL:CC
1+
thread 'main' panicked at $DIR/unwind-action-terminate.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/unwind-action-terminate.rs:LL:CC
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at 'attempt to divide by zero', $DIR/div-by-zero-2.rs:LL:CC
1+
thread 'main' panicked at $DIR/div-by-zero-2.rs:LL:CC:
2+
attempt to divide by zero
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:LL:CC
1+
thread 'main' panicked at $DIR/exported_symbol_good_unwind.rs:LL:CC:
2+
explicit panic
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3-
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:LL:CC
4-
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:LL:CC
4+
thread 'main' panicked at $DIR/exported_symbol_good_unwind.rs:LL:CC:
5+
explicit panic
6+
thread 'main' panicked at $DIR/exported_symbol_good_unwind.rs:LL:CC:
7+
explicit panic
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at 'range end index 5 out of range for slice of length 4', $DIR/oob_subslice.rs:LL:CC
1+
thread 'main' panicked at $DIR/oob_subslice.rs:LL:CC:
2+
range end index 5 out of range for slice of length 4
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at 'attempt to shift left with overflow', $DIR/overflowing-lsh-neg.rs:LL:CC
1+
thread 'main' panicked at $DIR/overflowing-lsh-neg.rs:LL:CC:
2+
attempt to shift left with overflow
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-1.rs:LL:CC
1+
thread 'main' panicked at $DIR/overflowing-rsh-1.rs:LL:CC:
2+
attempt to shift right with overflow
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at 'attempt to shift right with overflow', $DIR/overflowing-rsh-2.rs:LL:CC
1+
thread 'main' panicked at $DIR/overflowing-rsh-2.rs:LL:CC:
2+
attempt to shift right with overflow
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

src/tools/miri/tests/panic/panic1.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
thread 'main' panicked at 'panicking from libstd', $DIR/panic1.rs:LL:CC
1+
thread 'main' panicked at $DIR/panic1.rs:LL:CC:
2+
panicking from libstd
23
stack backtrace:
34
0: std::panicking::begin_panic_handler
45
at RUSTLIB/std/src/panicking.rs:LL:CC
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at '42-panicking from libstd', $DIR/panic2.rs:LL:CC
1+
thread 'main' panicked at $DIR/panic2.rs:LL:CC:
2+
42-panicking from libstd
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at 'panicking from libcore', $DIR/panic3.rs:LL:CC
1+
thread 'main' panicked at $DIR/panic3.rs:LL:CC:
2+
panicking from libcore
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at '42-panicking from libcore', $DIR/panic4.rs:LL:CC
1+
thread 'main' panicked at $DIR/panic4.rs:LL:CC:
2+
42-panicking from libcore
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', $DIR/transmute_fat2.rs:LL:CC
1+
thread 'main' panicked at $DIR/transmute_fat2.rs:LL:CC:
2+
index out of bounds: the len is 0 but the index is 0
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at 'unsupported Miri functionality: can't call foreign function `foo` on $OS', $DIR/unsupported_foreign_function.rs:LL:CC
1+
thread 'main' panicked at $DIR/unsupported_foreign_function.rs:LL:CC:
2+
unsupported Miri functionality: can't call foreign function `foo` on $OS
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
thread 'main' panicked at 'unsupported Miri functionality: can't execute syscall with ID 0', $DIR/unsupported_syscall.rs:LL:CC
1+
thread 'main' panicked at $DIR/unsupported_syscall.rs:LL:CC:
2+
unsupported Miri functionality: can't execute syscall with ID 0
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
thread '<unnamed>' panicked at 'Hello!', $DIR/simple.rs:LL:CC
1+
thread '<unnamed>' panicked at $DIR/simple.rs:LL:CC:
2+
Hello!
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3-
thread 'childthread' panicked at 'Hello, world!', $DIR/simple.rs:LL:CC
4+
thread 'childthread' panicked at $DIR/simple.rs:LL:CC:
5+
Hello, world!
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
1-
thread 'main' panicked at 'Hello from panic: std', $DIR/catch_panic.rs:LL:CC
1+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
2+
Hello from panic: std
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
34
Caught panic message (&str): Hello from panic: std
4-
thread 'main' panicked at 'Hello from panic: 1', $DIR/catch_panic.rs:LL:CC
5+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
6+
Hello from panic: 1
57
Caught panic message (String): Hello from panic: 1
6-
thread 'main' panicked at 'Hello from panic: 2', $DIR/catch_panic.rs:LL:CC
8+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
9+
Hello from panic: 2
710
Caught panic message (String): Hello from panic: 2
8-
thread 'main' panicked at 'Box<dyn Any>', $DIR/catch_panic.rs:LL:CC
11+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
12+
Box<dyn Any>
913
Failed to get caught panic message.
10-
thread 'main' panicked at 'Hello from panic: core', $DIR/catch_panic.rs:LL:CC
14+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
15+
Hello from panic: core
1116
Caught panic message (&str): Hello from panic: core
12-
thread 'main' panicked at 'Hello from panic: 5', $DIR/catch_panic.rs:LL:CC
17+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
18+
Hello from panic: 5
1319
Caught panic message (String): Hello from panic: 5
14-
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 4', $DIR/catch_panic.rs:LL:CC
20+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
21+
index out of bounds: the len is 3 but the index is 4
1522
Caught panic message (String): index out of bounds: the len is 3 but the index is 4
16-
thread 'main' panicked at 'attempt to divide by zero', $DIR/catch_panic.rs:LL:CC
23+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
24+
attempt to divide by zero
1725
Caught panic message (&str): attempt to divide by zero
18-
thread 'main' panicked at 'align_offset: align is not a power-of-two', RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
26+
thread 'main' panicked at RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC:
27+
align_offset: align is not a power-of-two
1928
Caught panic message (&str): align_offset: align is not a power-of-two
20-
thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:LL:CC
29+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
30+
assertion failed: false
2131
Caught panic message (&str): assertion failed: false
22-
thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:LL:CC
32+
thread 'main' panicked at $DIR/catch_panic.rs:LL:CC:
33+
assertion failed: false
2334
Caught panic message (&str): assertion failed: false
2435
Success!
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
Thread 1 starting, will block on mutex
22
Thread 1 reported it has started
3-
thread '<unnamed>' panicked at 'panic in thread 2', $DIR/concurrent-panic.rs:LL:CC
3+
thread '<unnamed>' panicked at $DIR/concurrent-panic.rs:LL:CC:
4+
panic in thread 2
45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
56
Thread 2 blocking on thread 1
67
Thread 2 reported it has started
78
Unlocking mutex
8-
thread '<unnamed>' panicked at 'panic in thread 1', $DIR/concurrent-panic.rs:LL:CC
9+
thread '<unnamed>' panicked at $DIR/concurrent-panic.rs:LL:CC:
10+
panic in thread 1
911
Thread 1 has exited
1012
Thread 2 has exited
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
thread 'main' panicked at 'once', $DIR/nested_panic_caught.rs:LL:CC
1+
thread 'main' panicked at $DIR/nested_panic_caught.rs:LL:CC:
2+
once
23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3-
thread 'main' panicked at 'twice', $DIR/nested_panic_caught.rs:LL:CC
4+
thread 'main' panicked at $DIR/nested_panic_caught.rs:LL:CC:
5+
twice
46
stack backtrace:

tests/run-make/libtest-json/output-default.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 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" }
5+
{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at f.rs:9:5:\nassertion failed: false\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" }

tests/run-make/libtest-json/output-stdout-success.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
{ "type": "test", "event": "started", "name": "a" }
33
{ "type": "test", "name": "a", "event": "ok", "stdout": "print from successful test\n" }
44
{ "type": "test", "event": "started", "name": "b" }
5-
{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" }
5+
{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" }
66
{ "type": "test", "event": "started", "name": "c" }
7-
{ "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at 'assertion failed: false', f.rs:15:5\n" }
7+
{ "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at f.rs:15:5:\nassertion failed: false\n" }
88
{ "type": "test", "event": "started", "name": "d" }
99
{ "type": "test", "name": "d", "event": "ignored", "message": "msg" }
1010
{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME }
Original file line numberDiff line numberDiff line change
@@ -1 +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]]>&#xA;<![CDATA[thread 'b' panicked at 'assertion failed: false', f.rs:10:5]]>&#xA;<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>&#xA;<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"/><system-out/><system-err/></testsuite></testsuites>
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]]>&#xA;<![CDATA[thread 'b' panicked at f.rs:10:5:]]>&#xA;<![CDATA[assertion failed: false]]>&#xA;<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>&#xA;<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"/><system-out/><system-err/></testsuite></testsuites>

0 commit comments

Comments
 (0)