rust/tests/ui/traits/issue-7013.rs
2023-01-11 09:32:08 +00:00

27 lines
432 B
Rust

use std::cell::RefCell;
use std::rc::Rc;
trait Foo {
fn set(&mut self, v: Rc<RefCell<A>>);
}
struct B {
v: Option<Rc<RefCell<A>>>
}
impl Foo for B {
fn set(&mut self, v: Rc<RefCell<A>>)
{
self.v = Some(v);
}
}
struct A {
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
}