]> git.lizzy.rs Git - rust.git/blob - src/test/ui/no-send-res-ports.rs
parser will not give wrong help message for 'public'
[rust.git] / src / test / ui / no-send-res-ports.rs
1 use std::thread;
2 use std::rc::Rc;
3
4 #[derive(Debug)]
5 struct Port<T>(Rc<T>);
6
7 fn main() {
8     #[derive(Debug)]
9     struct Foo {
10       _x: Port<()>,
11     }
12
13     impl Drop for Foo {
14         fn drop(&mut self) {}
15     }
16
17     fn foo(x: Port<()>) -> Foo {
18         Foo {
19             _x: x
20         }
21     }
22
23     let x = foo(Port(Rc::new(())));
24
25     thread::spawn(move|| {
26         //~^ ERROR `Rc<()>` cannot be sent between threads safely
27         let y = x;
28         println!("{:?}", y);
29     });
30 }