@@ -1270,18 +1270,16 @@ pub type Result<T> = crate::result::Result<T, Box<dyn Any + Send + 'static>>;
1270
1270
// (the caller will never read this packet until the thread has exited).
1271
1271
//
1272
1272
// An Arc to the packet is stored into a `JoinInner` which in turns is placed
1273
- // in `JoinHandle`. Due to the usage of `UnsafeCell` we need to manually worry
1274
- // about impls like Send and Sync. The type `T` should already always be Send
1275
- // (otherwise the thread could not have been created) and this type is
1276
- // inherently Sync because no methods take &self. Regardless, however, we add
1277
- // inheriting impls for Send/Sync to this type to ensure it's Send/Sync and
1278
- // that future modifications will still appropriately classify it.
1273
+ // in `JoinHandle`.
1279
1274
struct Packet < ' scope , T > {
1280
1275
scope : Option < & ' scope scoped:: ScopeData > ,
1281
1276
result : UnsafeCell < Option < Result < T > > > ,
1282
1277
}
1283
1278
1284
- unsafe impl < ' scope , T : Send > Send for Packet < ' scope , T > { }
1279
+ // Due to the usage of `UnsafeCell` we need to manually implement Sync.
1280
+ // The type `T` should already always be Send (otherwise the thread could not
1281
+ // have been created) and the Packet is Sync because all access to the
1282
+ // `UnsafeCell` synchronized (by the `join()` boundary), and `ScopeData` is Sync.
1285
1283
unsafe impl < ' scope , T : Sync > Sync for Packet < ' scope , T > { }
1286
1284
1287
1285
impl < ' scope , T > Drop for Packet < ' scope , T > {
0 commit comments