diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2018-02-25 13:18:29 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2018-03-14 18:05:55 -0700 |
| commit | bfc66daef9d1bdc52000cf8c079ea8572699f6c0 (patch) | |
| tree | cd1d17f087f6c3b83356368bdf1e6d5dce369f33 | |
| parent | cb5667eaa53c45f1cdf69f367f8cd749b0499ce1 (diff) | |
| download | rust-bfc66daef9d1bdc52000cf8c079ea8572699f6c0.tar.gz rust-bfc66daef9d1bdc52000cf8c079ea8572699f6c0.zip | |
Review comment: remove mention of `move` closure
| -rw-r--r-- | src/libcore/marker.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/closure-move-sync.stderr | 9 |
2 files changed, 15 insertions, 12 deletions
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index d78453cc900..53b1d1cd12d 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -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 } diff --git a/src/test/ui/closure-move-sync.stderr b/src/test/ui/closure-move-sync.stderr index 4b59ef8a437..abf07d2cef5 100644 --- a/src/test/ui/closure-move-sync.stderr +++ b/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<()>` @@ -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<()>` @@ -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" |
