`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.
20 lines
376 B
Rust
20 lines
376 B
Rust
//@ run-fail
|
|
//@ regex-error-pattern: thread 'owned name' \(\d+\) panicked
|
|
//@ error-pattern: test
|
|
//@ needs-threads
|
|
|
|
use std::thread::Builder;
|
|
|
|
fn main() {
|
|
let r: () = Builder::new()
|
|
.name("owned name".to_string())
|
|
.spawn(move || {
|
|
panic!("test");
|
|
()
|
|
})
|
|
.unwrap()
|
|
.join()
|
|
.unwrap();
|
|
panic!();
|
|
}
|