Print thread ID in panic message if thread name is unknown

`panic!` does not print any identifying information for threads that are
unnamed. However, in many cases, the thread ID can be determined.

This changes the panic message from something like this:

    thread '<unnamed>' panicked at src/main.rs:3:5:
    explicit panic

To something like this:

    thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5:
    explicit panic

Stack overflow messages are updated as well.

This change applies to both named and unnamed threads. The ID printed is
the OS integer thread ID rather than the Rust thread ID, which should
also be what debuggers print.
This commit is contained in:
Trevor Gross 2023-09-11 00:59:31 -04:00
parent 0c8b3870bd
commit 289fe36d37
122 changed files with 311 additions and 168 deletions

View file

@ -269,6 +269,7 @@ fn default_hook(info: &PanicHookInfo<'_>) {
thread::with_current_name(|name| {
let name = name.unwrap_or("<unnamed>");
let tid = thread::current_os_id();
// Try to write the panic message to a buffer first to prevent other concurrent outputs
// interleaving with it.
@ -277,7 +278,7 @@ fn default_hook(info: &PanicHookInfo<'_>) {
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}")
writeln!(dst, "\nthread '{name}' ({tid}) panicked at {location}:\n{msg}")
};
if write_msg(&mut cursor).is_ok() {

View file

@ -115,6 +115,10 @@ impl Thread {
}
}
pub(crate) fn current_os_id() -> Option<u64> {
None
}
pub fn available_parallelism() -> io::Result<NonZero<usize>> {
unsafe { Ok(NonZero::new_unchecked(hermit_abi::available_parallelism())) }
}

View file

@ -361,6 +361,10 @@ unsafe fn terminate_and_delete_current_task() -> ! {
unsafe { crate::hint::unreachable_unchecked() };
}
pub(crate) fn current_os_id() -> Option<u64> {
None
}
pub fn available_parallelism() -> io::Result<NonZero<usize>> {
super::unsupported()
}

View file

@ -1,6 +1,6 @@
#![cfg_attr(test, allow(dead_code))] // why is this necessary?
use super::abi::usercalls;
use super::abi::{thread, usercalls};
use super::unsupported;
use crate::ffi::CStr;
use crate::io;
@ -149,6 +149,10 @@ impl Thread {
}
}
pub(crate) fn current_os_id() -> Option<u64> {
Some(thread::current().addr().get() as u64)
}
pub fn available_parallelism() -> io::Result<NonZero<usize>> {
unsupported()
}

View file

@ -144,6 +144,10 @@ impl Drop for Thread {
}
}
pub(crate) fn current_os_id() -> Option<u64> {
None
}
// Note: Both `sched_getaffinity` and `sysconf` are available but not functional on
// teeos, so this function always returns an Error!
pub fn available_parallelism() -> io::Result<NonZero<usize>> {

View file

@ -56,6 +56,10 @@ impl Thread {
}
}
pub(crate) fn current_os_id() -> Option<u64> {
None
}
pub fn available_parallelism() -> io::Result<NonZero<usize>> {
// UEFI is single threaded
Ok(NonZero::new(1).unwrap())

View file

@ -119,7 +119,8 @@ mod imp {
&& thread_info.guard_page_range.contains(&fault_addr)
{
let name = thread_info.thread_name.as_deref().unwrap_or("<unknown>");
rtprintpanic!("\nthread '{name}' has overflowed its stack\n");
let tid = crate::thread::current_os_id();
rtprintpanic!("\nthread '{name}' ({tid}) has overflowed its stack\n");
rtabort!("stack overflow");
}
})
@ -696,7 +697,8 @@ mod imp {
if code == c::EXCEPTION_STACK_OVERFLOW {
crate::thread::with_current_name(|name| {
let name = name.unwrap_or("<unknown>");
rtprintpanic!("\nthread '{name}' has overflowed its stack\n");
let tid = crate::thread::current_os_id();
rtprintpanic!("\nthread '{name}' ({tid}) has overflowed its stack\n");
});
}
c::EXCEPTION_CONTINUE_SEARCH

View file

@ -398,6 +398,62 @@ impl Drop for Thread {
}
}
pub(crate) fn current_os_id() -> Option<u64> {
// Most Unix platforms have a way to query an integer ID of the current thread, all with
// slightly different spellings.
//
// The OS thread ID is used rather than `pthread_self` so as to match what will be displayed
// for process inspection (debuggers, trace, `top`, etc.).
cfg_if::cfg_if! {
// Most platforms have a function returning a `pid_t` or int, which is an `i32`.
if #[cfg(any(target_os = "android", target_os = "linux"))] {
use crate::sys::weak::syscall;
// `libc::gettid` is only available on glibc 2.30+, but the syscall is available
// since Linux 2.4.11.
syscall!(fn gettid() -> libc::pid_t;);
// SAFETY: FFI call with no preconditions.
let id: libc::pid_t = unsafe { gettid() };
Some(id as u64)
} else if #[cfg(target_os = "nto")] {
// SAFETY: FFI call with no preconditions.
let id: libc::pid_t = unsafe { libc::gettid() };
Some(id as u64)
} else if #[cfg(target_os = "openbsd")] {
// SAFETY: FFI call with no preconditions.
let id: libc::pid_t = unsafe { libc::getthrid() };
Some(id as u64)
} else if #[cfg(target_os = "freebsd")] {
// SAFETY: FFI call with no preconditions.
let id: libc::c_int = unsafe { libc::pthread_getthreadid_np() };
Some(id as u64)
} else if #[cfg(target_os = "netbsd")] {
// SAFETY: FFI call with no preconditions.
let id: libc::lwpid_t = unsafe { libc::_lwp_self() };
Some(id as u64)
} else if #[cfg(any(target_os = "illumos", target_os = "solaris"))] {
// On Illumos and Solaris, the `pthread_t` is the same as the OS thread ID.
// SAFETY: FFI call with no preconditions.
let id: libc::pthread_t = unsafe { libc::pthread_self() };
Some(id as u64)
} else if #[cfg(target_vendor = "apple")] {
// Apple allows querying arbitrary thread IDs, `thread=NULL` queries the current thread.
let mut id = 0u64;
// SAFETY: `thread_id` is a valid pointer, no other preconditions.
let status: libc::c_int = unsafe { libc::pthread_threadid_np(0, &mut id) };
if status == 0 {
Some(id)
} else {
None
}
} else {
// Other platforms don't have an OS thread ID or don't have a way to access it.
None
}
}
}
#[cfg(any(
target_os = "linux",
target_os = "nto",

