]> git.lizzy.rs Git - rust.git/blob - src/test/ui/no-send-res-ports.rs
Rollup merge of #65777 - matthewjasper:allow-impl-trait-expansion, r=davidtwco
[rust.git] / src / test / ui / no-send-res-ports.rs
1 // ignore-x86
2 // ^ due to stderr output differences
3 use std::thread;
4 use std::rc::Rc;
5
6 #[derive(Debug)]
7 struct Port<T>(Rc<T>);
8
9 fn main() {
10     #[derive(Debug)]
11     struct Foo {
12       _x: Port<()>,
13     }
14
15     impl Drop for Foo {
16         fn drop(&mut self) {}
17     }
18
19     fn foo(x: Port<()>) -> Foo {
20         Foo {
21             _x: x
22         }
23     }
24
25     let x = foo(Port(Rc::new(())));
26
27     thread::spawn(move|| {
28         //~^ ERROR `std::rc::Rc<()>` cannot be sent between threads safely
29         let y = x;
30         println!("{:?}", y);
31     });
32 }