File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,10 @@ pub struct Arc<T> {
117
117
_ptr : * mut ArcInner < T > ,
118
118
}
119
119
120
+ unsafe impl < T : Sync + Send > Send for Arc < T > { }
121
+ unsafe impl < T : Sync + Send > Sync for Arc < T > { }
122
+
123
+
120
124
/// A weak pointer to an `Arc`.
121
125
///
122
126
/// Weak pointers will not keep the data inside of the `Arc` alive, and can be used to break cycles
@@ -129,16 +133,18 @@ pub struct Weak<T> {
129
133
_ptr : * mut ArcInner < T > ,
130
134
}
131
135
132
- unsafe impl < T : Sync + Send > Send for Arc < T > { }
133
-
134
- unsafe impl < T : Sync + Send > Sync for Arc < T > { }
136
+ unsafe impl < T : Sync + Send > Send for Weak < T > { }
137
+ unsafe impl < T : Sync + Send > Sync for Weak < T > { }
135
138
136
139
struct ArcInner < T > {
137
140
strong : atomic:: AtomicUint ,
138
141
weak : atomic:: AtomicUint ,
139
142
data : T ,
140
143
}
141
144
145
+ unsafe impl < T : Sync + Send > Send for ArcInner < T > { }
146
+ unsafe impl < T : Sync + Send > Sync for ArcInner < T > { }
147
+
142
148
impl < T > Arc < T > {
143
149
/// Constructs a new `Arc<T>`.
144
150
///
@@ -591,6 +597,7 @@ mod tests {
591
597
use std:: str:: Str ;
592
598
use std:: sync:: atomic;
593
599
use std:: task;
600
+ use std:: kinds:: Send ;
594
601
use std:: vec:: Vec ;
595
602
use super :: { Arc , Weak , weak_count, strong_count} ;
596
603
use std:: sync:: Mutex ;
You can’t perform that action at this time.
0 commit comments