Skip to content

Commit

Permalink
Auto merge of rust-lang#112849 - m-ou-se:panic-message-format, r=thomcc
Browse files Browse the repository at this point in the history
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
bors committed Aug 1, 2023
2 parents c435af0 + 2c5ecf2 commit 828bdc2
Show file tree
Hide file tree
Showing 108 changed files with 241 additions and 134 deletions.
6 changes: 4 additions & 2 deletions library/core/src/error.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ information that is already communicated by the source error being
unwrapped:

```text
thread 'main' panicked at 'env variable `IMPORTANT_PATH` is not set: NotPresent', src/main.rs:4:6
thread 'main' panicked at src/main.rs:4:6:
env variable `IMPORTANT_PATH` is not set: NotPresent
```

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

```text
thread 'main' panicked at 'env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`: NotPresent', src/main.rs:4:6
thread 'main' panicked at src/main.rs:4:6:
env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`: NotPresent
```

In this example we are communicating not only the name of the
Expand Down
10 changes: 6 additions & 4 deletions library/core/src/panic/panic_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,18 @@ impl<'a> PanicInfo<'a> {
impl fmt::Display for PanicInfo<'_> {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str("panicked at ")?;
self.location.fmt(formatter)?;
if let Some(message) = self.message {
write!(formatter, "'{}', ", message)?
formatter.write_str(":\n")?;
formatter.write_fmt(*message)?;
} else if let Some(payload) = self.payload.downcast_ref::<&'static str>() {
write!(formatter, "'{}', ", payload)?
formatter.write_str(":\n")?;
formatter.write_str(payload)?;
}
// NOTE: we cannot use downcast_ref::<String>() here
// since String is not available in core!
// The payload is a String when `std::panic!` is called with multiple arguments,
// but in that case the message is also available.

