Remove RcMut

Rc<Mut<T>> should be used instead
This commit is contained in:
Steven Fackler 2013-11-14 19:57:11 -08:00
parent 0fade3a714
commit 7c9daa8ff7
3 changed files with 14 additions and 247 deletions

View file

@ -8,21 +8,22 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::rc::RcMut;
use std::rc::Rc;
use std::mutable::Mut;
trait Foo
{
fn set(&mut self, v: RcMut<A>);
fn set(&mut self, v: Rc<Mut<A>>);
}
struct B
{
v: Option<RcMut<A>>
v: Option<Rc<Mut<A>>>
}
impl Foo for B
{
fn set(&mut self, v: RcMut<A>)
fn set(&mut self, v: Rc<Mut<A>>)
{
self.v = Some(v);
}
@ -36,7 +37,9 @@ struct A
fn main()
{
let a = A {v: ~B{v: None} as ~Foo}; //~ ERROR cannot pack type `~B`, which does not fulfill `Send`
let v = RcMut::new(a); //~ ERROR instantiating a type parameter with an incompatible type
let v = Rc::from_send(Mut::new(a));
let w = v.clone();
v.with_mut_borrow(|p| {p.v.set(w.clone());})
let b = v.borrow();
let mut b = b.borrow_mut();
b.get().v.set(w.clone());
}

View file

@ -8,13 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::rc::RcMut;
use std::mutable::Mut;
use std::rc::Rc;
fn o<T: Send>(_: &T) {}
fn c<T: Freeze>(_: &T) {}
fn main() {
let x = RcMut::from_send(0);
o(&x); //~ ERROR instantiating a type parameter with an incompatible type `std::rc::RcMut<int>`, which does not fulfill `Send`
c(&x); //~ ERROR instantiating a type parameter with an incompatible type `std::rc::RcMut<int>`, which does not fulfill `Freeze`
let x = Rc::from_send(Mut::new(0));
o(&x); //~ ERROR instantiating a type parameter with an incompatible type `std::rc::Rc<std::mutable::Mut<int>>`, which does not fulfill `Send`
c(&x); //~ ERROR instantiating a type parameter with an incompatible type `std::rc::Rc<std::mutable::Mut<int>>`, which does not fulfill `Freeze`
}