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
+
1
3
use crate :: fmt;
2
4
use crate :: sync:: nonpoison:: { Condvar , Mutex } ;
3
5
@@ -31,6 +33,9 @@ pub struct Barrier {
31
33
num_threads : usize ,
32
34
}
33
35
36
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
37
+ impl RefUnwindSafe for Barrier { }
38
+
34
39
// The inner state of a double barrier
35
40
struct BarrierState {
36
41
count : usize ,
Original file line number Diff line number Diff line change
1
+ use std:: panic:: RefUnwindSafe ;
1
2
use std:: sync:: mpsc:: { TryRecvError , channel} ;
2
3
use std:: sync:: { Arc , Barrier } ;
3
4
use std:: thread;
@@ -33,3 +34,12 @@ fn test_barrier() {
33
34
}
34
35
assert ! ( leader_found) ;
35
36
}
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