File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1+ use core:: panic:: RefUnwindSafe ;
2+
13use crate :: fmt;
24use crate :: sync:: nonpoison:: { Condvar , Mutex } ;
35
@@ -31,6 +33,9 @@ pub struct Barrier {
3133 num_threads : usize ,
3234}
3335
36+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
37+ impl RefUnwindSafe for Barrier { }
38+
3439// The inner state of a double barrier
3540struct BarrierState {
3641 count : usize ,
Original file line number Diff line number Diff line change 1+ use std:: panic:: RefUnwindSafe ;
12use std:: sync:: mpsc:: { TryRecvError , channel} ;
23use std:: sync:: { Arc , Barrier } ;
34use std:: thread;
@@ -33,3 +34,12 @@ fn test_barrier() {
3334 }
3435 assert ! ( leader_found) ;
3536}
37+
38+ #[ expect( dead_code, reason = "this is essentially a compile pass test" ) ]
39+ fn check_barrier_is_ref_unwind_safe ( ) {
40+ let barrier = Arc :: new ( Barrier :: new ( 10 ) ) ;
41+
42+ fn check < T : RefUnwindSafe > ( _: T ) { }
43+
44+ check ( barrier) ;
45+ }
You can’t perform that action at this time.
0 commit comments