Skip to content

Commit

Permalink
Rollup merge of rust-lang#42397 - sfackler:syncsender-sync, r=alexcri…
Browse files Browse the repository at this point in the history
…chton

Implement Sync for SyncSender

r? @alexcrichton
  • Loading branch information
frewsxcv committed Jun 21, 2017
2 parents 03198da + 0f6c01d commit 292fcc8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
5 changes: 0 additions & 5 deletions src/libstd/sync/mpsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,6 @@ unsafe impl<T: Send> Send for Sender<T> { }
impl<T> !Sync for Sender<T> { }

/// The sending-half of Rust's synchronous [`sync_channel`] type.
/// This half can only be owned by one thread, but it can be cloned
/// to send to other threads.
///
/// Messages can be sent through this channel with [`send`] or [`try_send`].
///
Expand Down Expand Up @@ -555,9 +553,6 @@ pub struct SyncSender<T> {
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: Send> Send for SyncSender<T> {}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> !Sync for SyncSender<T> {}

/// An error returned from the [`Sender::send`] or [`SyncSender::send`]
/// function on **channel**s.
///
Expand Down
4 changes: 1 addition & 3 deletions src/test/compile-fail/not-sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use std::cell::{Cell, RefCell};
use std::rc::{Rc, Weak};
use std::sync::mpsc::{Receiver, Sender, SyncSender};
use std::sync::mpsc::{Receiver, Sender};

fn test<T: Sync>() {}

Expand All @@ -29,6 +29,4 @@ fn main() {
//~^ ERROR `std::sync::mpsc::Receiver<i32>: std::marker::Sync` is not satisfied
test::<Sender<i32>>();
//~^ ERROR `std::sync::mpsc::Sender<i32>: std::marker::Sync` is not satisfied
test::<SyncSender<i32>>();
//~^ ERROR `std::sync::mpsc::SyncSender<i32>: std::marker::Sync` is not satisfied
}

0 comments on commit 292fcc8

Please sign in to comment.