also test panic from thread with name
This commit is contained in:
parent
c26fb591fa
commit
f2f4e6fc65
2 changed files with 11 additions and 0 deletions
|
|
@ -59,6 +59,15 @@ fn panic() {
|
|||
assert_eq!(*msg, "Hello!");
|
||||
}
|
||||
|
||||
fn panic_named() {
|
||||
thread::Builder::new().name("childthread".to_string()).spawn(move || {
|
||||
panic!("Hello, world!");
|
||||
})
|
||||
.unwrap()
|
||||
.join()
|
||||
.unwrap_err();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
create_and_detach();
|
||||
create_and_join();
|
||||
|
|
@ -69,4 +78,5 @@ fn main() {
|
|||
create_move_in();
|
||||
create_move_out();
|
||||
panic();
|
||||
panic_named();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
warning: thread support is experimental. For example, Miri does not detect data races yet.
|
||||
|
||||
thread '<unnamed>' panicked at 'Hello!', $DIR/simple.rs:54:9
|
||||
thread 'childthread' panicked at 'Hello, world!', $DIR/simple.rs:64:9
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue