mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
Try to write the panic message with a single write_all
call
This commit is contained in:
parent
eeeff9a66c
commit
4bf85c25ec
@ -266,7 +266,23 @@ fn default_hook(info: &PanicHookInfo<'_>) {
|
||||
// Use a lock to prevent mixed output in multithreading context.
|
||||
// Some platforms also require it when printing a backtrace, like `SymFromAddr` on Windows.
|
||||
let mut lock = backtrace::lock();
|
||||
let _ = writeln!(err, "thread '{name}' panicked at {location}:\n{msg}");
|
||||
// Try to write the panic message to a buffer first to prevent other concurrent outputs
|
||||
// interleaving with it.
|
||||
let mut buffer = [0u8; 512];
|
||||
let mut cursor = crate::io::Cursor::new(&mut buffer[..]);
|
||||
|
||||
let write_msg = |dst: &mut dyn crate::io::Write| {
|
||||
// We add a newline to ensure the panic message appears at the start of a line.
|
||||
writeln!(dst, "\nthread '{name}' panicked at {location}:\n{msg}")
|
||||
};
|
||||
|
||||
if write_msg(&mut cursor).is_ok() {
|
||||
let pos = cursor.position() as usize;
|
||||
let _ = err.write_all(&buffer[0..pos]);
|
||||
} else {
|
||||
// The message did not fit into the buffer, write it directly instead.
|
||||
let _ = write_msg(err);
|
||||
};
|
||||
|
||||
static FIRST_PANIC: AtomicBool = AtomicBool::new(true);
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind1.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,7 +1,9 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
|
@ -1,7 +1,9 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/function_calls/return_pointer_on_unwind.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
aborted execution: attempted to instantiate uninhabited type `!`
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
aborted execution: attempted to zero-initialize type `fn()`, which is invalid
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,7 +1,9 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/panic/abort_unwind.rs:LL:CC:
|
||||
PANIC!!!
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/panic/bad_unwind.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,10 +1,13 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/panic/double_panic.rs:LL:CC:
|
||||
first
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
|
||||
thread 'main' panicked at tests/fail/panic/double_panic.rs:LL:CC:
|
||||
second
|
||||
stack backtrace:
|
||||
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a destructor during cleanup
|
||||
thread caused non-unwinding panic. aborting.
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/panic/panic_abort1.rs:LL:CC:
|
||||
panicking from libstd
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/panic/panic_abort2.rs:LL:CC:
|
||||
42-panicking from libstd
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/panic/panic_abort3.rs:LL:CC:
|
||||
panicking from libcore
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/panic/panic_abort4.rs:LL:CC:
|
||||
42-panicking from libcore
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread $NAME panicked at tests/fail/panic/tls_macro_const_drop_panic.rs:LL:CC:
|
||||
ow
|
||||
fatal runtime error: thread local panicked on drop
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread $NAME panicked at tests/fail/panic/tls_macro_drop_panic.rs:LL:CC:
|
||||
ow
|
||||
fatal runtime error: thread local panicked on drop
|
||||
|
@ -1,9 +1,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.
|
||||
|
||||
|
||||
thread 'main' panicked at tests/fail/terminate-terminator.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
|
@ -1,7 +1,9 @@
|
||||
|
||||
thread 'main' panicked at tests/fail/unwind-action-terminate.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/alloc_error_handler_hook.rs:LL:CC:
|
||||
alloc error hook called
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at RUSTLIB/std/src/alloc.rs:LL:CC:
|
||||
memory allocation of 4 bytes failed
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/div-by-zero-2.rs:LL:CC:
|
||||
attempt to divide by zero
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,8 +1,11 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/function_calls/exported_symbol_good_unwind.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
|
||||
thread 'main' panicked at tests/panic/function_calls/exported_symbol_good_unwind.rs:LL:CC:
|
||||
explicit panic
|
||||
|
||||
thread 'main' panicked at tests/panic/function_calls/exported_symbol_good_unwind.rs:LL:CC:
|
||||
explicit panic
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'rustc' panicked at compiler/rustc_mir_transform/src/validate.rs:LL:CC:
|
||||
broken MIR in Item(DefId) (after phase change to runtime-optimized) at bb0[1]:
|
||||
place (*(_2.0: *mut i32)) has deref as a later projection (it is only permitted as the first projection)
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/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
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/overflowing-lsh-neg.rs:LL:CC:
|
||||
attempt to shift left with overflow
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/overflowing-rsh-1.rs:LL:CC:
|
||||
attempt to shift right with overflow
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/overflowing-rsh-2.rs:LL:CC:
|
||||
attempt to shift right with overflow
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/panic1.rs:LL:CC:
|
||||
panicking from libstd
|
||||
stack backtrace:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/panic2.rs:LL:CC:
|
||||
42-panicking from libstd
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/panic3.rs:LL:CC:
|
||||
panicking from libcore
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/panic4.rs:LL:CC:
|
||||
42-panicking from libcore
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at tests/panic/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
|
||||
|
@ -1,35 +1,46 @@
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC:
|
||||
Hello from std::panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
Caught panic message (&str): Hello from std::panic
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC:
|
||||
Hello from std::panic: 1
|
||||
Caught panic message (String): Hello from std::panic: 1
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC:
|
||||
Hello from std::panic_any: 2
|
||||
Caught panic message (String): Hello from std::panic_any: 2
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC:
|
||||
Box<dyn Any>
|
||||
Failed to get caught panic message.
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC:
|
||||
Hello from core::panic
|
||||
Caught panic message (&str): Hello from core::panic
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC:
|
||||
Hello from core::panic: 5
|
||||
Caught panic message (String): Hello from core::panic: 5
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/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 tests/pass/panic/catch_panic.rs:LL:CC:
|
||||
attempt to divide by zero
|
||||
Caught panic message (&str): attempt to divide by zero
|
||||
|
||||
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 tests/pass/panic/catch_panic.rs:LL:CC:
|
||||
assertion failed: false
|
||||
Caught panic message (&str): assertion failed: false
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC:
|
||||
assertion failed: false
|
||||
Caught panic message (&str): assertion failed: false
|
||||
|
@ -1,5 +1,6 @@
|
||||
Thread 1 starting, will block on mutex
|
||||
Thread 1 reported it has started
|
||||
|
||||
thread '<unnamed>' panicked at tests/pass/panic/concurrent-panic.rs:LL:CC:
|
||||
panic in thread 2
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
@ -7,6 +8,7 @@ note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE`
|
||||
Thread 2 blocking on thread 1
|
||||
Thread 2 reported it has started
|
||||
Unlocking mutex
|
||||
|
||||
thread '<unnamed>' panicked at tests/pass/panic/concurrent-panic.rs:LL:CC:
|
||||
panic in thread 1
|
||||
Thread 1 has exited
|
||||
|
@ -1,7 +1,9 @@
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/nested_panic_caught.rs:LL:CC:
|
||||
once
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
|
||||
thread 'main' panicked at tests/pass/panic/nested_panic_caught.rs:LL:CC:
|
||||
twice
|
||||
stack backtrace:
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
thread '<unnamed>' panicked at tests/pass/panic/thread_panic.rs:LL:CC:
|
||||
Hello!
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
|
||||
|
||||
thread 'childthread' panicked at tests/pass/panic/thread_panic.rs:LL:CC:
|
||||
Hello, world!
|
||||
|
@ -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 f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" }
|
||||
{ "type": "test", "name": "b", "event": "failed", "stdout": "\nthread '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" }
|
||||
|
@ -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 f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" }
|
||||
{ "type": "test", "name": "b", "event": "failed", "stdout": "\nthread '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 f.rs:15:5:\nassertion failed: false\n" }
|
||||
{ "type": "test", "name": "c", "event": "ok", "stdout": "\nthread '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": "$EXEC_TIME" }
|
||||
|
@ -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 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>
|
||||
<?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>
|
||||
|
@ -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"><system-out><![CDATA[print from successful test]]>
<![CDATA[]]></system-out></testcase><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><![CDATA[thread 'c' panicked at f.rs:16:5:]]>
<![CDATA[assertion failed: false]]>
<![CDATA[]]></system-out></testcase><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"><system-out><![CDATA[print from successful test]]>
<![CDATA[]]></system-out></testcase><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><![CDATA[]]>
<![CDATA[thread 'c' panicked at f.rs:16:5:]]>
<![CDATA[assertion failed: false]]>
<![CDATA[]]></system-out></testcase><system-out/><system-err/></testsuite></testsuites>
|
||||
|
@ -26,6 +26,7 @@ stdout 2
|
||||
stderr:
|
||||
stderr 1
|
||||
stderr 2
|
||||
|
||||
thread 'main' panicked at $DIR/failed-doctest-output-windows.rs:7:1:
|
||||
oh no
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -26,6 +26,7 @@ stdout 2
|
||||
stderr:
|
||||
stderr 1
|
||||
stderr 2
|
||||
|
||||
thread 'main' panicked at $DIR/failed-doctest-output.rs:7:1:
|
||||
oh no
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -5,6 +5,7 @@ LL | fn wrong()
|
||||
| ^ expected one of `->`, `where`, or `{`
|
||||
|
||||
|
||||
|
||||
aborting due to `-Z treat-err-as-bug=1`
|
||||
stack backtrace:
|
||||
|
||||
|
@ -8,6 +8,7 @@ failures:
|
||||
Test executable failed (exit status: 101).
|
||||
|
||||
stderr:
|
||||
|
||||
thread 'main' panicked at remapped_path/remap-path-prefix-failed-doctest-output.rs:3:1:
|
||||
oh no
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,5 +1,7 @@
|
||||
|
||||
thread '<unnamed>' panicked at $DIR/synchronized-panic-handler.rs:11:5:
|
||||
oops oh no woe is me
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
||||
thread '<unnamed>' panicked at $DIR/synchronized-panic-handler.rs:11:5:
|
||||
oops oh no woe is me
|
||||
|
@ -1,6 +1,7 @@
|
||||
error: internal compiler error: compiler/rustc_const_eval/src/interpret/operator.rs:LL:CC: unsized type for `NullaryOp::SizeOf`
|
||||
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
||||
|
||||
|
||||
Box<dyn Any>
|
||||
query stack during panic:
|
||||
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:26:1: 28:32>::{constant#0}`
|
||||
|
@ -4,6 +4,7 @@ error: internal compiler error[E0080]: evaluation of constant value failed
|
||||
LL | const X: i32 = 1 / 0;
|
||||
| ^^^^^ attempt to divide `1_i32` by zero
|
||||
|
||||
|
||||
note: please make sure that you have updated to the latest nightly
|
||||
|
||||
query stack during panic:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
|
||||
attempted to compute the size or alignment of extern type `Opaque`
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
|
||||
attempted to compute the size or alignment of extern type `A`
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
|
||||
attempted to compute the size or alignment of extern type `A`
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/panic-location.rs:LL:CC:
|
||||
capacity overflow
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/const-eval-select-backtrace-std.rs:6:8:
|
||||
byte index 1 is out of bounds of ``
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/const-eval-select-backtrace.rs:15:5:
|
||||
Aaah!
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -4,6 +4,7 @@ error: must be overridden by codegen backend, but isn't
|
||||
LL | unsafe { const_deallocate(std::ptr::null_mut(), 0, 0) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
query stack during panic:
|
||||
end of query stack
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -1,5 +1,7 @@
|
||||
|
||||
thread 'main' panicked at $DIR/issue-87707.rs:14:24:
|
||||
Here Once instance is poisoned.
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
||||
thread 'main' panicked at $DIR/issue-87707.rs:16:7:
|
||||
Once instance has previously been poisoned
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
257 > 255
|
||||
error: the compiler unexpectedly panicked. this is a bug.
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/assert-long-condition.rs:7:5:
|
||||
assertion failed: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18
|
||||
+ 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0
|
||||
|
@ -11,6 +11,7 @@ note: delayed at compiler/rustc_mir_transform/src/lint.rs:LL:CC - disabled backt
|
||||
LL | StorageLive(a);
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
aborting due to `-Z treat-err-as-bug=1`
|
||||
error: the compiler unexpectedly panicked. this is a bug.
|
||||
|
||||
|
@ -5,6 +5,7 @@ LL | fn main() { missing_ident; }
|
||||
| ^^^^^^^^^^^^^ not found in this scope
|
||||
|
||||
|
||||
|
||||
aborting due to `-Z treat-err-as-bug=1`
|
||||
stack backtrace:
|
||||
(end_short_backtrace)
|
||||
|
@ -1,4 +1,5 @@
|
||||
fmt
|
||||
|
||||
thread 'main' panicked at $DIR/fmt-only-once.rs:20:5:
|
||||
PrintOnFmt
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:26:5:
|
||||
explicit panic
|
||||
stack backtrace:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/location-detail-panic-no-column.rs:7:0:
|
||||
column-redacted
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at <redacted>:7:5:
|
||||
file-redacted
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/location-detail-panic-no-line.rs:0:5:
|
||||
line-redacted
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at <redacted>:0:0:
|
||||
no location info
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at <redacted>:8:9:
|
||||
called `Option::unwrap()` on a `None` value
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,9 +1,12 @@
|
||||
|
||||
thread 'main' panicked at $DIR/panic-in-cleanup.rs:22:5:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
||||
thread 'main' panicked at $DIR/panic-in-cleanup.rs:16:9:
|
||||
BOOM
|
||||
stack backtrace:
|
||||
|
||||
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
|
||||
panic in a destructor during cleanup
|
||||
thread caused non-unwinding panic. aborting.
|
||||
|
@ -1,7 +1,9 @@
|
||||
|
||||
thread 'main' panicked at $DIR/panic-in-ffi.rs:21:5:
|
||||
Test
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
Noisy Drop
|
||||
|
||||
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/runtime-switch.rs:29:5:
|
||||
explicit panic
|
||||
stack backtrace:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:63:5:
|
||||
debug!!!
|
||||
stack backtrace:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:59:5:
|
||||
debug!!!
|
||||
stack backtrace:
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
at $DIR/auxiliary/test-macros.rs:38:5:
|
||||
panic-derive
|
||||
error: proc-macro derive panicked
|
||||
|
@ -6,12 +6,17 @@
|
||||
fn check_for_no_backtrace(test: std::process::Output) {
|
||||
assert!(!test.status.success());
|
||||
let err = String::from_utf8_lossy(&test.stderr);
|
||||
let mut it = err.lines();
|
||||
let mut it = err.lines().filter(|l| !l.is_empty());
|
||||
|
||||
assert_eq!(it.next().map(|l| l.starts_with("thread '<unnamed>' panicked")), Some(true));
|
||||
assert_eq!(it.next().is_some(), true);
|
||||
assert_eq!(it.next(), Some("note: run with `RUST_BACKTRACE=1` \
|
||||
environment variable to display a backtrace"));
|
||||
assert_eq!(
|
||||
it.next(),
|
||||
Some(
|
||||
"note: run with `RUST_BACKTRACE=1` \
|
||||
environment variable to display a backtrace"
|
||||
)
|
||||
);
|
||||
assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true));
|
||||
assert_eq!(it.next().is_some(), true);
|
||||
assert_eq!(it.next(), None);
|
||||
@ -22,19 +27,22 @@ fn main() {
|
||||
if args.len() > 1 && args[1] == "run_test" {
|
||||
let _ = std::thread::spawn(|| {
|
||||
panic!();
|
||||
}).join();
|
||||
})
|
||||
.join();
|
||||
|
||||
panic!();
|
||||
} else {
|
||||
let test = std::process::Command::new(&args[0]).arg("run_test")
|
||||
.env_remove("RUST_BACKTRACE")
|
||||
.output()
|
||||
.unwrap();
|
||||
let test = std::process::Command::new(&args[0])
|
||||
.arg("run_test")
|
||||
.env_remove("RUST_BACKTRACE")
|
||||
.output()
|
||||
.unwrap();
|
||||
check_for_no_backtrace(test);
|
||||
let test = std::process::Command::new(&args[0]).arg("run_test")
|
||||
.env("RUST_BACKTRACE","0")
|
||||
.output()
|
||||
.unwrap();
|
||||
let test = std::process::Command::new(&args[0])
|
||||
.arg("run_test")
|
||||
.env("RUST_BACKTRACE", "0")
|
||||
.output()
|
||||
.unwrap();
|
||||
check_for_no_backtrace(test);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'main' panicked at library/std/src/io/stdio.rs:LL:CC:
|
||||
failed printing to stdout: Broken pipe (os error 32)
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -16,7 +16,8 @@ LL | #[repr(C)]
|
||||
LL | struct Dealigned<T>(u8, T);
|
||||
| ^
|
||||
|
|
||||
= Box<dyn Any>
|
||||
=
|
||||
Box<dyn Any>
|
||||
query stack during panic:
|
||||
#0 [mir_built] building MIR for `<impl at $DIR/multiple_definitions_attribute_merging.rs:15:10: 15:19>::eq`
|
||||
#1 [check_unsafety] unsafety-checking `<impl at $DIR/multiple_definitions_attribute_merging.rs:15:10: 15:19>::eq`
|
||||
|
@ -7,7 +7,8 @@ LL | #[derive(PartialEq)]
|
||||
LL | struct Dealigned<T>(u8, T);
|
||||
| ^
|
||||
|
|
||||
= Box<dyn Any>
|
||||
=
|
||||
Box<dyn Any>
|
||||
query stack during panic:
|
||||
#0 [mir_built] building MIR for `<impl at $DIR/proc_macro_generated_packed.rs:15:10: 15:19>::eq`
|
||||
#1 [check_unsafety] unsafety-checking `<impl at $DIR/proc_macro_generated_packed.rs:15:10: 15:19>::eq`
|
||||
|
@ -9,15 +9,18 @@ foo2 --- FAILED
|
||||
failures:
|
||||
|
||||
---- abc stdout ----
|
||||
|
||||
thread 'abc' panicked at $DIR/terse.rs:12:5:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
||||
---- foo stdout ----
|
||||
|
||||
thread 'foo' panicked at $DIR/terse.rs:17:5:
|
||||
explicit panic
|
||||
|
||||
---- foo2 stdout ----
|
||||
|
||||
thread 'foo2' panicked at $DIR/terse.rs:22:5:
|
||||
explicit panic
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
|
||||
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:34:5:
|
||||
assertion `left == right` failed
|
||||
left: 2
|
||||
right: 4
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
||||
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:28:5:
|
||||
assertion `left == right` failed
|
||||
left: 2
|
||||
|
@ -17,6 +17,7 @@ hello, world
|
||||
testing123
|
||||
---- it_fails stderr ----
|
||||
testing321
|
||||
|
||||
thread 'main' panicked at $DIR/test-panic-abort.rs:39:5:
|
||||
assertion `left == right` failed
|
||||
left: 2
|
||||
|
@ -10,6 +10,7 @@ fee
|
||||
fie
|
||||
foe
|
||||
fum
|
||||
|
||||
thread 'thready_fail' panicked at $DIR/test-thread-capture.rs:32:5:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
thread 'thready_fail' panicked at $DIR/test-thread-nocapture.rs:32:5:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -24,6 +24,7 @@ LL | break rust
|
||||
= note: rustc $VERSION running on $TARGET
|
||||
= note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics
|
||||
|
||||
|
||||
thread 'rustc' panicked at compiler/rustc_hir_typeck/src/lib.rs:LL:CC:
|
||||
Box<dyn Any>
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -4,6 +4,7 @@ error: internal compiler error[E0080]: could not evaluate static initializer
|
||||
LL | pub static C: u32 = 0 - 1;
|
||||
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
|
||||
|
||||
|
||||
error: the compiler unexpectedly panicked. this is a bug.
|
||||
|
||||
query stack during panic:
|
||||
|
@ -4,6 +4,7 @@ error: internal compiler error: delayed bug triggered by #[rustc_error(delayed_b
|
||||
LL | fn main() {}
|
||||
| ^^^^^^^^^
|
||||
|
||||
|
||||
error: the compiler unexpectedly panicked. this is a bug.
|
||||
|
||||
query stack during panic:
|
||||
|
Loading…
Reference in New Issue
Block a user