rust/tests/ui/traits/issue-7013.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
432 B
Rust
Raw Normal View History

2013-11-22 05:30:34 +00:00
use std::cell::RefCell;
use std::rc::Rc;
trait Foo {
2013-11-22 05:30:34 +00:00
fn set(&mut self, v: Rc<RefCell<A>>);
}
struct B {
2013-11-22 05:30:34 +00:00
v: Option<Rc<RefCell<A>>>
}
impl Foo for B {
2013-11-22 05:30:34 +00:00
fn set(&mut self, v: Rc<RefCell<A>>)
{
self.v = Some(v);
}
}
struct A {
2019-05-28 18:46:13 +00:00
v: Box<dyn Foo + Send>,
}
fn main() {
let a = A {v: Box::new(B{v: None}) as Box<dyn Foo + Send>};
//~^ ERROR `Rc<RefCell<A>>` cannot be sent between threads safely
}