]>
Commit | Line | Data |
---|---|---|
85aaf69f | 1 | use std::thread; |
1a4d82fc JJ |
2 | use std::rc::Rc; |
3 | ||
85aaf69f | 4 | #[derive(Debug)] |
1a4d82fc | 5 | struct Port<T>(Rc<T>); |
223e47cc LB |
6 | |
7 | fn main() { | |
85aaf69f | 8 | #[derive(Debug)] |
0731742a | 9 | struct Foo { |
223e47cc LB |
10 | _x: Port<()>, |
11 | } | |
12 | ||
0731742a | 13 | impl Drop for Foo { |
1a4d82fc | 14 | fn drop(&mut self) {} |
223e47cc LB |
15 | } |
16 | ||
0731742a XL |
17 | fn foo(x: Port<()>) -> Foo { |
18 | Foo { | |
223e47cc LB |
19 | _x: x |
20 | } | |
21 | } | |
22 | ||
1a4d82fc | 23 | let x = foo(Port(Rc::new(()))); |
223e47cc | 24 | |
85aaf69f | 25 | thread::spawn(move|| { |
1b1a35ee | 26 | //~^ ERROR `Rc<()>` cannot be sent between threads safely |
1a4d82fc JJ |
27 | let y = x; |
28 | println!("{:?}", y); | |
29 | }); | |
223e47cc | 30 | } |