Skip to content

Commit

Permalink
Review comment: remove mention of move closure
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Mar 15, 2018
1 parent cb5667e commit bfc66da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
18 changes: 10 additions & 8 deletions src/libcore/marker.rs
Expand Up @@ -344,18 +344,20 @@ pub trait Copy : Clone {
#[stable(feature = "rust1", since = "1.0.0")]
#[lang = "sync"]
#[rustc_on_unimplemented(
on(
_Self="std::sync::mpsc::Receiver<T>",
label="`{Self}` cannot be shared safely, consider marking the closure `move`"
),
on(
_Self="std::sync::mpsc::Sender<T>",
label="`{Self}` cannot be shared safely, consider marking the closure `move`"
),
message="`{Self}` cannot be shared between threads safely",
label="`{Self}` cannot be shared between threads safely"
)]
pub unsafe auto trait Sync {
// FIXME(estebank): once support to add notes in `rustc_on_unimplemented`
// lands in beta, and it has been extended to check whether a closure is
// anywhere in the requirement chain, extend it as such (#48534):
// ```
// on(
// closure,
// note="`{Self}` cannot be shared safely, consider marking the closure `move`"
// ),
// ```

// Empty
}

Expand Down
9 changes: 5 additions & 4 deletions src/test/ui/closure-move-sync.stderr
@@ -1,8 +1,8 @@
error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely
--> $DIR/closure-move-sync.rs:16:13
|
16 | let t = thread::spawn(|| {
| ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared safely, consider marking the closure `move`
LL | let t = thread::spawn(|| {
| ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Receiver<()>`
= note: required because of the requirements on the impl of `std::marker::Send` for `&std::sync::mpsc::Receiver<()>`
Expand All @@ -12,8 +12,8 @@ error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads s
error[E0277]: `std::sync::mpsc::Sender<()>` cannot be shared between threads safely
--> $DIR/closure-move-sync.rs:28:5
|
28 | thread::spawn(|| tx.send(()).unwrap());
| ^^^^^^^^^^^^^ `std::sync::mpsc::Sender<()>` cannot be shared safely, consider marking the closure `move`
LL | thread::spawn(|| tx.send(()).unwrap());
| ^^^^^^^^^^^^^ `std::sync::mpsc::Sender<()>` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender<()>`
= note: required because of the requirements on the impl of `std::marker::Send` for `&std::sync::mpsc::Sender<()>`
Expand All @@ -22,3 +22,4 @@ error[E0277]: `std::sync::mpsc::Sender<()>` cannot be shared between threads saf

error: aborting due to 2 previous errors

If you want more information on this error, try using "rustc --explain E0277"

0 comments on commit bfc66da

Please sign in to comment.