From f522d882373067ab79ea0fdc30be6150eeccb1fd Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Mon, 29 Feb 2016 22:03:23 -0500 Subject: Explicitly opt out of `Sync` for `cell` and `mpsc` types These types were already `!Sync`, but this improves error messages when they are used in contexts that require `Sync`, aligning them with conventions used with `Rc`, among others. --- src/libstd/sync/mpsc/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libstd/sync') diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index fadca390986..dbcc2bc95bc 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -299,6 +299,9 @@ pub struct Receiver { #[stable(feature = "rust1", since = "1.0.0")] unsafe impl Send for Receiver { } +#[stable(feature = "rust1", since = "1.0.0")] +impl !Sync for Receiver { } + /// An iterator over messages on a receiver, this iterator will block /// whenever `next` is called, waiting for a new message, and `None` will be /// returned when the corresponding channel has hung up. @@ -327,6 +330,9 @@ pub struct Sender { #[stable(feature = "rust1", since = "1.0.0")] unsafe impl Send for Sender { } +#[stable(feature = "rust1", since = "1.0.0")] +impl !Sync for Sender { } + /// The sending-half of Rust's synchronous channel type. This half can only be /// owned by one thread, but it can be cloned to send to other threads. #[stable(feature = "rust1", since = "1.0.0")] -- cgit 1.4.1-3-g733a5