]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/closure-move-sync.rs
Rollup merge of #106836 - ibraheemdev:sync-sender-spin, r=Amanieu
[rust.git] / tests / ui / closures / closure-move-sync.rs
1 use std::thread;
2 use std::sync::mpsc::channel;
3
4 fn bar() {
5     let (send, recv) = channel();
6     let t = thread::spawn(|| {
7         recv.recv().unwrap();
8         //~^^ ERROR `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely
9     });
10
11     send.send(());
12
13     t.join().unwrap();
14 }
15
16 fn foo() {
17     let (tx, _rx) = channel();
18     thread::spawn(|| tx.send(()).unwrap());
19     //~^ ERROR `Sender<()>` cannot be shared between threads safely
20 }
21
22 fn main() {}