2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_must_use)]
|
|
|
|
#![allow(dead_code)]
|
2018-08-31 13:02:01 +00:00
|
|
|
#![allow(non_camel_case_types)]
|
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
//@ pretty-expanded FIXME #23616
|
2024-03-06 20:19:20 +00:00
|
|
|
//@ needs-threads
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2015-03-30 18:00:05 +00:00
|
|
|
use std::thread;
|
2014-12-23 19:53:35 +00:00
|
|
|
use std::sync::mpsc::channel;
|
2013-01-29 07:54:39 +00:00
|
|
|
|
2012-08-16 01:46:55 +00:00
|
|
|
struct test {
|
2015-03-26 00:06:52 +00:00
|
|
|
f: isize,
|
2012-11-14 06:22:37 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 19:47:00 +00:00
|
|
|
impl Drop for test {
|
2013-09-17 01:18:07 +00:00
|
|
|
fn drop(&mut self) {}
|
2012-05-22 21:10:32 +00:00
|
|
|
}
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn test(f: isize) -> test {
|
2012-09-05 22:58:43 +00:00
|
|
|
test {
|
|
|
|
f: f
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2014-03-09 21:58:32 +00:00
|
|
|
let (tx, rx) = channel();
|
2012-05-22 21:10:32 +00:00
|
|
|
|
2015-04-13 22:15:32 +00:00
|
|
|
let t = thread::spawn(move|| {
|
2014-03-09 21:58:32 +00:00
|
|
|
let (tx2, rx2) = channel();
|
2014-12-23 19:53:35 +00:00
|
|
|
tx.send(tx2).unwrap();
|
2012-05-22 21:10:32 +00:00
|
|
|
|
2014-12-23 19:53:35 +00:00
|
|
|
let _r = rx2.recv().unwrap();
|
2014-01-27 23:29:50 +00:00
|
|
|
});
|
2012-05-22 21:10:32 +00:00
|
|
|
|
2014-12-23 19:53:35 +00:00
|
|
|
rx.recv().unwrap().send(test(42)).unwrap();
|
2015-04-13 22:15:32 +00:00
|
|
|
|
|
|
|
t.join();
|
2012-11-14 06:22:37 +00:00
|
|
|
}
|