summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorbstrie <865233+bstrie@users.noreply.github.com>2021-07-27 18:50:34 -0400
committerbstrie <865233+bstrie@users.noreply.github.com>2021-11-08 13:07:20 -0500
commit86c0ef8adcf2c60dc21a8a9b8f2d6992f2d7613c (patch)
tree191747195cf97b1af521e27abac01e4d67b48a99 /library/alloc/src
parent495322d776fd6f679cd8cd4ca02b8fa834da654b (diff)
downloadrust-86c0ef8adcf2c60dc21a8a9b8f2d6992f2d7613c.tar.gz
rust-86c0ef8adcf2c60dc21a8a9b8f2d6992f2d7613c.zip
Add comments regarding superfluous `!Sync` impls
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/rc.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs
index 4fb2f0c8530..03e33a1ff2b 100644
--- a/library/alloc/src/rc.rs
+++ b/library/alloc/src/rc.rs
@@ -313,6 +313,12 @@ pub struct Rc<T: ?Sized> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> !marker::Send for Rc<T> {}
+
+// Note that this negative impl isn't strictly necessary for correctness,
+// as `Rc` transitively contains a `Cell`, which is itself `!Sync`.
+// However, given how important `Rc`'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> !marker::Sync for Rc<T> {}