]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-7013.rs
Consider privacy more carefully when suggesting accessing fields
[rust.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 `Rc<RefCell<A>>` cannot be sent between threads safely
28 }