]> git.proxmox.com Git - rustc.git/blob - src/test/ui/closures/closure-move-sync.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / 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() {}