File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ impl Default for AtomicBool {
92
92
}
93
93
}
94
94
95
+ // Send is implicitly implemented for AtomicBool.
95
96
unsafe impl Sync for AtomicBool { }
96
97
97
98
/// A signed integer type which can be safely shared between threads.
@@ -106,6 +107,7 @@ impl Default for AtomicIsize {
106
107
}
107
108
}
108
109
110
+ // Send is implicitly implemented for AtomicIsize.
109
111
unsafe impl Sync for AtomicIsize { }
110
112
111
113
/// An unsigned integer type which can be safely shared between threads.
@@ -120,6 +122,7 @@ impl Default for AtomicUsize {
120
122
}
121
123
}
122
124
125
+ // Send is implicitly implemented for AtomicUsize.
123
126
unsafe impl Sync for AtomicUsize { }
124
127
125
128
/// A raw pointer type which can be safely shared between threads.
Original file line number Diff line number Diff line change 10
10
11
11
use core:: sync:: atomic:: * ;
12
12
use core:: sync:: atomic:: Ordering :: SeqCst ;
13
+ use core:: marker:: { Send , Sync } ;
13
14
14
15
#[ test]
15
16
fn bool_ ( ) {
@@ -82,3 +83,13 @@ fn static_init() {
82
83
assert ! ( S_INT . load( SeqCst ) == 0 ) ;
83
84
assert ! ( S_UINT . load( SeqCst ) == 0 ) ;
84
85
}
86
+
87
+ #[ test]
88
+ fn static_sync_and_send ( ) {
89
+ fn ensure_sync_and_send < T : Sync +Send > ( ) { }
90
+
91
+ ensure_sync_and_send :: < AtomicBool > ( ) ;
92
+ ensure_sync_and_send :: < AtomicUsize > ( ) ;
93
+ ensure_sync_and_send :: < AtomicIsize > ( ) ;
94
+ ensure_sync_and_send :: < AtomicPtr > ( ) ;
95
+ }
You can’t perform that action at this time.
0 commit comments