2018-02-11 15:39:32 -06:00
|
|
|
use std::thread;
|
|
|
|
use std::sync::mpsc::channel;
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
let (send, recv) = channel();
|
|
|
|
let t = thread::spawn(|| {
|
|
|
|
recv.recv().unwrap();
|
|
|
|
//~^^ ERROR `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely
|
|
|
|
});
|
|
|
|
|
|
|
|
send.send(());
|
|
|
|
|
|
|
|
t.join().unwrap();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo() {
|
|
|
|
let (tx, _rx) = channel();
|
|
|
|
thread::spawn(|| tx.send(()).unwrap());
|
2020-09-02 02:40:56 -05:00
|
|
|
//~^ ERROR `Sender<()>` cannot be shared between threads safely
|
2018-02-11 15:39:32 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|