Skip to content

Commit bfc66da

Browse files
committed
Review comment: remove mention of move closure
1 parent cb5667e commit bfc66da

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/libcore/marker.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -344,18 +344,20 @@ pub trait Copy : Clone {
344344
#[stable(feature = "rust1", since = "1.0.0")]
345345
#[lang = "sync"]
346346
#[rustc_on_unimplemented(
347-
on(
348-
_Self="std::sync::mpsc::Receiver<T>",
349-
label="`{Self}` cannot be shared safely, consider marking the closure `move`"
350-
),
351-
on(
352-
_Self="std::sync::mpsc::Sender<T>",
353-
label="`{Self}` cannot be shared safely, consider marking the closure `move`"
354-
),
355347
message="`{Self}` cannot be shared between threads safely",
356348
label="`{Self}` cannot be shared between threads safely"
357349
)]
358350
pub unsafe auto trait Sync {
351+
// FIXME(estebank): once support to add notes in `rustc_on_unimplemented`
352+
// lands in beta, and it has been extended to check whether a closure is
353+
// anywhere in the requirement chain, extend it as such (#48534):
354+
// ```
355+
// on(
356+
// closure,
357+
// note="`{Self}` cannot be shared safely, consider marking the closure `move`"
358+
// ),
359+
// ```
360+
359361
// Empty
360362
}
361363

src/test/ui/closure-move-sync.stderr

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely
22
--> $DIR/closure-move-sync.rs:16:13
33
|
4-
16 | let t = thread::spawn(|| {
5-
| ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared safely, consider marking the closure `move`
4+
LL | let t = thread::spawn(|| {
5+
| ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely
66
|
77
= help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Receiver<()>`
88
= 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
1212
error[E0277]: `std::sync::mpsc::Sender<()>` cannot be shared between threads safely
1313
--> $DIR/closure-move-sync.rs:28:5
1414
|
15-
28 | thread::spawn(|| tx.send(()).unwrap());
16-
| ^^^^^^^^^^^^^ `std::sync::mpsc::Sender<()>` cannot be shared safely, consider marking the closure `move`
15+
LL | thread::spawn(|| tx.send(()).unwrap());
16+
| ^^^^^^^^^^^^^ `std::sync::mpsc::Sender<()>` cannot be shared between threads safely
1717
|
1818
= help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender<()>`
1919
= 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
2222

2323
error: aborting due to 2 previous errors
2424

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

0 commit comments

Comments
 (0)