View file

@ -39,6 +39,10 @@ impl Thread {
}
}
pub(crate) fn current_os_id() -> Option<u64> {
None
}
pub fn available_parallelism() -> io::Result<NonZero<usize>> {
unsupported()
}

View file

@ -194,6 +194,10 @@ impl Thread {
}
}
pub(crate) fn current_os_id() -> Option<u64> {
None
}
pub fn available_parallelism() -> io::Result<NonZero<usize>> {
cfg_if::cfg_if! {
if #[cfg(target_feature = "atomics")] {

View file

@ -2185,6 +2185,7 @@ GetSystemInfo
GetSystemTimeAsFileTime
GetSystemTimePreciseAsFileTime
GetTempPathW
GetThreadId
GetUserProfileDirectoryW
GetWindowsDirectoryW
HANDLE

View file

@ -61,6 +61,7 @@ windows_targets::link!("kernel32.dll" "system" fn GetSystemInfo(lpsysteminfo : *
windows_targets::link!("kernel32.dll" "system" fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
windows_targets::link!("kernel32.dll" "system" fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
windows_targets::link!("kernel32.dll" "system" fn GetTempPathW(nbufferlength : u32, lpbuffer : PWSTR) -> u32);
windows_targets::link!("kernel32.dll" "system" fn GetThreadId(thread : HANDLE) -> u32);
windows_targets::link!("userenv.dll" "system" fn GetUserProfileDirectoryW(htoken : HANDLE, lpprofiledir : PWSTR, lpcchsize : *mut u32) -> BOOL);
windows_targets::link!("kernel32.dll" "system" fn GetWindowsDirectoryW(lpbuffer : PWSTR, usize : u32) -> u32);
windows_targets::link!("kernel32.dll" "system" fn InitOnceBeginInitialize(lpinitonce : *mut INIT_ONCE, dwflags : u32, fpending : *mut BOOL, lpcontext : *mut *mut core::ffi::c_void) -> BOOL);

View file

@ -20,7 +20,8 @@ unsafe extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POIN
if code == c::EXCEPTION_STACK_OVERFLOW {
thread::with_current_name(|name| {
let name = name.unwrap_or("<unknown>");
rtprintpanic!("\nthread '{name}' has overflowed its stack\n");
let tid = thread::current_os_id();
rtprintpanic!("\nthread '{name}' ({tid}) has overflowed its stack\n");
});
}
c::EXCEPTION_CONTINUE_SEARCH

View file

@ -127,6 +127,14 @@ impl Thread {
}
}
pub(crate) fn current_os_id() -> Option<u64> {
// SAFETY: FFI call with no preconditions.
let id: u32 = unsafe { c::GetThreadId(c::GetCurrentThread()) };
// A return value of 0 indicates failed lookup.
if id == 0 { None } else { Some(id.into()) }
}
pub fn available_parallelism() -> io::Result<NonZero<usize>> {
let res = unsafe {
let mut sysinfo: c::SYSTEM_INFO = crate::mem::zeroed();

View file

@ -145,6 +145,10 @@ impl Thread {
}
}
pub(crate) fn current_os_id() -> Option<u64> {
None
}
pub fn available_parallelism() -> io::Result<NonZero<usize>> {
// We're unicore right now.
Ok(unsafe { NonZero::new_unchecked(1) })

View file

@ -1,4 +1,4 @@
use super::{Thread, ThreadId};
use super::{Thread, ThreadId, imp};
use crate::mem::ManuallyDrop;
use crate::ptr;
use crate::sys::thread_local::local_pointer;
@ -148,6 +148,17 @@ pub(crate) fn current_id() -> ThreadId {
id::get_or_init()
}
/// Gets the OS thread ID of the thread that invokes it, if available. If not, return the Rust
/// thread ID.
///
/// We use a `u64` to all possible platform IDs without excess `cfg`; most use `int`, some use a
/// pointer, and Apple uses `uint64_t`. This is a "best effort" approach for diagnostics and is
/// allowed to fall back to a non-OS ID (such as the Rust thread ID) or a non-unique ID (such as a
/// PID) if the thread ID cannot be retrieved.
pub(crate) fn current_os_id() -> u64 {
imp::current_os_id().unwrap_or_else(|| current_id().as_u64().get())
}
/// Gets a reference to the handle of the thread that invokes it, if the handle
/// has been initialized.
pub(super) fn try_with_current<F, R>(f: F) -> R

View file

@ -183,7 +183,7 @@ mod current;
#[stable(feature = "rust1", since = "1.0.0")]
pub use current::current;
pub(crate) use current::{current_id, current_or_unnamed, drop_current};
pub(crate) use current::{current_id, current_or_unnamed, current_os_id, drop_current};
use current::{set_current, try_with_current};
mod spawnhook;

View file

@ -346,6 +346,13 @@ fn test_thread_id_not_equal() {
assert!(thread::current().id() != spawned_id);
}
#[test]
fn test_thread_os_id_not_equal() {
let spawned_id = thread::spawn(|| thread::current_os_id()).join().unwrap();
let current_id = thread::current_os_id();
assert!(current_id != spawned_id);
}
#[test]
fn test_scoped_threads_drop_result_before_join() {
let actually_finished = &AtomicBool::new(false);

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind1.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,10 +1,10 @@
thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
panic in a function that cannot unwind
stack backtrace:
thread caused non-unwinding panic. aborting.

View file

@ -1,10 +1,10 @@
thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
panic in a function that cannot unwind
stack backtrace:
thread caused non-unwinding panic. aborting.

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC:
thread 'main' ($TID) 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

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/fail/function_calls/return_pointer_on_unwind.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,10 +1,10 @@
thread 'main' panicked at tests/fail/panic/abort_unwind.rs:LL:CC:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
panic in a function that cannot unwind
stack backtrace:
thread caused non-unwinding panic. aborting.

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/fail/panic/bad_unwind.rs:LL:CC:
thread 'main' ($TID) panicked at tests/fail/panic/bad_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

View file

@ -1,14 +1,14 @@
thread 'main' panicked at tests/fail/panic/double_panic.rs:LL:CC:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at tests/fail/panic/double_panic.rs:LL:CC:
second
stack backtrace:
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
thread 'main' ($TID) panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
panic in a destructor during cleanup
thread caused non-unwinding panic. aborting.
error: abnormal termination: the program aborted execution

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/fail/panic/panic_abort1.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/fail/panic/panic_abort2.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/fail/panic/panic_abort3.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/fail/panic/panic_abort4.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread $NAME panicked at tests/fail/panic/tls_macro_const_drop_panic.rs:LL:CC:
thread $NAME ($TID) panicked at tests/fail/panic/tls_macro_const_drop_panic.rs:LL:CC:
ow
fatal runtime error: thread local panicked on drop, aborting
error: abnormal termination: the program aborted execution

View file

@ -1,5 +1,5 @@
thread $NAME panicked at tests/fail/panic/tls_macro_drop_panic.rs:LL:CC:
thread $NAME ($TID) panicked at tests/fail/panic/tls_macro_drop_panic.rs:LL:CC:
ow
fatal runtime error: thread local panicked on drop, aborting
error: abnormal termination: the program aborted execution

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/fail/ptr_swap_nonoverlapping.rs:LL:CC:
thread 'main' ($TID) panicked at tests/fail/ptr_swap_nonoverlapping.rs:LL:CC:
unsafe precondition(s) violated: ptr::swap_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap
This indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.

View file

@ -1,12 +1,12 @@
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:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
panic in a function that cannot unwind
stack backtrace:
thread caused non-unwinding panic. aborting.

View file

@ -1,10 +1,10 @@
thread 'main' panicked at tests/fail/unwind-action-terminate.rs:LL:CC:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
panic in a function that cannot unwind
stack backtrace:
thread caused non-unwinding panic. aborting.

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/alloc_error_handler_hook.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread 'main' panicked at RUSTLIB/std/src/alloc.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/div-by-zero-2.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,11 +1,11 @@
thread 'main' panicked at tests/panic/function_calls/exported_symbol_good_unwind.rs:LL:CC:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at tests/panic/function_calls/exported_symbol_good_unwind.rs:LL:CC:
explicit panic

View file

@ -8,6 +8,12 @@
// Somehow on rustc Windows CI, the "Miri caused an ICE" message is not shown
// and we don't even get a regular panic; rustc aborts with a different exit code instead.
//@ignore-host: windows
// FIXME: this tests a crash in rustc. For stage1, rustc is built with the downloaded standard
// library which doesn't yet print the thread ID. Normalization can be removed at the stage bump.
// For the grep: cfg(bootstrap)
//@normalize-stderr-test: "thread 'rustc' panicked" -> "thread 'rustc' ($$TID) panicked"
#![feature(custom_mir, core_intrinsics)]
use core::intrinsics::mir::*;

View file

@ -6,7 +6,7 @@ LL | *(tuple.0) = 1;
| ^^^^^^^^^^^^^^
thread 'rustc' panicked at compiler/rustc_mir_transform/src/validate.rs:LL:CC:
thread 'rustc' ($TID) panicked at compiler/rustc_mir_transform/src/validate.rs:LL:CC:
Box<dyn Any>
stack backtrace:

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/oob_subslice.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/overflowing-lsh-neg.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/overflowing-rsh-1.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/overflowing-rsh-2.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/panic1.rs:LL:CC:
thread 'main' ($TID) panicked at tests/panic/panic1.rs:LL:CC:
panicking from libstd
stack backtrace:
0: std::panicking::begin_panic_handler

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/panic2.rs:LL:CC:
thread 'main' ($TID) panicked at tests/panic/panic2.rs:LL:CC:
42-panicking from libstd
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

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/panic3.rs:LL:CC:
thread 'main' ($TID) panicked at tests/panic/panic3.rs:LL:CC:
panicking from libcore
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

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/panic4.rs:LL:CC:
thread 'main' ($TID) panicked at tests/panic/panic4.rs:LL:CC:
42-panicking from libcore
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

View file

@ -1,5 +1,5 @@
thread 'main' panicked at tests/panic/transmute_fat2.rs:LL:CC:
thread 'main' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect

View file

@ -1,47 +1,47 @@
thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at tests/pass/panic/catch_panic.rs:LL:CC:
assertion failed: false
Caught panic message (&str): assertion failed: false
Success!

View file

@ -1,7 +1,7 @@
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:
thread '<unnamed>' ($TID) 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
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
@ -9,7 +9,7 @@ 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:
thread '<unnamed>' ($TID) panicked at tests/pass/panic/concurrent-panic.rs:LL:CC:
panic in thread 1
Thread 1 has exited
Thread 2 has exited

View file

@ -1,9 +1,9 @@
thread 'main' panicked at tests/pass/panic/nested_panic_caught.rs:LL:CC:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at tests/pass/panic/nested_panic_caught.rs:LL:CC:
twice
stack backtrace:

View file

@ -1,8 +1,8 @@
thread '<unnamed>' panicked at tests/pass/panic/thread_panic.rs:LL:CC:
thread '<unnamed>' ($TID) 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:
thread 'childthread' ($TID) panicked at tests/pass/panic/thread_panic.rs:LL:CC:
Hello, world!

View file

@ -185,10 +185,11 @@ fn dont_emit_ICE() {
"tests/target/issue-6105.rs",
];
let panic_re = regex::Regex::new("thread.*panicked").unwrap();
for file in files {
let args = [file];
let (_stdout, stderr) = rustfmt(&args);
assert!(!stderr.contains("thread 'main' panicked"));
assert!(!panic_re.is_match(&stderr));
}
}

View file

@ -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": "\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", "name": "b", "event": "failed", "stdout": "\nthread 'b' ($TID) 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" }

View file

@ -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": "\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", "name": "b", "event": "failed", "stdout": "\nthread 'b' ($TID) 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": "\nthread 'c' panicked at f.rs:15:5:\nassertion failed: false\n" }
{ "type": "test", "name": "c", "event": "ok", "stdout": "\nthread 'c' ($TID) 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" }

View file

@ -38,5 +38,6 @@ fn run_tests(extra_args: &[&str], expected_file: &str) {
.expected_file(expected_file)
.actual_text("stdout", test_stdout)
.normalize(r#"(?<prefix>"exec_time": )[0-9.]+"#, r#"${prefix}"$$EXEC_TIME""#)
.normalize(r"thread '(?P<name>.*?)' \(\d+\) panicked", "thread '$name' ($$TID) panicked")
.run();
}

View file

@ -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;&#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>
<?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;&#xA;<![CDATA[thread 'b' ($TID) 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>

View file

@ -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]]>&#xA;<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>&#xA;&#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><![CDATA[]]>&#xA;<![CDATA[thread 'c' panicked at f.rs:16:5:]]>&#xA;<![CDATA[assertion failed: false]]>&#xA;<![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]]>&#xA;<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>&#xA;&#xA;<![CDATA[thread 'b' ($TID) 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><![CDATA[]]>&#xA;<![CDATA[thread 'c' ($TID) panicked at f.rs:16:5:]]>&#xA;<![CDATA[assertion failed: false]]>&#xA;<![CDATA[]]></system-out></testcase><system-out/><system-err/></testsuite></testsuites>

View file

@ -27,5 +27,6 @@ fn run_tests(extra_args: &[&str], expected_file: &str) {
.expected_file(expected_file)
.actual_text("stdout", test_stdout)
.normalize(r#"\btime="[0-9.]+""#, r#"time="$$TIME""#)
.normalize(r"thread '(?P<name>.*?)' \(\d+\) panicked", "thread '$name' ($$TID) panicked")
.run();
}

View file

@ -9,7 +9,7 @@ Test executable failed (exit status: 101).
stderr:
thread 'main' panicked at $TMP:6:1:
thread 'main' ($TID) panicked at $TMP:6:1:
assertion `left == right` failed
left: 4
right: 5

View file

@ -27,7 +27,7 @@ stderr:
stderr 1
stderr 2
thread 'main' panicked at $DIR/failed-doctest-output-windows.rs:7:1:
thread 'main' ($TID) panicked at $DIR/failed-doctest-output-windows.rs:7:1:
oh no
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View file

@ -27,7 +27,7 @@ stderr:
stderr 1
stderr 2
thread 'main' panicked at $DIR/failed-doctest-output.rs:7:1:
thread 'main' ($TID) panicked at $DIR/failed-doctest-output.rs:7:1:
oh no
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View file

@ -14,7 +14,7 @@ stdout:
stderr:
thread 'main' panicked at $TMP:7:1:
thread 'main' ($TID) panicked at $TMP:7:1:
assertion `left == right` failed
left: "doc"
right: "test"
@ -26,7 +26,7 @@ Test executable failed (exit status: 101).
stderr:
thread 'main' panicked at $TMP:15:1:
thread 'main' ($TID) panicked at $TMP:15:1:
assertion `left == right` failed
left: "doc"
right: "test"

View file

@ -9,7 +9,7 @@ Test executable failed (exit status: 101).
stderr:
thread 'main' panicked at remapped_path/remap-path-prefix-failed-doctest-output.rs:3:1:
thread 'main' ($TID) 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

View file

@ -2,7 +2,7 @@
// be talking about `async fn`s instead.
//@ run-fail
//@ error-pattern: thread 'main' panicked
//@ regex-error-pattern: thread 'main'.*panicked
//@ error-pattern: `async fn` resumed after completion
//@ edition:2018

View file

@ -3,7 +3,7 @@
//@ run-fail
//@ needs-unwind
//@ error-pattern: thread 'main' panicked
//@ regex-error-pattern: thread 'main'.*panicked
//@ error-pattern: `async fn` resumed after panicking
//@ edition:2018

View file

@ -1,7 +1,7 @@
thread '<unnamed>' panicked at $DIR/synchronized-panic-handler.rs:11:5:
thread '<unnamed>' ($TID) 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:
thread '<unnamed>' ($TID) panicked at $DIR/synchronized-panic-handler.rs:11:5:
oops oh no woe is me

View file

@ -2,7 +2,7 @@
//@ known-bug: #97477
//@ failure-status: 101
//@ normalize-stderr: "note: .*\n\n" -> ""
//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> ""
//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> ""
//@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
//@ rustc-env:RUST_BACKTRACE=0

View file

@ -1,5 +1,5 @@
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
thread 'main' ($TID) 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
thread caused non-unwinding panic. aborting.

View file

@ -1,5 +1,5 @@
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
thread 'main' ($TID) 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
thread caused non-unwinding panic. aborting.

View file

@ -1,5 +1,5 @@
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
thread 'main' ($TID) 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
thread caused non-unwinding panic. aborting.

View file

@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/panic-location.rs:LL:CC:
thread 'main' ($TID) panicked at $DIR/panic-location.rs:LL:CC:
capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View file

@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/const-eval-select-backtrace-std.rs:6:8:
thread 'main' ($TID) 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

View file

@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/const-eval-select-backtrace.rs:15:5:
thread 'main' ($TID) panicked at $DIR/const-eval-select-backtrace.rs:15:5:
Aaah!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View file

@ -4,7 +4,7 @@
//@ build-fail
//@ failure-status:101
//@ normalize-stderr: ".*note: .*\n\n" -> ""
//@ normalize-stderr: "thread 'rustc' panicked.*:\n.*\n" -> ""
//@ normalize-stderr: "thread 'rustc'.*panicked.*:\n.*\n" -> ""
//@ normalize-stderr: "internal compiler error:.*: intrinsic const_deallocate " -> ""
//@ rustc-env:RUST_BACKTRACE=0

View file

@ -1,7 +1,7 @@
thread 'main' panicked at $DIR/issue-87707.rs:14:24:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at $DIR/issue-87707.rs:16:7:
Once instance has previously been poisoned

View file

@ -1,6 +1,6 @@
//@ failure-status: 101
//@ normalize-stderr: "note: .*\n\n" -> ""
//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> ""
//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> ""
//@ rustc-env:RUST_BACKTRACE=0
#![feature(rustc_attrs)]

View file

@ -1,5 +1,5 @@
thread 'main' panicked at $DIR/assert-long-condition.rs:7:5:
thread 'main' ($TID) 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
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View file

@ -1,7 +1,7 @@
//@ compile-flags: -Zlint-mir -Ztreat-err-as-bug
//@ failure-status: 101
//@ normalize-stderr: "note: .*\n\n" -> ""
//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> ""
//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> ""
//@ normalize-stderr: "storage_live\[....\]" -> "storage_live[HASH]"
//@ normalize-stderr: "(delayed at [^:]+):\d+:\d+ - " -> "$1:LL:CC - "
//@ rustc-env:RUST_BACKTRACE=0

View file

@ -1,6 +1,6 @@
//@ run-fail
//@ error-pattern:thread 'main' panicked
//@ error-pattern:explicit panic
//@ regex-error-pattern: thread 'main'.*panicked
//@ error-pattern: explicit panic
//@ needs-subprocess
fn main() {

View file

@ -1,6 +1,6 @@
//@ run-fail
//@ error-pattern:thread 'main' panicked
//@ error-pattern:attempt to add with overflow
//@ regex-error-pattern: thread 'main'.*panicked
//@ error-pattern: attempt to add with overflow
//@ compile-flags: -C debug-assertions
//@ needs-subprocess

View file

@ -1,6 +1,6 @@
//@ run-fail
//@ error-pattern:thread 'main' panicked
//@ error-pattern:attempt to multiply with overflow
//@ regex-error-pattern: thread 'main'.*panicked
//@ error-pattern: attempt to multiply with overflow
//@ needs-subprocess
//@ compile-flags: -C debug-assertions

View file

@ -1,6 +1,6 @@
//@ run-fail
//@ error-pattern:thread 'main' panicked
//@ error-pattern:attempt to multiply with overflow
//@ regex-error-pattern: thread 'main'.*panicked
//@ error-pattern: attempt to multiply with overflow
//@ needs-subprocess
//@ compile-flags: -C debug-assertions

View file

@ -1,6 +1,6 @@
//@ run-fail
//@ error-pattern:thread 'main' panicked
//@ error-pattern:attempt to multiply with overflow
//@ regex-error-pattern: thread 'main'.*panicked
//@ error-pattern: attempt to multiply with overflow
//@ needs-subprocess
//@ compile-flags: -C debug-assertions

View file

@ -1,6 +1,6 @@
//@ run-fail
//@ error-pattern:thread 'main' panicked
//@ error-pattern:attempt to subtract with overflow
//@ regex-error-pattern: thread 'main'.*panicked
//@ error-pattern: attempt to subtract with overflow
//@ needs-subprocess
//@ compile-flags: -C debug-assertions

View file

@ -1,5 +1,5 @@
fmt
thread 'main' panicked at $DIR/fmt-only-once.rs:20:5:
thread 'main' ($TID) panicked at $DIR/fmt-only-once.rs:20:5:
PrintOnFmt
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View file

@ -1,5 +1,5 @@
thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:24:5:
thread 'main' ($TID) panicked at $DIR/issue-47429-short-backtraces.rs:24:5:
explicit panic
stack backtrace:
0: std::panicking::begin_panic

View file

@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/location-detail-panic-no-column.rs:7:0:
thread 'main' ($TID) 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

View file

@ -1,4 +1,4 @@
thread 'main' panicked at <redacted>:7:5:
thread 'main' ($TID) panicked at <redacted>:7:5:
file-redacted
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View file

@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/location-detail-panic-no-line.rs:0:5:
thread 'main' ($TID) 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

View file

@ -1,4 +1,4 @@
thread 'main' panicked at <redacted>:0:0:
thread 'main' ($TID) panicked at <redacted>:0:0:
no location info
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View file

@ -1,4 +1,4 @@
thread 'main' panicked at <redacted>:8:9:
thread 'main' ($TID) panicked at <redacted>:8:9:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

View file

@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:thread 'main' panicked at
//@ regex-error-pattern: thread 'main' \(\d+\) panicked at
//@ needs-subprocess
fn main() {

View file

@ -1,12 +1,12 @@
thread 'main' panicked at $DIR/panic-in-cleanup.rs:22:5:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at $DIR/panic-in-cleanup.rs:16:9:
BOOM
stack backtrace:
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
thread 'main' ($TID) panicked at library/core/src/panicking.rs:$LINE:$COL:
panic in a destructor during cleanup
thread caused non-unwinding panic. aborting.

View file

@ -1,10 +1,10 @@
thread 'main' panicked at $DIR/panic-in-ffi.rs:21:5:
thread 'main' ($TID) 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:
thread 'main' ($TID) panicked at library/core/src/panicking.rs:$LINE:$COL:
panic in a function that cannot unwind
stack backtrace:
thread caused non-unwinding panic. aborting.

View file

@ -1,6 +1,6 @@
//@ run-fail
//@ error-pattern:thread 'main' panicked
//@ error-pattern:foobar
//@ regex-error-pattern: thread 'main' \(\d+\) panicked
//@ error-pattern: foobar
//@ needs-subprocess
use std::panic;

View file

@ -1,4 +1,4 @@
thread 'main' panicked at 'd was called', $DIR/panic-short-backtrace-windows-x86_64.rs:48:5
thread 'main' ($TID) panicked at 'd was called', $DIR/panic-short-backtrace-windows-x86_64.rs:48:5
stack backtrace:
0: std::panicking::begin_panic
1: d

View file

@ -1,6 +1,6 @@
//@ run-fail
//@ error-pattern:thread 'main' panicked
//@ error-pattern:foobar
//@ regex-error-pattern: thread 'main' \(\d+\) panicked
//@ error-pattern: foobar
//@ needs-subprocess
use std::panic;

Some files were not shown because too many files have changed in this diff Show more