]> git.proxmox.com Git - rustc.git/blob - src/test/ui/threads-sendsync/send-resource.rs
New upstream version 1.38.0+dfsg1
[rustc.git] / src / test / ui / threads-sendsync / send-resource.rs
1 // run-pass
2 #![allow(unused_must_use)]
3 #![allow(dead_code)]
4 #![allow(non_camel_case_types)]
5
6 // pretty-expanded FIXME #23616
7 // ignore-emscripten no threads support
8
9 use std::thread;
10 use std::sync::mpsc::channel;
11
12 struct test {
13 f: isize,
14 }
15
16 impl Drop for test {
17 fn drop(&mut self) {}
18 }
19
20 fn test(f: isize) -> test {
21 test {
22 f: f
23 }
24 }
25
26 pub fn main() {
27 let (tx, rx) = channel();
28
29 let t = thread::spawn(move|| {
30 let (tx2, rx2) = channel();
31 tx.send(tx2).unwrap();
32
33 let _r = rx2.recv().unwrap();
34 });
35
36 rx.recv().unwrap().send(test(42)).unwrap();
37
38 t.join();
39 }