mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00

`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.
30 lines
1.3 KiB
Rust
30 lines
1.3 KiB
Rust
//@ compile-flags: -Z track-diagnostics
|
|
//@ dont-require-annotations: NOTE
|
|
//@ rustc-env:RUST_BACKTRACE=0
|
|
//@ failure-status: 101
|
|
|
|
// Normalize the emitted location so this doesn't need
|
|
// updating everytime someone adds or removes a line.
|
|
//@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:CC"
|
|
//@ normalize-stderr: "note: rustc .+ running on .+" -> "note: rustc $$VERSION running on $$TARGET"
|
|
|
|
// The test becomes too flaky if we care about exact args. If `-Z ui-testing`
|
|
// from compiletest and `-Z track-diagnostics` from `// compile-flags` at the
|
|
// top of this file are present, then assume all args are present.
|
|
//@ normalize-stderr: "note: compiler flags: .*-Z ui-testing.*-Z track-diagnostics" -> "note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics"
|
|
|
|
// 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: "thread 'rustc' panicked" -> "thread 'rustc' ($$TID) panicked"
|
|
|
|
fn main() {
|
|
break rust
|
|
//~^ ERROR cannot find value `rust` in this scope
|
|
//~| NOTE created at
|
|
//~| ERROR `break` outside of a loop or labeled block
|
|
//~| NOTE created at
|
|
//~| ERROR It looks like you're trying to break rust; would you like some ICE?
|
|
//~| NOTE created at
|
|
}
|