]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-7013.rs
Require Drop impls to have the same constness on its bounds as the bounds on the...
[rust.git] / src / test / ui / issues / issue-7013.rs
1 use std::cell::RefCell;
2 use std::rc::Rc;
3
4 trait Foo {
5     fn set(&mut self, v: Rc<RefCell<A>>);
6 }
7
8 struct B {
9     v: Option<Rc<RefCell<A>>>
10 }
11
12 impl Foo for B {
13     fn set(&mut self, v: Rc<RefCell<A>>)
14     {
15         self.v = Some(v);
16     }
17 }
18
19 struct A {
20     v: Box<dyn Foo + Send>,
21 }
22
23 fn main() {
24     let a = A {v: Box::new(B{v: None}) as Box<dyn Foo + Send>};
25     //~^ ERROR `Rc<RefCell<A>>` cannot be sent between threads safely
26 }