self.location.fmt(formatter)
Ok(())
}
}
3 changes: 2 additions & 1 deletion library/std/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ mod private {
/// This example produces the following output:
///
/// ```console
/// thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SuperError is here!: SuperErrorSideKick is here!', src/error.rs:34:40
/// thread 'main' panicked at src/error.rs:34:40:
/// called `Result::unwrap()` on an `Err` value: SuperError is here!: SuperErrorSideKick is here!
/// note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
/// ```
///
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::path
let name = thread.as_ref().and_then(|t| t.name()).unwrap_or("<unnamed>");

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

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread '<unnamed>' panicked at 'explicit panic', $DIR/unwind_top_of_stack.rs:LL:CC
thread '<unnamed>' panicked at $DIR/unwind_top_of_stack.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Undefined Behavior: unwinding past the topmost frame of the stack
--> $DIR/unwind_top_of_stack.rs:LL:CC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_bad_unwind1.rs:LL:CC
thread 'main' panicked at $DIR/exported_symbol_bad_unwind1.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Undefined Behavior: unwinding past a stack frame that does not allow unwinding
--> $DIR/exported_symbol_bad_unwind1.rs:LL:CC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_bad_unwind2.rs:LL:CC
thread 'main' panicked at $DIR/exported_symbol_bad_unwind2.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: abnormal termination: panic in a function that cannot unwind
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_bad_unwind2.rs:LL:CC
thread 'main' panicked at $DIR/exported_symbol_bad_unwind2.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: abnormal termination: panic in a function that cannot unwind
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_bad_unwind2.rs:LL:CC
thread 'main' panicked at $DIR/exported_symbol_bad_unwind2.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Undefined Behavior: unwinding past a stack frame that does not allow unwinding
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/fail/panic/bad_unwind.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at 'explicit panic', $DIR/bad_unwind.rs:LL:CC
thread 'main' panicked at $DIR/bad_unwind.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Undefined Behavior: unwinding past a stack frame that does not allow unwinding
--> $DIR/bad_unwind.rs:LL:CC
Expand Down
6 changes: 4 additions & 2 deletions src/tools/miri/tests/fail/panic/double_panic.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
thread 'main' panicked at 'first', $DIR/double_panic.rs:LL:CC
thread 'main' panicked at $DIR/double_panic.rs:LL:CC:
first
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'second', $DIR/double_panic.rs:LL:CC
thread 'main' panicked at $DIR/double_panic.rs:LL:CC:
second
stack backtrace:
error: abnormal termination: panic in a function that cannot unwind
--> $DIR/double_panic.rs:LL:CC
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/fail/panic/no_std.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
panicked at 'blarg I am dead', $DIR/no_std.rs:LL:CC
panicked at $DIR/no_std.rs:LL:CC:
blarg I am dead
error: abnormal termination: the program aborted execution
--> $DIR/no_std.rs:LL:CC
|
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/fail/panic/panic_abort1.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at 'panicking from libstd', $DIR/panic_abort1.rs:LL:CC
thread 'main' panicked at $DIR/panic_abort1.rs:LL:CC:
panicking from libstd
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: abnormal termination: the program aborted execution
--> RUSTLIB/panic_abort/src/lib.rs:LL:CC
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/fail/panic/panic_abort2.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at '42-panicking from libstd', $DIR/panic_abort2.rs:LL:CC
thread 'main' panicked at $DIR/panic_abort2.rs:LL:CC:
42-panicking from libstd
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: abnormal termination: the program aborted execution
--> RUSTLIB/panic_abort/src/lib.rs:LL:CC
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/fail/panic/panic_abort3.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at 'panicking from libcore', $DIR/panic_abort3.rs:LL:CC
thread 'main' panicked at $DIR/panic_abort3.rs:LL:CC:
panicking from libcore
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: abnormal termination: the program aborted execution
--> RUSTLIB/panic_abort/src/lib.rs:LL:CC
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/fail/panic/panic_abort4.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at '42-panicking from libcore', $DIR/panic_abort4.rs:LL:CC
thread 'main' panicked at $DIR/panic_abort4.rs:LL:CC:
42-panicking from libcore
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: abnormal termination: the program aborted execution
--> RUSTLIB/panic_abort/src/lib.rs:LL:CC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread $NAME panicked at 'ow', $DIR/thread_local_const_drop_panic.rs:LL:CC
thread $NAME panicked at $DIR/thread_local_const_drop_panic.rs:LL:CC:
ow
fatal runtime error: thread local panicked on drop
error: abnormal termination: the program aborted execution

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

Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/fail/terminate-terminator.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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.

thread 'main' panicked at 'explicit panic', $DIR/terminate-terminator.rs:LL:CC
thread 'main' panicked at $DIR/terminate-terminator.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: abnormal termination: panic in a function that cannot unwind
--> $DIR/terminate-terminator.rs:LL:CC
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/fail/unwind-action-terminate.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at 'explicit panic', $DIR/unwind-action-terminate.rs:LL:CC
thread 'main' panicked at $DIR/unwind-action-terminate.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: abnormal termination: panic in a function that cannot unwind
--> $DIR/unwind-action-terminate.rs:LL:CC
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/div-by-zero-2.stderr
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
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
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/oob_subslice.stderr
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
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/overflowing-lsh-neg.stderr
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
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/overflowing-rsh-1.stderr
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
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/overflowing-rsh-2.stderr
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
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/panic1.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
thread 'main' panicked at 'panicking from libstd', $DIR/panic1.rs:LL:CC
thread 'main' panicked at $DIR/panic1.rs:LL:CC:
panicking from libstd
stack backtrace:
0: std::panicking::begin_panic_handler
at RUSTLIB/std/src/panicking.rs:LL:CC
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/panic2.stderr
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
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/panic3.stderr
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
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/panic4.stderr
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
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/transmute_fat2.stderr
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
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
3 changes: 2 additions & 1 deletion src/tools/miri/tests/panic/unsupported_syscall.stderr
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
6 changes: 4 additions & 2 deletions src/tools/miri/tests/pass/concurrency/simple.stderr
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!
33 changes: 22 additions & 11 deletions src/tools/miri/tests/pass/panic/catch_panic.stderr
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!
6 changes: 4 additions & 2 deletions src/tools/miri/tests/pass/panic/concurrent-panic.stderr
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
6 changes: 4 additions & 2 deletions src/tools/miri/tests/pass/panic/nested_panic_caught.stderr
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:
2 changes: 1 addition & 1 deletion tests/run-make/libtest-json/output-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{ "type": "test", "event": "started", "name": "a" }
{ "type": "test", "name": "a", "event": "ok" }
{ "type": "test", "event": "started", "name": "b" }
{ "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" }
{ "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" }
{ "type": "test", "event": "started", "name": "c" }
{ "type": "test", "name": "c", "event": "ok" }
{ "type": "test", "event": "started", "name": "d" }
Expand Down
4 changes: 2 additions & 2 deletions tests/run-make/libtest-json/output-stdout-success.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
{ "type": "test", "event": "started", "name": "a" }
{ "type": "test", "name": "a", "event": "ok", "stdout": "print from successful test\n" }
{ "type": "test", "event": "started", "name": "b" }
{ "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" }
{ "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" }
{ "type": "test", "event": "started", "name": "c" }
{ "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at 'assertion failed: false', f.rs:15:5\n" }
{ "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at f.rs:15:5:\nassertion failed: false\n" }
{ "type": "test", "event": "started", "name": "d" }
{ "type": "test", "name": "d", "event": "ignored", "message": "msg" }
{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME }
2 changes: 1 addition & 1 deletion tests/run-make/libtest-junit/output-default.xml
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]]>&#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>
<?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>
Loading

0 comments on commit 828bdc2

Please sign in to comment.