diff options
| author | Andrew Paseltiner <apaseltiner@gmail.com> | 2016-02-29 22:03:23 -0500 |
|---|---|---|
| committer | Andrew Paseltiner <apaseltiner@gmail.com> | 2016-03-01 18:51:46 -0500 |
| commit | f522d882373067ab79ea0fdc30be6150eeccb1fd (patch) | |
| tree | 16ba657f47d2e5fe3fcb0e5bc7b483062e400225 /src/libstd | |
| parent | 52cb8a9d39d05126a79e7b9a3adc31a5e3cdde94 (diff) | |
| download | rust-f522d882373067ab79ea0fdc30be6150eeccb1fd.tar.gz rust-f522d882373067ab79ea0fdc30be6150eeccb1fd.zip | |
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.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sync/mpsc/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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<T> { #[stable(feature = "rust1", since = "1.0.0")] unsafe impl<T: Send> Send for Receiver<T> { } +#[stable(feature = "rust1", since = "1.0.0")] +impl<T> !Sync for Receiver<T> { } + /// 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<T> { #[stable(feature = "rust1", since = "1.0.0")] unsafe impl<T: Send> Send for Sender<T> { } +#[stable(feature = "rust1", since = "1.0.0")] +impl<T> !Sync for Sender<T> { } + /// 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")] |
