File tree Expand file tree Collapse file tree 5 files changed +51
-24
lines changed
src/tools/miri/tests/pass Expand file tree Collapse file tree 5 files changed +51
-24
lines changed Original file line number Diff line number Diff line change @@ -45,23 +45,6 @@ fn create_move_out() {
4545 assert_eq ! ( result. len( ) , 6 ) ;
4646}
4747
48- fn panic ( ) {
49- let result = thread:: spawn ( || panic ! ( "Hello!" ) ) . join ( ) . unwrap_err ( ) ;
50- let msg = result. downcast_ref :: < & ' static str > ( ) . unwrap ( ) ;
51- assert_eq ! ( * msg, "Hello!" ) ;
52- }
53-
54- fn panic_named ( ) {
55- thread:: Builder :: new ( )
56- . name ( "childthread" . to_string ( ) )
57- . spawn ( move || {
58- panic ! ( "Hello, world!" ) ;
59- } )
60- . unwrap ( )
61- . join ( )
62- . unwrap_err ( ) ;
63- }
64-
6548// This is not a data race!
6649fn shared_readonly ( ) {
6750 use std:: sync:: Arc ;
@@ -89,6 +72,4 @@ fn main() {
8972 create_move_in ( ) ;
9073 create_move_out ( ) ;
9174 shared_readonly ( ) ;
92- panic ( ) ;
93- panic_named ( ) ;
9475}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ use std:: thread;
2+
3+ fn main ( ) {
4+ // When we have not set the name...
5+ thread:: spawn ( || {
6+ assert ! ( thread:: current( ) . name( ) . is_none( ) ) ;
7+ } ) ;
8+
9+ // ... and when we have set it.
10+ thread:: Builder :: new ( )
11+ . name ( "childthread" . to_string ( ) )
12+ . spawn ( move || {
13+ assert_eq ! ( thread:: current( ) . name( ) . unwrap( ) , "childthread" ) ;
14+ } )
15+ . unwrap ( )
16+ . join ( )
17+ . unwrap ( ) ;
18+
19+ // Also check main thread name.
20+ assert_eq ! ( thread:: current( ) . name( ) . unwrap( ) , "main" ) ;
21+ }
Original file line number Diff line number Diff line change 1+ //! Panicking in other threads.
2+
3+ use std:: thread;
4+
5+ fn panic ( ) {
6+ let result = thread:: spawn ( || panic ! ( "Hello!" ) ) . join ( ) . unwrap_err ( ) ;
7+ let msg = result. downcast_ref :: < & ' static str > ( ) . unwrap ( ) ;
8+ assert_eq ! ( * msg, "Hello!" ) ;
9+ }
10+
11+ fn panic_named ( ) {
12+ thread:: Builder :: new ( )
13+ . name ( "childthread" . to_string ( ) )
14+ . spawn ( move || {
15+ panic ! ( "Hello, world!" ) ;
16+ } )
17+ . unwrap ( )
18+ . join ( )
19+ . unwrap_err ( ) ;
20+ }
21+
22+ fn main ( ) {
23+ panic ( ) ;
24+ panic_named ( ) ;
25+ }
Original file line number Diff line number Diff line change 1+ thread '<unnamed>' panicked at $DIR/thread_panic.rs:LL:CC:
2+ Hello!
3+ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
4+ thread 'childthread' panicked at $DIR/thread_panic.rs:LL:CC:
5+ Hello, world!
You can’t perform that action at this time.
0 commit comments