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.
This commit is contained in:
parent
52cb8a9d39
commit
f522d88237
6 changed files with 46 additions and 54 deletions
|
|
@ -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")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue