]> git.proxmox.com Git - rustc.git/blob - src/test/ui/no-send-res-ports.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / no-send-res-ports.rs
1 // ignore-x86 FIXME: missing sysroot spans (#53081)
2 use std::thread;
3 use std::rc::Rc;
4
5 #[derive(Debug)]
6 struct Port<T>(Rc<T>);
7
8 fn main() {
9 #[derive(Debug)]
10 struct Foo {
11 _x: Port<()>,
12 }
13
14 impl Drop for Foo {
15 fn drop(&mut self) {}
16 }
17
18 fn foo(x: Port<()>) -> Foo {
19 Foo {
20 _x: x
21 }
22 }
23
24 let x = foo(Port(Rc::new(())));
25
26 thread::spawn(move|| {
27 //~^ ERROR `std::rc::Rc<()>` cannot be sent between threads safely
28 let y = x;
29 println!("{:?}", y);
30 });
31 }