clean up the Rc/RcMut types and move to libstd
This commit is contained in:
parent
e192b6d7c5
commit
18be986c99
6 changed files with 118 additions and 93 deletions
|
|
@ -8,8 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
extern mod extra;
|
||||
use extra::rc::RcMut;
|
||||
use std::rc::RcMut;
|
||||
|
||||
trait Foo
|
||||
{
|
||||
|
|
@ -37,7 +36,7 @@ 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::from_freeze(a); //~ ERROR instantiating a type parameter with an incompatible type
|
||||
let v = RcMut::new(a); //~ ERROR instantiating a type parameter with an incompatible type
|
||||
let w = v.clone();
|
||||
v.with_mut_borrow(|p| {p.v.set(w.clone());})
|
||||
}
|
||||
|
|
|
|||
18
src/test/compile-fail/no_send-rc.rs
Normal file
18
src/test/compile-fail/no_send-rc.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
fn bar<T: Send>(_: T) {}
|
||||
|
||||
fn main() {
|
||||
let x = Rc::new(5);
|
||||
bar(x); //~ ERROR instantiating a type parameter with an incompatible type `std::rc::Rc<int>`, which does not fulfill `Send`
|
||||
}
|
||||
|
|
@ -8,13 +8,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
extern mod extra;
|
||||
use std::rc::RcMut;
|
||||
|
||||
fn o<T: Send>(_: &T) {}
|
||||
fn c<T: Freeze>(_: &T) {}
|
||||
|
||||
fn main() {
|
||||
let x = extra::rc::RcMut::from_send(0);
|
||||
o(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Send`
|
||||
c(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Freeze`
|
||||
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`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue