1 use std::thread;
2 use std::sync::mpsc::channel;
3 
bar()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 
foo()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 
main()22 fn main() {}
23