File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -150,9 +150,11 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> core::ops::DispatchFromDyn<Arc<U>> for Ar
150
150
// mutable reference when the reference count reaches zero and `T` is dropped.
151
151
unsafe impl < T : ?Sized + Sync + Send > Send for Arc < T > { }
152
152
153
- // SAFETY: It is safe to send `&Arc<T>` to another thread when the underlying `T` is `Sync` for the
154
- // same reason as above. `T` needs to be `Send` as well because a thread can clone an `&Arc<T>`
155
- // into an `Arc<T>`, which may lead to `T` being accessed by the same reasoning as above.
153
+ // SAFETY: It is safe to send `&Arc<T>` to another thread when the underlying `T` is `Sync`
154
+ // because it effectively means sharing `&T` (which is safe because `T` is `Sync`); additionally,
155
+ // it needs `T` to be `Send` because any thread that has a `&Arc<T>` may clone it and get an
156
+ // `Arc<T>` on that thread, so the thread may ultimately access `T` using a mutable reference when
157
+ // the reference count reaches zero and `T` is dropped.
156
158
unsafe impl < T : ?Sized + Sync + Send > Sync for Arc < T > { }
157
159
158
160
impl < T > Arc < T > {
You can’t perform that action at this time.
0 commit comments