rust/src/test/ui/issues/issue-7013.rs

29 lines
461 B
Rust
Raw Normal View History

2015-01-07 18:53:58 -08:00
#![feature(box_syntax)]
2013-11-21 21:30:34 -08:00
use std::cell::RefCell;
use std::rc::Rc;
trait Foo {
2013-11-21 21:30:34 -08:00
fn set(&mut self, v: Rc<RefCell<A>>);
}
struct B {
2013-11-21 21:30:34 -08:00
v: Option<Rc<RefCell<A>>>
}
impl Foo for B {
2013-11-21 21:30:34 -08:00
fn set(&mut self, v: Rc<RefCell<A>>)
{
self.v = Some(v);
}
}
struct A {
2014-06-14 11:03:34 -07:00
v: Box<Foo + Send>,
}
fn main() {
let a = A {v: box B{v: None} as Box<Foo+Send>};
//~^ ERROR `std::rc::Rc<std::cell::RefCell<A>>` cannot be sent between threads safely
}