]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-7013.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-7013.rs
1 #![feature(box_syntax)]
2
3 use std::cell::RefCell;
4 use std::rc::Rc;
5
6 trait Foo {
7 fn set(&mut self, v: Rc<RefCell<A>>);
8 }
9
10 struct B {
11 v: Option<Rc<RefCell<A>>>
12 }
13
14 impl Foo for B {
15 fn set(&mut self, v: Rc<RefCell<A>>)
16 {
17 self.v = Some(v);
18 }
19 }
20
21 struct A {
22 v: Box<dyn Foo + Send>,
23 }
24
25 fn main() {
26 let a = A {v: box B{v: None} as Box<dyn Foo + Send>};
27 //~^ ERROR `std::rc::Rc<std::cell::RefCell<A>>` cannot be sent between threads safely
28 }