1
Fork 0

Add comments regarding superfluous !Sync impls

This commit is contained in:
bstrie 2021-07-27 18:50:34 -04:00
parent 495322d776
commit 86c0ef8adc
2 changed files with 11 additions and 0 deletions

View file

@ -240,6 +240,11 @@ pub struct Cell<T: ?Sized> {
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: ?Sized> Send for Cell<T> where T: Send {}
// Note that this negative impl isn't strictly necessary for correctness,
// as `Cell` wraps `UnsafeCell`, which is itself `!Sync`.
// However, given how important `Cell`'s `!Sync`-ness is,
// having an explicit negative impl is nice for documentation purposes
// and results in nicer error messages.
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> !Sync for Cell<T> {}