Skip to content

Commit 6a664b9

Browse files
committed
make MaybeUnsafeCell<T> Send when T: Sync
1 parent da6f527 commit 6a664b9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/bevy_ptr/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -349,3 +349,7 @@ impl<T> Clone for MaybeUnsafeCell<'_, T> {
349349
*self
350350
}
351351
}
352+
353+
// SAFETY: If `T` is `Sync`, `&T` is `Send` and while `&UnsafeCell<T>` is !Sync, users of
354+
// `MaybeUnsafeCell<T>` are already responsible for ensuring mutable access is unique.
355+
unsafe impl<T: Sync> Send for MaybeUnsafeCell<'_, T> {}

0 commit comments

Comments
 (0)