about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-12-31 15:46:27 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-01-03 14:02:01 -0800
commitc3694d732ef9ed641671fbf116d183e78dc4e90a (patch)
tree9491998229d82615ae8d547ff4061e433947b373 /src
parentdf13c64c3b221f0408fa7e149884e25ff5b02343 (diff)
downloadrust-c3694d732ef9ed641671fbf116d183e78dc4e90a.tar.gz
rust-c3694d732ef9ed641671fbf116d183e78dc4e90a.zip
test: De-`@mut` the test suite
Diffstat (limited to 'src')
-rw-r--r--src/test/auxiliary/cci_nested_lib.rs20
-rw-r--r--src/test/auxiliary/issue-2631-a.rs5
-rw-r--r--src/test/bench/sudoku.rs4
-rw-r--r--src/test/compile-fail/cast-immutable-mutable-trait.rs30
-rw-r--r--src/test/compile-fail/fn-variance-1.rs13
-rw-r--r--src/test/compile-fail/issue-10487.rs1
-rw-r--r--src/test/compile-fail/issue-2548.rs14
-rw-r--r--src/test/compile-fail/issue-3668.rs2
-rw-r--r--src/test/compile-fail/kindck-destructor-owned.rs3
-rw-r--r--src/test/compile-fail/lub-in-args.rs26
-rw-r--r--src/test/compile-fail/object-pointer-types.rs13
-rw-r--r--src/test/compile-fail/pinned-deep-copy.rs10
-rw-r--r--src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs2
-rw-r--r--src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs2
-rw-r--r--src/test/compile-fail/unique-vec-res.rs14
-rw-r--r--src/test/pretty/block-disambig.rs13
-rw-r--r--src/test/run-fail/unwind-misc-1.rs2
-rw-r--r--src/test/run-pass/alignment-gep-tup-like-2.rs11
-rw-r--r--src/test/run-pass/auto-encode.rs4
-rw-r--r--src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs13
-rw-r--r--src/test/run-pass/borrowck-preserve-box-in-pat.rs14
-rw-r--r--src/test/run-pass/borrowck-univariant-enum.rs12
-rw-r--r--src/test/run-pass/cast-mutable-trait.rs36
-rw-r--r--src/test/run-pass/class-cast-to-trait-multiple-types.rs78
-rw-r--r--src/test/run-pass/class-cast-to-trait.rs5
-rw-r--r--src/test/run-pass/cycle-collection.rs8
-rw-r--r--src/test/run-pass/cycle-collection2.rs42
-rw-r--r--src/test/run-pass/deref-lval.rs8
-rw-r--r--src/test/run-pass/deriving-encodable-decodable.rs4
-rw-r--r--src/test/run-pass/deriving-zero.rs2
-rw-r--r--src/test/run-pass/explicit-self-closures.rs3
-rw-r--r--src/test/run-pass/expr-repeat-vstore.rs6
-rw-r--r--src/test/run-pass/exterior.rs14
-rw-r--r--src/test/run-pass/hashmap-memory.rs4
-rw-r--r--src/test/run-pass/init-res-into-things.rs32
-rw-r--r--src/test/run-pass/issue-2631-b.rs3
-rw-r--r--src/test/run-pass/issue-2735-2.rs12
-rw-r--r--src/test/run-pass/issue-2735-3.rs12
-rw-r--r--src/test/run-pass/issue-2904.rs4
-rw-r--r--src/test/run-pass/issue-3447.rs6
-rw-r--r--src/test/run-pass/issue-3860.rs26
-rw-r--r--src/test/run-pass/issue-5275.rs31
-rw-r--r--src/test/run-pass/issue-5517.rs16
-rw-r--r--src/test/run-pass/issue-979.rs12
-rw-r--r--src/test/run-pass/issue-980.rs12
-rw-r--r--src/test/run-pass/lambda-infer-unresolved.rs4
-rw-r--r--src/test/run-pass/log-linearized.rs36
-rw-r--r--src/test/run-pass/logging-only-prints-once.rs13
-rw-r--r--src/test/run-pass/mlist-cycle.rs26
-rw-r--r--src/test/run-pass/new-vstore-mut-box-syntax.rs16
-rw-r--r--src/test/run-pass/newtype-struct-drop-run.rs10
-rw-r--r--src/test/run-pass/objects-coerce-from-managed-to-borrowed.rs17
-rw-r--r--src/test/run-pass/option-unwrap.rs11
-rw-r--r--src/test/run-pass/packed-struct-generic-size.rs4
-rw-r--r--src/test/run-pass/packed-struct-size.rs4
-rw-r--r--src/test/run-pass/packed-tuple-struct-size.rs4
-rw-r--r--src/test/run-pass/rcvr-borrowed-to-region.rs2
-rw-r--r--src/test/run-pass/reflect-visit-data.rs34
-rw-r--r--src/test/run-pass/reflect-visit-type.rs6
-rw-r--r--src/test/run-pass/resource-assign-is-not-copy.rs12
-rw-r--r--src/test/run-pass/resource-cycle.rs83
-rw-r--r--src/test/run-pass/resource-cycle2.rs71
-rw-r--r--src/test/run-pass/resource-cycle3.rs80
-rw-r--r--src/test/run-pass/resource-destruct.rs16
-rw-r--r--src/test/run-pass/resource-in-struct.rs10
-rw-r--r--src/test/run-pass/task-killjoin-rsrc.rs10
-rw-r--r--src/test/run-pass/trait-cast.rs27
-rw-r--r--src/test/run-pass/uniq-cc-generic.rs14
-rw-r--r--src/test/run-pass/uniq-cc.rs15
-rw-r--r--src/test/run-pass/unique-pinned-nocopy-2.rs36
-rw-r--r--src/test/run-pass/vec-slice-drop.rs14
-rw-r--r--src/test/run-pass/weird-exprs.rs9
72 files changed, 351 insertions, 837 deletions
diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs
index 72ce66c20bd..90b01f8888b 100644
--- a/src/test/auxiliary/cci_nested_lib.rs
+++ b/src/test/auxiliary/cci_nested_lib.rs
@@ -10,6 +10,8 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
+
 pub struct Entry<A,B> {
     key: A,
     value: B
@@ -17,11 +19,12 @@ pub struct Entry<A,B> {
 
 pub struct alist<A,B> {
     eq_fn: extern "Rust" fn(A,A) -> bool,
-    data: @mut ~[Entry<A,B>]
+    data: @RefCell<~[Entry<A,B>]>,
 }
 
 pub fn alist_add<A:'static,B:'static>(lst: &alist<A,B>, k: A, v: B) {
-    lst.data.push(Entry{key:k, value:v});
+    let mut data = lst.data.borrow_mut();
+    data.get().push(Entry{key:k, value:v});
 }
 
 pub fn alist_get<A:Clone + 'static,
@@ -30,7 +33,8 @@ pub fn alist_get<A:Clone + 'static,
                  k: A)
                  -> B {
     let eq_fn = lst.eq_fn;
-    for entry in lst.data.iter() {
+    let data = lst.data.borrow();
+    for entry in data.get().iter() {
         if eq_fn(entry.key.clone(), k.clone()) {
             return entry.value.clone();
         }
@@ -41,12 +45,18 @@ pub fn alist_get<A:Clone + 'static,
 #[inline]
 pub fn new_int_alist<B:'static>() -> alist<int, B> {
     fn eq_int(a: int, b: int) -> bool { a == b }
-    return alist {eq_fn: eq_int, data: @mut ~[]};
+    return alist {
+        eq_fn: eq_int,
+        data: @RefCell::new(~[]),
+    };
 }
 
 #[inline]
 pub fn new_int_alist_2<B:'static>() -> alist<int, B> {
     #[inline]
     fn eq_int(a: int, b: int) -> bool { a == b }
-    return alist {eq_fn: eq_int, data: @mut ~[]};
+    return alist {
+        eq_fn: eq_int,
+        data: @RefCell::new(~[]),
+    };
 }
diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs
index f5d2fb9ffd2..15dde899ce3 100644
--- a/src/test/auxiliary/issue-2631-a.rs
+++ b/src/test/auxiliary/issue-2631-a.rs
@@ -14,11 +14,12 @@
 
 extern mod extra;
 
+use std::cell::RefCell;
 use std::hashmap::HashMap;
 
-pub type header_map = HashMap<~str, @mut ~[@~str]>;
+pub type header_map = HashMap<~str, @RefCell<~[@~str]>>;
 
 // the unused ty param is necessary so this gets monomorphized
 pub fn request<T>(req: &header_map) {
-  let _x = (*((**req.get(&~"METHOD")).clone())[0u]).clone();
+  let _x = (*((**req.get(&~"METHOD")).clone()).get()[0u]).clone();
 }
diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs
index 39bcfde2826..75587f17b10 100644
--- a/src/test/bench/sudoku.rs
+++ b/src/test/bench/sudoku.rs
@@ -86,7 +86,7 @@ impl Sudoku {
         return Sudoku::new(g)
     }
 
-    pub fn write(&self, writer: @mut io::Writer) {
+    pub fn write(&self, writer: &mut io::Writer) {
         for row in range(0u8, 9u8) {
             write!(writer, "{}", self.grid[row][0]);
             for col in range(1u8, 9u8) {
@@ -280,5 +280,5 @@ fn main() {
         Sudoku::read(BufferedReader::new(io::stdin()))
     };
     sudoku.solve();
-    sudoku.write(@mut io::stdout() as @mut io::Writer);
+    sudoku.write(&mut io::stdout());
 }
diff --git a/src/test/compile-fail/cast-immutable-mutable-trait.rs b/src/test/compile-fail/cast-immutable-mutable-trait.rs
deleted file mode 100644
index 817696c6d20..00000000000
--- a/src/test/compile-fail/cast-immutable-mutable-trait.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.
-
-#[feature(managed_boxes)];
-
-trait T {
-    fn foo(@mut self);
-}
-
-struct S {
-    unused: int
-}
-
-impl T for S {
-    fn foo(@mut self) {
-    }
-}
-
-fn main() {
-    let s = @S { unused: 0 };
-    let _s2 = s as @mut T; //~ error: types differ in mutability
-    let _s3 = &s as &mut T; //~ error: types differ in mutability
-}
diff --git a/src/test/compile-fail/fn-variance-1.rs b/src/test/compile-fail/fn-variance-1.rs
index a4ebfef1774..2277f7080af 100644
--- a/src/test/compile-fail/fn-variance-1.rs
+++ b/src/test/compile-fail/fn-variance-1.rs
@@ -8,19 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
+fn takes_imm(x: &int) { }
 
-fn takes_mut(x: @mut int) { }
-fn takes_imm(x: @int) { }
+fn takes_mut(x: &mut int) { }
 
 fn apply<T>(t: T, f: |T|) {
     f(t)
 }
 
 fn main() {
-    apply(@3, takes_mut); //~ ERROR (values differ in mutability)
-    apply(@3, takes_imm);
+    apply(&3, takes_mut); //~ ERROR (values differ in mutability)
+    apply(&3, takes_imm);
 
-    apply(@mut 3, takes_mut);
-    apply(@mut 3, takes_imm); //~ ERROR (values differ in mutability)
+    apply(&mut 3, takes_mut);
+    apply(&mut 3, takes_imm); //~ ERROR (values differ in mutability)
 }
diff --git a/src/test/compile-fail/issue-10487.rs b/src/test/compile-fail/issue-10487.rs
index d116b7b67ca..302e883942e 100644
--- a/src/test/compile-fail/issue-10487.rs
+++ b/src/test/compile-fail/issue-10487.rs
@@ -12,6 +12,5 @@
 
 static x: ~[int] = ~[123, 456]; //~ ERROR: cannot allocate vectors in constant expressions
 static y: @[int] = @[123, 456]; //~ ERROR: cannot allocate vectors in constant expressions
-static z: @mut [int] = @mut [123, 456]; //~ ERROR: cannot allocate vectors in constant expressions
 
 fn main() {}
diff --git a/src/test/compile-fail/issue-2548.rs b/src/test/compile-fail/issue-2548.rs
index 21b6959692f..def712d9e8d 100644
--- a/src/test/compile-fail/issue-2548.rs
+++ b/src/test/compile-fail/issue-2548.rs
@@ -12,10 +12,10 @@
 
 // A test case for #2548.
 
-struct foo {
-    x: @mut int,
-
+use std::cell::Cell;
 
+struct foo {
+    x: @Cell<int>,
 }
 
 #[unsafe_destructor]
@@ -23,17 +23,17 @@ impl Drop for foo {
     fn drop(&mut self) {
         unsafe {
             println("Goodbye, World!");
-            *self.x += 1;
+            self.x.set(self.x.get() + 1);
         }
     }
 }
 
-fn foo(x: @mut int) -> foo {
+fn foo(x: @Cell<int>) -> foo {
     foo { x: x }
 }
 
 fn main() {
-    let x = @mut 0;
+    let x = @Cell::new(0);
 
     {
         let mut res = foo(x);
@@ -43,5 +43,5 @@ fn main() {
         assert_eq!(v.len(), 2);
     }
 
-    assert_eq!(*x, 1);
+    assert_eq!(x.get(), 1);
 }
diff --git a/src/test/compile-fail/issue-3668.rs b/src/test/compile-fail/issue-3668.rs
index 4665687db85..fe57d7171a6 100644
--- a/src/test/compile-fail/issue-3668.rs
+++ b/src/test/compile-fail/issue-3668.rs
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-struct P { child: Option<@mut P> }
+struct P { child: Option<@P> }
 trait PTrait {
    fn getChildOption(&self) -> Option<@P>;
 }
diff --git a/src/test/compile-fail/kindck-destructor-owned.rs b/src/test/compile-fail/kindck-destructor-owned.rs
index 2ea12ab9fdc..de277b4c36e 100644
--- a/src/test/compile-fail/kindck-destructor-owned.rs
+++ b/src/test/compile-fail/kindck-destructor-owned.rs
@@ -1,12 +1,11 @@
 #[feature(managed_boxes)];
 
 struct Foo {
-    f: @mut int,
+    f: @int,
 }
 
 impl Drop for Foo { //~ ERROR cannot implement a destructor on a structure that does not satisfy Send
     fn drop(&mut self) {
-        *self.f = 10;
     }
 }
 
diff --git a/src/test/compile-fail/lub-in-args.rs b/src/test/compile-fail/lub-in-args.rs
deleted file mode 100644
index 0ce8ee40d3b..00000000000
--- a/src/test/compile-fail/lub-in-args.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2012 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.
-
-#[feature(managed_boxes)];
-
-fn two_args<T>(x: T, y: T) { }
-
-fn main() {
-    let a: @mut int = @mut 3;
-    let b: @int = @3;
-
-    // NOTE:
-    //
-    // The fact that this test fails to compile reflects a known
-    // shortcoming of the current inference algorithm.  These errors
-    // are *not* desirable.
-
-    two_args(a, b); //~ ERROR (values differ in mutability)
-}
diff --git a/src/test/compile-fail/object-pointer-types.rs b/src/test/compile-fail/object-pointer-types.rs
index a1a577a1856..2270cb6f498 100644
--- a/src/test/compile-fail/object-pointer-types.rs
+++ b/src/test/compile-fail/object-pointer-types.rs
@@ -15,7 +15,6 @@ trait Foo {
     fn borrowed_mut(&mut self);
 
     fn managed(@self);
-    fn managed_mut(@mut self);
 
     fn owned(~self);
 }
@@ -24,7 +23,6 @@ fn borrowed_receiver(x: &Foo) {
     x.borrowed();
     x.borrowed_mut(); // See [1]
     x.managed(); //~ ERROR does not implement any method
-    x.managed_mut(); //~ ERROR does not implement any method
     x.owned(); //~ ERROR does not implement any method
 }
 
@@ -32,7 +30,6 @@ fn borrowed_mut_receiver(x: &mut Foo) {
     x.borrowed();
     x.borrowed_mut();
     x.managed(); //~ ERROR does not implement any method
-    x.managed_mut(); //~ ERROR does not implement any method
     x.owned(); //~ ERROR does not implement any method
 }
 
@@ -40,15 +37,6 @@ fn managed_receiver(x: @Foo) {
     x.borrowed();
     x.borrowed_mut(); // See [1]
     x.managed();
-    x.managed_mut();  //~ ERROR does not implement any method
-    x.owned(); //~ ERROR does not implement any method
-}
-
-fn managed_mut_receiver(x: @mut Foo) {
-    x.borrowed();
-    x.borrowed_mut();
-    x.managed();  //~ ERROR does not implement any method
-    x.managed_mut();
     x.owned(); //~ ERROR does not implement any method
 }
 
@@ -56,7 +44,6 @@ fn owned_receiver(x: ~Foo) {
     x.borrowed();
     x.borrowed_mut(); // See [1]
     x.managed();  //~ ERROR does not implement any method
-    x.managed_mut();  //~ ERROR does not implement any method
     x.owned();
 }
 
diff --git a/src/test/compile-fail/pinned-deep-copy.rs b/src/test/compile-fail/pinned-deep-copy.rs
index 6c19ef9700f..9c9b4a9f4d5 100644
--- a/src/test/compile-fail/pinned-deep-copy.rs
+++ b/src/test/compile-fail/pinned-deep-copy.rs
@@ -10,20 +10,22 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 struct r {
-  i: @mut int,
+  i: @Cell<int>,
 }
 
 #[unsafe_destructor]
 impl Drop for r {
     fn drop(&mut self) {
         unsafe {
-            *(self.i) = *(self.i) + 1;
+            self.i.set(self.i.get() + 1);
         }
     }
 }
 
-fn r(i: @mut int) -> r {
+fn r(i: @Cell<int>) -> r {
     r {
         i: i
     }
@@ -34,7 +36,7 @@ struct A {
 }
 
 fn main() {
-    let i = @mut 0;
+    let i = @Cell::new(0);
     {
         // Can't do this copy
         let x = ~~~A {y: r(i)};
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
index 6a6b8f95e63..b36933c4957 100644
--- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
+++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
@@ -11,7 +11,7 @@
 #[feature(managed_boxes)];
 
 struct invariant<'a> {
-    f: 'static |x: @mut &'a int|
+    f: 'static |x: &mut &'a int|
 }
 
 fn to_same_lifetime<'r>(bi: invariant<'r>) {
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
index 4210c52e7f6..449cbc6970f 100644
--- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
+++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
@@ -11,7 +11,7 @@
 #[feature(managed_boxes)];
 
 struct invariant<'a> {
-    f: 'static || -> @mut &'a int
+    f: 'static || -> &mut &'a int
 }
 
 fn to_same_lifetime<'r>(bi: invariant<'r>) {
diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs
index 9771fea04ef..c604e66507e 100644
--- a/src/test/compile-fail/unique-vec-res.rs
+++ b/src/test/compile-fail/unique-vec-res.rs
@@ -10,15 +10,17 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 struct r {
-  i: @mut int,
+  i: @Cell<int>,
 }
 
 #[unsafe_destructor]
 impl Drop for r {
     fn drop(&mut self) {
         unsafe {
-            *(self.i) = *(self.i) + 1;
+            self.i.set(self.i.get() + 1);
         }
     }
 }
@@ -27,12 +29,12 @@ fn f<T>(_i: ~[T], _j: ~[T]) {
 }
 
 fn main() {
-    let i1 = @mut 0;
-    let i2 = @mut 1;
+    let i1 = @Cell::new(0);
+    let i2 = @Cell::new(1);
     let r1 = ~[~r { i: i1 }];
     let r2 = ~[~r { i: i2 }];
     f(r1.clone(), r2.clone());
     //~^ ERROR failed to find an implementation of
-    info!("{:?}", (r2, *i1));
-    info!("{:?}", (r1, *i2));
+    info!("{:?}", (r2, i1.get()));
+    info!("{:?}", (r1, i2.get()));
 }
diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs
index 8d6eaef8b34..3f789fa456a 100644
--- a/src/test/pretty/block-disambig.rs
+++ b/src/test/pretty/block-disambig.rs
@@ -14,6 +14,8 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 fn test1() { let val = @0; { } *val; }
 
 fn test2() -> int { let val = @0; { } *val }
@@ -21,9 +23,9 @@ fn test2() -> int { let val = @0; { } *val }
 struct S { eax: int }
 
 fn test3() {
-    let regs = @mut S {eax: 0};
+    let regs = @Cell::new(S {eax: 0});
     match true { true => { } _ => { } }
-    (*regs).eax = 1;
+    regs.set(S {eax: 1});
 }
 
 fn test4() -> bool { let regs = @true; if true { } *regs || false }
@@ -51,10 +53,13 @@ fn test8() -> int {
     }
 }
 
-fn test9() { let regs = @mut 0; match true { true => { } _ => { } } *regs += 1; }
+fn test9() {
+    let regs = @Cell::new(0);
+    match true { true => { } _ => { } } regs.set(regs.get() + 1);
+}
 
 fn test10() -> int {
-    let regs = @mut ~[0];
+    let regs = @~[0];
     match true { true => { } _ => { } }
     (*regs)[0]
 }
diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs
index b87303467ce..09e7d0bc28c 100644
--- a/src/test/run-fail/unwind-misc-1.rs
+++ b/src/test/run-fail/unwind-misc-1.rs
@@ -14,7 +14,7 @@
 #[feature(managed_boxes)];
 
 fn main() {
-    let _count = @mut 0u;
+    let _count = @0u;
     let mut map = std::hashmap::HashMap::new();
     let mut arr = ~[];
     for _i in range(0u, 10u) {
diff --git a/src/test/run-pass/alignment-gep-tup-like-2.rs b/src/test/run-pass/alignment-gep-tup-like-2.rs
index 8f7f8c4fa58..02ce1fd4b26 100644
--- a/src/test/run-pass/alignment-gep-tup-like-2.rs
+++ b/src/test/run-pass/alignment-gep-tup-like-2.rs
@@ -10,6 +10,8 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
+
 struct Pair<A,B> {
     a: A, b: B
 }
@@ -17,12 +19,15 @@ struct Pair<A,B> {
 struct RecEnum<A>(Rec<A>);
 struct Rec<A> {
     val: A,
-    rec: Option<@mut RecEnum<A>>
+    rec: Option<@RefCell<RecEnum<A>>>
 }
 
 fn make_cycle<A:'static>(a: A) {
-    let g: @mut RecEnum<A> = @mut RecEnum(Rec {val: a, rec: None});
-    g.rec = Some(g);
+    let g: @RefCell<RecEnum<A>> = @RefCell::new(RecEnum(Rec {val: a, rec: None}));
+    {
+        let mut gb = g.borrow_mut();
+        gb.get().rec = Some(g);
+    }
 }
 
 struct Invoker<A,B> {
diff --git a/src/test/run-pass/auto-encode.rs b/src/test/run-pass/auto-encode.rs
index 1810f33eadb..8058556a469 100644
--- a/src/test/run-pass/auto-encode.rs
+++ b/src/test/run-pass/auto-encode.rs
@@ -35,8 +35,8 @@ fn test_ebml<'a, A:
     Encodable<EBWriter::Encoder> +
     Decodable<EBReader::Decoder<'a>>
 >(a1: &A) {
-    let mut wr = @mut std::io::mem::MemWriter::new();
-    let mut ebml_w = EBWriter::Encoder(wr);
+    let mut wr = std::io::mem::MemWriter::new();
+    let mut ebml_w = EBWriter::Encoder(&mut wr);
     a1.encode(&mut ebml_w);
     let bytes = wr.inner_ref().as_slice();
 
diff --git a/src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs b/src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs
index 3f6bcb4d5b7..8871035908b 100644
--- a/src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs
+++ b/src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs
@@ -12,15 +12,18 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
+
 pub fn main() {
-    let x: @mut @Option<~int> = @mut @None;
-    match x {
-      @@Some(ref _y) => {
+    let x: @RefCell<@Option<~int>> = @RefCell::new(@None);
+    let mut xb = x.borrow_mut();
+    match *xb.get() {
+      @Some(ref _y) => {
         // here, the refcount of `*x` is bumped so
         // `_y` remains valid even if `*x` is modified.
-        *x = @None;
+        *xb.get() = @None;
       }
-      @@None => {
+      @None => {
         // here, no bump of the ref count of `*x` is needed, but in
         // fact a bump occurs anyway because of how pattern marching
         // works.
diff --git a/src/test/run-pass/borrowck-preserve-box-in-pat.rs b/src/test/run-pass/borrowck-preserve-box-in-pat.rs
index 2fd2c689a3c..b333bcae582 100644
--- a/src/test/run-pass/borrowck-preserve-box-in-pat.rs
+++ b/src/test/run-pass/borrowck-preserve-box-in-pat.rs
@@ -12,23 +12,25 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
 use std::ptr;
 
 struct F { f: ~int }
 
 pub fn main() {
-    let x = @mut @F {f: ~3};
-    match x {
-      @@F{f: ref b_x} => {
+    let x = @RefCell::new(@F {f: ~3});
+    let mut xb = x.borrow_mut();
+    match *xb.get() {
+      @F{f: ref b_x} => {
         assert_eq!(**b_x, 3);
-        assert_eq!(ptr::to_unsafe_ptr(&(x.f)), ptr::to_unsafe_ptr(b_x));
+        assert_eq!(ptr::to_unsafe_ptr(&(xb.get().f)), ptr::to_unsafe_ptr(b_x));
 
-        *x = @F {f: ~4};
+        *xb.get() = @F {f: ~4};
 
         info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
                ptr::to_unsafe_ptr(&(**b_x)) as uint);
         assert_eq!(**b_x, 3);
-        assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(**b_x)));
+        assert!(ptr::to_unsafe_ptr(&(*xb.get().f)) != ptr::to_unsafe_ptr(&(**b_x)));
       }
     }
 }
diff --git a/src/test/run-pass/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck-univariant-enum.rs
index aaa08ea49b3..97d92f421c1 100644
--- a/src/test/run-pass/borrowck-univariant-enum.rs
+++ b/src/test/run-pass/borrowck-univariant-enum.rs
@@ -10,6 +10,8 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 enum newtype {
     newtype(int)
 }
@@ -19,12 +21,12 @@ pub fn main() {
     // Test that borrowck treats enums with a single variant
     // specially.
 
-    let x = @mut 5;
-    let y = @mut newtype(3);
-    let z = match *y {
+    let x = @Cell::new(5);
+    let y = @Cell::new(newtype(3));
+    let z = match y.get() {
       newtype(b) => {
-        *x += 1;
-        *x * b
+        x.set(x.get() + 1);
+        x.get() * b
       }
     };
     assert_eq!(z, 18);
diff --git a/src/test/run-pass/cast-mutable-trait.rs b/src/test/run-pass/cast-mutable-trait.rs
deleted file mode 100644
index 09d10502b84..00000000000
--- a/src/test/run-pass/cast-mutable-trait.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.
-
-#[feature(managed_boxes)];
-
-trait T {
-    fn foo(@mut self);
-}
-
-struct S {
-    unused: int
-}
-
-impl T for S {
-    fn foo(@mut self) {
-    }
-}
-
-fn bar(t: @mut T) {
-    t.foo();
-}
-
-pub fn main() {
-    let s = @mut S { unused: 0 };
-    let s2 = s as @mut T;
-    s2.foo();
-    bar(s2);
-    bar(s as @mut T);
-}
diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs
index e44d7c41931..8c142768944 100644
--- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs
+++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs
@@ -11,86 +11,92 @@
 #[feature(managed_boxes)];
 
 trait noisy {
-  fn speak(&self) -> int;
+  fn speak(&mut self) -> int;
 }
 
 struct dog {
-  priv barks : @mut uint,
+  priv barks: uint,
 
-  volume : @mut int,
+  volume: int,
 }
 
 impl dog {
-    fn bark(&self) -> int {
-      info!("Woof {} {}", *self.barks, *self.volume);
-      *self.barks += 1u;
-      if *self.barks % 3u == 0u {
-          *self.volume += 1;
+    fn bark(&mut self) -> int {
+      info!("Woof {} {}", self.barks, self.volume);
+      self.barks += 1u;
+      if self.barks % 3u == 0u {
+          self.volume += 1;
       }
-      if *self.barks % 10u == 0u {
-          *self.volume -= 2;
+      if self.barks % 10u == 0u {
+          self.volume -= 2;
       }
-      info!("Grrr {} {}", *self.barks, *self.volume);
-      *self.volume
+      info!("Grrr {} {}", self.barks, self.volume);
+      self.volume
     }
 }
 
 impl noisy for dog {
-  fn speak(&self) -> int { self.bark() }
+    fn speak(&mut self) -> int {
+        self.bark()
+    }
 }
 
 fn dog() -> dog {
     dog {
-        volume: @mut 0,
-        barks: @mut 0u
+        volume: 0,
+        barks: 0u
     }
 }
 
 #[deriving(Clone)]
 struct cat {
-  priv meows : @mut uint,
+  priv meows: uint,
 
-  how_hungry : @mut int,
-  name : ~str,
+  how_hungry: int,
+  name: ~str,
 }
 
 impl noisy for cat {
-  fn speak(&self) -> int { self.meow() as int }
+    fn speak(&mut self) -> int {
+        self.meow() as int
+    }
 }
 
 impl cat {
-  pub fn meow_count(&self) -> uint { *self.meows }
+    pub fn meow_count(&self) -> uint {
+        self.meows
+    }
 }
 
 impl cat {
-    fn meow(&self) -> uint {
-      info!("Meow");
-      *self.meows += 1u;
-      if *self.meows % 5u == 0u {
-          *self.how_hungry += 1;
-      }
-      *self.meows
+    fn meow(&mut self) -> uint {
+        info!("Meow");
+        self.meows += 1u;
+        if self.meows % 5u == 0u {
+            self.how_hungry += 1;
+        }
+        self.meows
     }
 }
 
-fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
+fn cat(in_x: uint, in_y: int, in_name: ~str) -> cat {
     cat {
-        meows: @mut in_x,
-        how_hungry: @mut in_y,
+        meows: in_x,
+        how_hungry: in_y,
         name: in_name
     }
 }
 
 
-fn annoy_neighbors(critter: @noisy) {
+fn annoy_neighbors(critter: &mut noisy) {
     for _i in range(0u, 10) { critter.speak(); }
 }
 
 pub fn main() {
-  let nyan : cat  = cat(0u, 2, ~"nyan");
-  let whitefang : dog = dog();
-  annoy_neighbors(@nyan.clone() as @noisy);
-  annoy_neighbors(@whitefang as @noisy);
+  let mut nyan: cat = cat(0u, 2, ~"nyan");
+  let mut whitefang: dog = dog();
+  annoy_neighbors(&mut nyan);
+  annoy_neighbors(&mut whitefang);
   assert_eq!(nyan.meow_count(), 10u);
-  assert_eq!(*whitefang.volume, 1);
+  assert_eq!(whitefang.volume, 1);
 }
diff --git a/src/test/run-pass/class-cast-to-trait.rs b/src/test/run-pass/class-cast-to-trait.rs
index cc723f8037d..86764df6ae0 100644
--- a/src/test/run-pass/class-cast-to-trait.rs
+++ b/src/test/run-pass/class-cast-to-trait.rs
@@ -58,6 +58,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
 
 
 pub fn main() {
-  let nyan: @mut noisy = @mut cat(0u, 2, ~"nyan") as @mut noisy;
-  nyan.speak();
+    let mut nyan = cat(0u, 2, ~"nyan");
+    let mut nyan: &mut noisy = &mut nyan;
+    nyan.speak();
 }
diff --git a/src/test/run-pass/cycle-collection.rs b/src/test/run-pass/cycle-collection.rs
index 29a972ae30e..ca1e18eb87b 100644
--- a/src/test/run-pass/cycle-collection.rs
+++ b/src/test/run-pass/cycle-collection.rs
@@ -10,14 +10,16 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
+
 enum taggy {
-    cons(@mut taggy),
+    cons(@RefCell<taggy>),
     nil,
 }
 
 fn f() {
-    let a_box = @mut nil;
-    *a_box = cons(a_box);
+    let a_box = @RefCell::new(nil);
+    a_box.set(cons(a_box));
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/cycle-collection2.rs b/src/test/run-pass/cycle-collection2.rs
deleted file mode 100644
index f10592bf800..00000000000
--- a/src/test/run-pass/cycle-collection2.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2012 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.
-
-#[feature(managed_boxes)];
-
-struct foo {
-    z: Option<@Invokable>,
-}
-
-struct Thing {
-    w: @mut foo,
-}
-
-trait Invokable {
-    fn f(&self);
-}
-
-impl Invokable for Thing {
-    fn f(&self) {
-        nop_foo(self.w);
-    }
-}
-
-fn nop() { }
-fn nop_foo(_x : @mut foo) { }
-
-pub fn main() {
-    let w = @mut foo {
-        z: None,
-    };
-    let x = @Thing {
-        w: w,
-    } as @Invokable;
-    w.z = Some(x);
-}
diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs
index 997e2f03abd..914805c126f 100644
--- a/src/test/run-pass/deref-lval.rs
+++ b/src/test/run-pass/deref-lval.rs
@@ -10,4 +10,10 @@
 
 #[feature(managed_boxes)];
 
-pub fn main() { let x = @mut 5; *x = 1000; info!("{:?}", *x); }
+use std::cell::Cell;
+
+pub fn main() {
+    let x = @Cell::new(5);
+    x.set(1000);
+    info!("{:?}", x.get());
+}
diff --git a/src/test/run-pass/deriving-encodable-decodable.rs b/src/test/run-pass/deriving-encodable-decodable.rs
index 4f4e9c9ce00..9194304a376 100644
--- a/src/test/run-pass/deriving-encodable-decodable.rs
+++ b/src/test/run-pass/deriving-encodable-decodable.rs
@@ -58,8 +58,8 @@ struct G<T> {
 fn roundtrip<'a, T: Rand + Eq + Encodable<Encoder> +
                     Decodable<Decoder<'a>>>() {
     let obj: T = random();
-    let w = @mut MemWriter::new();
-    let mut e = Encoder(w);
+    let mut w = MemWriter::new();
+    let mut e = Encoder(&mut w);
     obj.encode(&mut e);
     let doc = ebml::reader::Doc(@w.inner_ref().to_owned());
     let mut dec = Decoder(doc);
diff --git a/src/test/run-pass/deriving-zero.rs b/src/test/run-pass/deriving-zero.rs
index 0cff8e8a3f8..d28e54d57ad 100644
--- a/src/test/run-pass/deriving-zero.rs
+++ b/src/test/run-pass/deriving-zero.rs
@@ -30,7 +30,7 @@ struct Lots {
     e: char,
     f: f64,
     g: (f32, char),
-    h: @mut (int, int),
+    h: @(int, int),
     i: bool,
     j: (),
 }
diff --git a/src/test/run-pass/explicit-self-closures.rs b/src/test/run-pass/explicit-self-closures.rs
index ce662bafd49..c7e5681c0c1 100644
--- a/src/test/run-pass/explicit-self-closures.rs
+++ b/src/test/run-pass/explicit-self-closures.rs
@@ -18,9 +18,6 @@ impl Box {
     pub fn set_many(&mut self, xs: &[uint]) {
         for x in xs.iter() { self.x = *x; }
     }
-    pub fn set_many2(@mut self, xs: &[uint]) {
-        for x in xs.iter() { self.x = *x; }
-    }
 }
 
 pub fn main() {}
diff --git a/src/test/run-pass/expr-repeat-vstore.rs b/src/test/run-pass/expr-repeat-vstore.rs
index 2831740deaf..e1be481099c 100644
--- a/src/test/run-pass/expr-repeat-vstore.rs
+++ b/src/test/run-pass/expr-repeat-vstore.rs
@@ -13,10 +13,4 @@ pub fn main() {
     println(v[2].to_str());
     println(v[3].to_str());
     println(v[4].to_str());
-    let v: @mut [int] = @mut [ 3, ..5 ];
-    println((v[0]).to_str());
-    println((v[1]).to_str());
-    println((v[2]).to_str());
-    println((v[3]).to_str());
-    println((v[4]).to_str());
 }
diff --git a/src/test/run-pass/exterior.rs b/src/test/run-pass/exterior.rs
index 27f30fb8ba9..d9505e01de9 100644
--- a/src/test/run-pass/exterior.rs
+++ b/src/test/run-pass/exterior.rs
@@ -10,15 +10,21 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 struct Point {x: int, y: int, z: int}
 
-fn f(p: @mut Point) { assert!((p.z == 12)); p.z = 13; assert!((p.z == 13)); }
+fn f(p: @Cell<Point>) {
+    assert!((p.get().z == 12));
+    p.set(Point {x: 10, y: 11, z: 13});
+    assert!((p.get().z == 13));
+}
 
 pub fn main() {
     let a: Point = Point {x: 10, y: 11, z: 12};
-    let b: @mut Point = @mut a;
-    assert_eq!(b.z, 12);
+    let b: @Cell<Point> = @Cell::new(a);
+    assert_eq!(b.get().z, 12);
     f(b);
     assert_eq!(a.z, 12);
-    assert_eq!(b.z, 13);
+    assert_eq!(b.get().z, 13);
 }
diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs
index 49aa8d18e90..905fa42635b 100644
--- a/src/test/run-pass/hashmap-memory.rs
+++ b/src/test/run-pass/hashmap-memory.rs
@@ -40,7 +40,7 @@ mod map_reduce {
     }
 
     fn map_task(ctrl: SharedChan<ctrl_proto>, input: ~str) {
-        let intermediates = @mut HashMap::new();
+        let mut intermediates = HashMap::new();
 
         fn emit(im: &mut HashMap<~str, int>,
                 ctrl: SharedChan<ctrl_proto>, key: ~str,
@@ -58,7 +58,7 @@ mod map_reduce {
         }
 
         let ctrl_clone = ctrl.clone();
-        ::map(input, |a,b| emit(intermediates, ctrl.clone(), a, b) );
+        ::map(input, |a,b| emit(&mut intermediates, ctrl.clone(), a, b) );
         ctrl_clone.send(mapper_done);
     }
 
diff --git a/src/test/run-pass/init-res-into-things.rs b/src/test/run-pass/init-res-into-things.rs
index 5181ec6f71d..ede67275ba9 100644
--- a/src/test/run-pass/init-res-into-things.rs
+++ b/src/test/run-pass/init-res-into-things.rs
@@ -10,11 +10,13 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 // Resources can't be copied, but storing into data structures counts
 // as a move unless the stored thing is used afterwards.
 
 struct r {
-  i: @mut int,
+    i: @Cell<int>,
 }
 
 struct Box { x: r }
@@ -22,30 +24,30 @@ struct Box { x: r }
 #[unsafe_destructor]
 impl Drop for r {
     fn drop(&mut self) {
-        *(self.i) = *(self.i) + 1;
+        self.i.set(self.i.get() + 1)
     }
 }
 
-fn r(i: @mut int) -> r {
+fn r(i: @Cell<int>) -> r {
     r {
         i: i
     }
 }
 
 fn test_box() {
-    let i = @mut 0;
+    let i = @Cell::new(0);
     {
         let _a = @r(i);
     }
-    assert_eq!(*i, 1);
+    assert_eq!(i.get(), 1);
 }
 
 fn test_rec() {
-    let i = @mut 0;
+    let i = @Cell::new(0);
     {
         let _a = Box {x: r(i)};
     }
-    assert_eq!(*i, 1);
+    assert_eq!(i.get(), 1);
 }
 
 fn test_tag() {
@@ -53,37 +55,37 @@ fn test_tag() {
         t0(r),
     }
 
-    let i = @mut 0;
+    let i = @Cell::new(0);
     {
         let _a = t0(r(i));
     }
-    assert_eq!(*i, 1);
+    assert_eq!(i.get(), 1);
 }
 
 fn test_tup() {
-    let i = @mut 0;
+    let i = @Cell::new(0);
     {
         let _a = (r(i), 0);
     }
-    assert_eq!(*i, 1);
+    assert_eq!(i.get(), 1);
 }
 
 fn test_unique() {
-    let i = @mut 0;
+    let i = @Cell::new(0);
     {
         let _a = ~r(i);
     }
-    assert_eq!(*i, 1);
+    assert_eq!(i.get(), 1);
 }
 
 fn test_box_rec() {
-    let i = @mut 0;
+    let i = @Cell::new(0);
     {
         let _a = @Box {
             x: r(i)
         };
     }
-    assert_eq!(*i, 1);
+    assert_eq!(i.get(), 1);
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/issue-2631-b.rs b/src/test/run-pass/issue-2631-b.rs
index bc76fa74dbd..dc46bef4ed4 100644
--- a/src/test/run-pass/issue-2631-b.rs
+++ b/src/test/run-pass/issue-2631-b.rs
@@ -16,11 +16,12 @@
 extern mod req;
 
 use req::request;
+use std::cell::RefCell;
 use std::hashmap::HashMap;
 
 pub fn main() {
   let v = ~[@~"hi"];
   let mut m: req::header_map = HashMap::new();
-  m.insert(~"METHOD", @mut v);
+  m.insert(~"METHOD", @RefCell::new(v));
   request::<int>(&m);
 }
diff --git a/src/test/run-pass/issue-2735-2.rs b/src/test/run-pass/issue-2735-2.rs
index 85b6e80be7c..44222315dcd 100644
--- a/src/test/run-pass/issue-2735-2.rs
+++ b/src/test/run-pass/issue-2735-2.rs
@@ -10,26 +10,28 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 // This test should behave exactly like issue-2735-3
 struct defer {
-    b: @mut bool,
+    b: @Cell<bool>,
 }
 
 #[unsafe_destructor]
 impl Drop for defer {
     fn drop(&mut self) {
-        *self.b = true;
+        self.b.set(true);
     }
 }
 
-fn defer(b: @mut bool) -> defer {
+fn defer(b: @Cell<bool>) -> defer {
     defer {
         b: b
     }
 }
 
 pub fn main() {
-    let dtor_ran = @mut false;
+    let dtor_ran = @Cell::new(false);
     let _  = defer(dtor_ran);
-    assert!(*dtor_ran);
+    assert!(dtor_ran.get());
 }
diff --git a/src/test/run-pass/issue-2735-3.rs b/src/test/run-pass/issue-2735-3.rs
index 401a43f8b25..f48e763966b 100644
--- a/src/test/run-pass/issue-2735-3.rs
+++ b/src/test/run-pass/issue-2735-3.rs
@@ -10,26 +10,28 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 // This test should behave exactly like issue-2735-2
 struct defer {
-    b: @mut bool,
+    b: @Cell<bool>,
 }
 
 #[unsafe_destructor]
 impl Drop for defer {
     fn drop(&mut self) {
-        *self.b = true;
+        self.b.set(true);
     }
 }
 
-fn defer(b: @mut bool) -> defer {
+fn defer(b: @Cell<bool>) -> defer {
     defer {
         b: b
     }
 }
 
 pub fn main() {
-    let dtor_ran = @mut false;
+    let dtor_ran = @Cell::new(false);
     defer(dtor_ran);
-    assert!(*dtor_ran);
+    assert!(dtor_ran.get());
 }
diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs
index 5208995a0c7..dc2f59f1481 100644
--- a/src/test/run-pass/issue-2904.rs
+++ b/src/test/run-pass/issue-2904.rs
@@ -62,8 +62,8 @@ fn square_from_char(c: char) -> square {
     }
 }
 
-fn read_board_grid<rdr:'static + io::Reader>(input: rdr) -> ~[~[square]] {
-    let input = @mut input as @mut io::Reader;
+fn read_board_grid<rdr:'static + io::Reader>(mut input: rdr) -> ~[~[square]] {
+    let mut input: &mut io::Reader = &mut input;
     let mut grid = ~[];
     let mut line = [0, ..10];
     input.read(line);
diff --git a/src/test/run-pass/issue-3447.rs b/src/test/run-pass/issue-3447.rs
index 7ae3e43c579..3d56abb3de6 100644
--- a/src/test/run-pass/issue-3447.rs
+++ b/src/test/run-pass/issue-3447.rs
@@ -10,11 +10,13 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
+
 static S: &'static str = "str";
 
 struct list<T> {
     element: T,
-    next: Option<@mut list<T>>
+    next: Option<@RefCell<list<T>>>
 }
 
 impl<T:'static> list<T> {
@@ -24,7 +26,7 @@ impl<T:'static> list<T> {
             next: None
         };
 
-        self.next = Some(@mut newList);
+        self.next = Some(@RefCell::new(newList));
     }
 }
 
diff --git a/src/test/run-pass/issue-3860.rs b/src/test/run-pass/issue-3860.rs
deleted file mode 100644
index 8a30cc96748..00000000000
--- a/src/test/run-pass/issue-3860.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2012 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.
-
-#[feature(managed_boxes)];
-
-struct Foo { x: int }
-
-impl Foo {
-    pub fn stuff<'a>(&'a mut self) -> &'a mut Foo {
-        return self;
-    }
-}
-
-pub fn main() {
-    let x = @mut Foo { x: 3 };
-    // Neither of the next two lines should cause an error
-    let _ = x.stuff();
-    x.stuff();
-}
diff --git a/src/test/run-pass/issue-5275.rs b/src/test/run-pass/issue-5275.rs
deleted file mode 100644
index 088376c1068..00000000000
--- a/src/test/run-pass/issue-5275.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.
-
-#[feature(managed_boxes)];
-
-// Regression test for issue #5275
-
-fn foo(self_: &A) -> int {
-    if true {
-        fail!()
-    } else {
-        *bar(self_.bar)
-    }
-}
-
-fn bar<'r>(_: &'r mut int) -> &'r int {
-    fail!()
-}
-
-struct A {
-    bar: @mut int,
-}
-
-pub fn main() {}
diff --git a/src/test/run-pass/issue-5517.rs b/src/test/run-pass/issue-5517.rs
deleted file mode 100644
index a5c318a20f4..00000000000
--- a/src/test/run-pass/issue-5517.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-#[feature(managed_boxes)];
-
-pub fn main() {
-    let box1 = @mut 42;
-    let _x = *(&mut *box1) == 42 || *(&mut *box1) == 31337;
-}
diff --git a/src/test/run-pass/issue-979.rs b/src/test/run-pass/issue-979.rs
index 08d8abc1d50..ca83e783268 100644
--- a/src/test/run-pass/issue-979.rs
+++ b/src/test/run-pass/issue-979.rs
@@ -10,28 +10,30 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 struct r {
-  b: @mut int,
+    b: @Cell<int>,
 }
 
 #[unsafe_destructor]
 impl Drop for r {
     fn drop(&mut self) {
-        *(self.b) += 1;
+        self.b.set(self.b.get() + 1);
     }
 }
 
-fn r(b: @mut int) -> r {
+fn r(b: @Cell<int>) -> r {
     r {
         b: b
     }
 }
 
 pub fn main() {
-    let b = @mut 0;
+    let b = @Cell::new(0);
     {
         let _p = Some(r(b));
     }
 
-    assert_eq!(*b, 1);
+    assert_eq!(b.get(), 1);
 }
diff --git a/src/test/run-pass/issue-980.rs b/src/test/run-pass/issue-980.rs
index 2f94dc77690..f6dc4adcf9b 100644
--- a/src/test/run-pass/issue-980.rs
+++ b/src/test/run-pass/issue-980.rs
@@ -10,16 +10,20 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
+
 enum maybe_pointy {
     no_pointy,
-    yes_pointy(@mut Pointy),
+    yes_pointy(@RefCell<Pointy>),
 }
 
 struct Pointy {
-    x : maybe_pointy
+    x: maybe_pointy
 }
 
 pub fn main() {
-    let m = @mut Pointy { x : no_pointy };
-    m.x = yes_pointy(m);
+    let m = @RefCell::new(Pointy { x : no_pointy });
+    m.set(Pointy {
+        x: yes_pointy(m)
+    });
 }
diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs
index a499c148025..65f95f78ea8 100644
--- a/src/test/run-pass/lambda-infer-unresolved.rs
+++ b/src/test/run-pass/lambda-infer-unresolved.rs
@@ -11,12 +11,10 @@
 // This should typecheck even though the type of e is not fully
 // resolved when we finish typechecking the ||.
 
-#[feature(managed_boxes)];
-
 struct Refs { refs: ~[int], n: int }
 
 pub fn main() {
-    let e = @mut Refs{refs: ~[], n: 0};
+    let mut e = Refs{refs: ~[], n: 0};
     let _f: || = || error!("{}", e.n);
     e.refs.push(1);
 }
diff --git a/src/test/run-pass/log-linearized.rs b/src/test/run-pass/log-linearized.rs
deleted file mode 100644
index e4dd3b56fca..00000000000
--- a/src/test/run-pass/log-linearized.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 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.
-
-#[feature(managed_boxes)];
-
-// Tests that shapes respect linearize_ty_params().
-
-enum option<T> {
-    none,
-    some(T),
-}
-
-struct Smallintmap<T> {v: ~[option<T>]}
-
-struct V<T> { v: ~[option<T>] }
-
-fn mk<T:'static>() -> @mut Smallintmap<T> {
-    let v: ~[option<T>] = ~[];
-    return @mut Smallintmap {v: v};
-}
-
-fn f<T,U:'static>() {
-    let sim = mk::<U>();
-    error!("{:?}", sim);
-}
-
-pub fn main() {
-    f::<int,int>();
-}
diff --git a/src/test/run-pass/logging-only-prints-once.rs b/src/test/run-pass/logging-only-prints-once.rs
index 6a88b804c22..fb352ea0708 100644
--- a/src/test/run-pass/logging-only-prints-once.rs
+++ b/src/test/run-pass/logging-only-prints-once.rs
@@ -11,25 +11,24 @@
 // xfail-fast
 // exec-env:RUST_LOG=debug
 
-#[feature(managed_boxes)];
-
+use std::cell::Cell;
 use std::fmt;
 
-struct Foo(@mut int);
+struct Foo(Cell<int>);
 
 impl fmt::Default for Foo {
     fn fmt(f: &Foo, _fmt: &mut fmt::Formatter) {
-        assert!(***f == 0);
-        ***f = 1;
+        assert!(f.get() == 0);
+        f.set(1);
     }
 }
 
 pub fn main() {
     let (p,c) = Chan::new();
     do spawn {
-        let f = Foo(@mut 0);
+        let mut f = Foo(Cell::new(0));
         debug!("{}", f);
-        assert!(**f == 1);
+        assert!(f.get() == 1);
         c.send(());
     }
     p.recv();
diff --git a/src/test/run-pass/mlist-cycle.rs b/src/test/run-pass/mlist-cycle.rs
deleted file mode 100644
index 66e7fc4265b..00000000000
--- a/src/test/run-pass/mlist-cycle.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2012 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.
-
-// xfail-test
-extern mod std;
-use std::gc;
-use std::gc::rustrt;
-
-struct cell {c: @list}
-
-enum list { link(@mut cell), nil, }
-
-pub fn main() {
-    let first: @cell = @mut cell{c: @nil()};
-    let second: @cell = @mut cell{c: @link(first)};
-    first._0 = @link(second);
-    rustrt::gc();
-    let third: @cell = @mut cell{c: @nil()};
-}
diff --git a/src/test/run-pass/new-vstore-mut-box-syntax.rs b/src/test/run-pass/new-vstore-mut-box-syntax.rs
deleted file mode 100644
index 4a2756f5446..00000000000
--- a/src/test/run-pass/new-vstore-mut-box-syntax.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2012 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.
-
-#[feature(managed_boxes)];
-
-pub fn main() {
-    let _x: @mut [int] = @mut [ 1, 2, 3 ];
-
-}
diff --git a/src/test/run-pass/newtype-struct-drop-run.rs b/src/test/run-pass/newtype-struct-drop-run.rs
index 8d1333941f7..f190a5102d2 100644
--- a/src/test/run-pass/newtype-struct-drop-run.rs
+++ b/src/test/run-pass/newtype-struct-drop-run.rs
@@ -12,19 +12,21 @@
 
 // Make sure the destructor is run for newtype structs.
 
-struct Foo(@mut int);
+use std::cell::Cell;
+
+struct Foo(@Cell<int>);
 
 #[unsafe_destructor]
 impl Drop for Foo {
     fn drop(&mut self) {
-        ***self = 23;
+        self.set(23);
     }
 }
 
 pub fn main() {
-    let y = @mut 32;
+    let y = @Cell::new(32);
     {
         let _x = Foo(y);
     }
-    assert_eq!(*y, 23);
+    assert_eq!(y.get(), 23);
 }
diff --git a/src/test/run-pass/objects-coerce-from-managed-to-borrowed.rs b/src/test/run-pass/objects-coerce-from-managed-to-borrowed.rs
index f0955ab8efa..52792c8c427 100644
--- a/src/test/run-pass/objects-coerce-from-managed-to-borrowed.rs
+++ b/src/test/run-pass/objects-coerce-from-managed-to-borrowed.rs
@@ -14,24 +14,12 @@
 
 trait Foo {
     fn foo(&self) -> uint;
-    fn bar(&mut self) -> uint;
 }
 
 impl Foo for uint {
     fn foo(&self) -> uint {
         *self
     }
-
-    fn bar(&mut self) -> uint {
-        *self += 1;
-        *self
-    }
-}
-
-fn do_it_mut(obj: &mut Foo) {
-    let x = obj.bar();
-    let y = obj.foo();
-    assert_eq!(x, y);
 }
 
 fn do_it_imm(obj: &Foo, v: uint) {
@@ -40,7 +28,6 @@ fn do_it_imm(obj: &Foo, v: uint) {
 }
 
 pub fn main() {
-    let x = @mut 22u as @mut Foo;
-    do_it_mut(x);
-    do_it_imm(x, 23u);
+    let x = @22u as @Foo;
+    do_it_imm(x, 22u);
 }
diff --git a/src/test/run-pass/option-unwrap.rs b/src/test/run-pass/option-unwrap.rs
index ab9d5b9d2bf..0806bcd185e 100644
--- a/src/test/run-pass/option-unwrap.rs
+++ b/src/test/run-pass/option-unwrap.rs
@@ -10,16 +10,17 @@
 
 #[feature(managed_boxes)];
 
-struct dtor {
-    x: @mut int,
+use std::cell::Cell;
 
+struct dtor {
+    x: @Cell<int>,
 }
 
 #[unsafe_destructor]
 impl Drop for dtor {
     fn drop(&mut self) {
         // abuse access to shared mutable state to write this code
-        *self.x -= 1;
+        self.x.set(self.x.get() - 1);
     }
 }
 
@@ -31,12 +32,12 @@ fn unwrap<T>(o: Option<T>) -> T {
 }
 
 pub fn main() {
-    let x = @mut 1;
+    let x = @Cell::new(1);
 
     {
         let b = Some(dtor { x:x });
         let _c = unwrap(b);
     }
 
-    assert_eq!(*x, 0);
+    assert_eq!(x.get(), 0);
 }
diff --git a/src/test/run-pass/packed-struct-generic-size.rs b/src/test/run-pass/packed-struct-generic-size.rs
index 1d3d8cf736f..cba923ef646 100644
--- a/src/test/run-pass/packed-struct-generic-size.rs
+++ b/src/test/run-pass/packed-struct-generic-size.rs
@@ -22,6 +22,6 @@ pub fn main() {
 
     assert_eq!(mem::size_of::<S<u64, u16>>(), 11);
 
-    assert_eq!(mem::size_of::<S<~str, @mut [int]>>(),
-               1 + mem::size_of::<~str>() + mem::size_of::<@mut [int]>());
+    assert_eq!(mem::size_of::<S<~str, @[int]>>(),
+               1 + mem::size_of::<~str>() + mem::size_of::<@[int]>());
 }
diff --git a/src/test/run-pass/packed-struct-size.rs b/src/test/run-pass/packed-struct-size.rs
index c6550f24d5c..f694cc98ad3 100644
--- a/src/test/run-pass/packed-struct-size.rs
+++ b/src/test/run-pass/packed-struct-size.rs
@@ -49,7 +49,7 @@ struct S7_Option {
     a: f32,
     b: u8,
     c: u16,
-    d: Option<@mut f64>
+    d: Option<@f64>
 }
 
 // Placing packed structs in statics should work
@@ -63,5 +63,5 @@ pub fn main() {
     assert_eq!(mem::size_of::<S5>(), 5);
     assert_eq!(mem::size_of::<S13_str>(), 13 + mem::size_of::<~str>());
     assert_eq!(mem::size_of::<S3_Foo>(), 3 + mem::size_of::<Foo>());
-    assert_eq!(mem::size_of::<S7_Option>(), 7 + mem::size_of::<Option<@mut f64>>());
+    assert_eq!(mem::size_of::<S7_Option>(), 7 + mem::size_of::<Option<@f64>>());
 }
diff --git a/src/test/run-pass/packed-tuple-struct-size.rs b/src/test/run-pass/packed-tuple-struct-size.rs
index ad83de6ef48..7d2be73edc3 100644
--- a/src/test/run-pass/packed-tuple-struct-size.rs
+++ b/src/test/run-pass/packed-tuple-struct-size.rs
@@ -30,7 +30,7 @@ enum Foo {
 struct S3_Foo(u8, u16, Foo);
 
 #[packed]
-struct S7_Option(f32, u8, u16, Option<@mut f64>);
+struct S7_Option(f32, u8, u16, Option<@f64>);
 
 pub fn main() {
     assert_eq!(mem::size_of::<S4>(), 4);
@@ -44,5 +44,5 @@ pub fn main() {
                3 + mem::size_of::<Foo>());
 
     assert_eq!(mem::size_of::<S7_Option>(),
-              7 + mem::size_of::<Option<@mut f64>>());
+              7 + mem::size_of::<Option<@f64>>());
 }
diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs
index d6d015d4785..8c1be0a6219 100644
--- a/src/test/run-pass/rcvr-borrowed-to-region.rs
+++ b/src/test/run-pass/rcvr-borrowed-to-region.rs
@@ -24,7 +24,7 @@ impl<'a> get for &'a int {
 }
 
 pub fn main() {
-    let x = @mut 6;
+    let x = @6;
     let y = x.get();
     assert_eq!(y, 6);
 
diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs
index 6e5aa1aaf8b..0d4277d2e1d 100644
--- a/src/test/run-pass/reflect-visit-data.rs
+++ b/src/test/run-pass/reflect-visit-data.rs
@@ -12,6 +12,7 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
 use std::libc::c_void;
 use std::ptr;
 use std::mem;
@@ -458,8 +459,9 @@ impl<V:TyVisitor + movable_ptr> TyVisitor for ptr_visit_adaptor<V> {
     }
 }
 
-struct my_visitor(@mut Stuff);
+struct my_visitor(@RefCell<Stuff>);
 
+#[deriving(Clone)]
 struct Stuff {
     ptr1: *c_void,
     ptr2: *c_void,
@@ -469,7 +471,7 @@ struct Stuff {
 impl my_visitor {
     pub fn get<T:Clone>(&mut self, f: |T|) {
         unsafe {
-            f((*(self.ptr1 as *T)).clone());
+            f((*((**self).get().ptr1 as *T)).clone());
         }
     }
 
@@ -487,8 +489,9 @@ struct Inner<V> { inner: V }
 
 impl movable_ptr for my_visitor {
     fn move_ptr(&mut self, adjustment: |*c_void| -> *c_void) {
-        self.ptr1 = adjustment(self.ptr1);
-        self.ptr2 = adjustment(self.ptr2);
+        let mut this = self.borrow_mut();
+        this.get().ptr1 = adjustment(this.get().ptr1);
+        this.get().ptr2 = adjustment(this.get().ptr2);
     }
 }
 
@@ -497,11 +500,17 @@ impl TyVisitor for my_visitor {
     fn visit_bot(&mut self) -> bool { true }
     fn visit_nil(&mut self) -> bool { true }
     fn visit_bool(&mut self) -> bool {
-        self.get::<bool>(|b| self.vals.push(b.to_str()));
+        self.get::<bool>(|b| {
+            let mut this = self.borrow_mut();
+            this.get().vals.push(b.to_str());
+        });
         true
     }
     fn visit_int(&mut self) -> bool {
-        self.get::<int>(|i| self.vals.push(i.to_str()));
+        self.get::<int>(|i| {
+            let mut this = self.borrow_mut();
+            this.get().vals.push(i.to_str());
+        });
         true
     }
     fn visit_i8(&mut self) -> bool { true }
@@ -622,21 +631,22 @@ pub fn main() {
     unsafe {
         let r = (1,2,3,true,false, Triple {x:5,y:4,z:3}, (12,));
         let p = ptr::to_unsafe_ptr(&r) as *c_void;
-        let u = my_visitor(@mut Stuff {ptr1: p,
-                                       ptr2: p,
-                                       vals: ~[]});
+        let u = my_visitor(@RefCell::new(Stuff {ptr1: p,
+                                                ptr2: p,
+                                                vals: ~[]}));
         let mut v = ptr_visit_adaptor(Inner {inner: u});
         let td = get_tydesc_for(r);
         error!("tydesc sz: {}, align: {}",
                (*td).size, (*td).align);
         visit_tydesc(td, &mut v as &mut TyVisitor);
 
-        let r = u.vals.clone();
+        let mut ub = u.borrow_mut();
+        let r = ub.get().vals.clone();
         for s in r.iter() {
             println!("val: {}", *s);
         }
-        error!("{:?}", u.vals.clone());
-        assert_eq!(u.vals.clone(),
+        error!("{:?}", ub.get().vals.clone());
+        assert_eq!(ub.get().vals.clone(),
                    ~[ ~"1", ~"2", ~"3", ~"true", ~"false", ~"5", ~"4", ~"3", ~"12"]);
     }
 }
diff --git a/src/test/run-pass/reflect-visit-type.rs b/src/test/run-pass/reflect-visit-type.rs
index 03722cd0fbf..5acb072fd2d 100644
--- a/src/test/run-pass/reflect-visit-type.rs
+++ b/src/test/run-pass/reflect-visit-type.rs
@@ -13,7 +13,7 @@
 use std::unstable::intrinsics::{TyDesc, get_tydesc, visit_tydesc, TyVisitor, Disr, Opaque};
 
 struct MyVisitor {
-    types: @mut ~[~str],
+    types: ~[~str],
 }
 
 impl TyVisitor for MyVisitor {
@@ -153,7 +153,7 @@ fn visit_ty<T>(v: &mut MyVisitor) {
 }
 
 pub fn main() {
-    let mut v = MyVisitor {types: @mut ~[]};
+    let mut v = MyVisitor {types: ~[]};
 
     visit_ty::<bool>(&mut v);
     visit_ty::<int>(&mut v);
@@ -164,5 +164,5 @@ pub fn main() {
     for s in v.types.iter() {
         println!("type: {}", (*s).clone());
     }
-    assert_eq!((*v.types).clone(), ~[~"bool", ~"int", ~"i8", ~"i16", ~"[", ~"int", ~"]"]);
+    assert_eq!(v.types.clone(), ~[~"bool", ~"int", ~"i8", ~"i16", ~"[", ~"int", ~"]"]);
 }
diff --git a/src/test/run-pass/resource-assign-is-not-copy.rs b/src/test/run-pass/resource-assign-is-not-copy.rs
index 3025032fec1..bec101a6d45 100644
--- a/src/test/run-pass/resource-assign-is-not-copy.rs
+++ b/src/test/run-pass/resource-assign-is-not-copy.rs
@@ -10,25 +10,27 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 struct r {
-  i: @mut int,
+    i: @Cell<int>,
 }
 
 #[unsafe_destructor]
 impl Drop for r {
     fn drop(&mut self) {
-        *(self.i) += 1;
+        self.i.set(self.i.get() + 1);
     }
 }
 
-fn r(i: @mut int) -> r {
+fn r(i: @Cell<int>) -> r {
     r {
         i: i
     }
 }
 
 pub fn main() {
-    let i = @mut 0;
+    let i = @Cell::new(0);
     // Even though these look like copies, they are guaranteed not to be
     {
         let a = r(i);
@@ -36,5 +38,5 @@ pub fn main() {
         let (c, _d) = b;
         info!("{:?}", c);
     }
-    assert_eq!(*i, 1);
+    assert_eq!(i.get(), 1);
 }
diff --git a/src/test/run-pass/resource-cycle.rs b/src/test/run-pass/resource-cycle.rs
deleted file mode 100644
index 898f6327aeb..00000000000
--- a/src/test/run-pass/resource-cycle.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2012 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.
-
-#[feature(managed_boxes)];
-
-// Don't leak the unique pointers
-
-use std::cast;
-
-struct r {
-  v: *int,
-}
-
-impl Drop for r {
-    fn drop(&mut self) {
-        unsafe {
-            info!("r's dtor: self = {:x}, self.v = {:x}, self.v's value = {:x}",
-              cast::transmute::<*mut r, uint>(self),
-              cast::transmute::<**int, uint>(&(self.v)),
-              cast::transmute::<*int, uint>(self.v));
-            let _v2: ~int = cast::transmute(self.v);
-        }
-    }
-}
-
-fn r(v: *int) -> r {
-    r {
-        v: v
-    }
-}
-
-struct t(Node);
-
-struct Node {
-    next: Option<@mut t>,
-    r: r
-}
-
-pub fn main() {
-    unsafe {
-        let i1 = ~0;
-        let i1p = cast::transmute_copy(&i1);
-        cast::forget(i1);
-        let i2 = ~0;
-        let i2p = cast::transmute_copy(&i2);
-        cast::forget(i2);
-
-        let x1 = @mut t(Node{
-            next: None,
-              r: {
-              let rs = r(i1p);
-              info!("r = {:x}", cast::transmute::<*r, uint>(&rs));
-              rs }
-        });
-
-        info!("x1 = {:x}, x1.r = {:x}",
-               cast::transmute::<@mut t, uint>(x1),
-               cast::transmute::<*r, uint>(&x1.r));
-
-        let x2 = @mut t(Node{
-            next: None,
-              r: {
-              let rs = r(i2p);
-              info!("r2 = {:x}", cast::transmute::<*r, uint>(&rs));
-              rs
-                }
-        });
-
-        info!("x2 = {:x}, x2.r = {:x}",
-               cast::transmute::<@mut t, uint>(x2),
-               cast::transmute::<*r, uint>(&(x2.r)));
-
-        x1.next = Some(x2);
-        x2.next = Some(x1);
-    }
-}
diff --git a/src/test/run-pass/resource-cycle2.rs b/src/test/run-pass/resource-cycle2.rs
deleted file mode 100644
index c7ad9711ed4..00000000000
--- a/src/test/run-pass/resource-cycle2.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2012 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.
-
-#[feature(managed_boxes)];
-
-// Don't leak the unique pointers
-
-use std::cast;
-
-struct U {
-    a: int,
-    b: int,
-    c: *int
-}
-
-struct r {
-  v: U,
-}
-
-impl Drop for r {
-    fn drop(&mut self) {
-        unsafe {
-            let _v2: ~int = cast::transmute(self.v.c);
-        }
-    }
-}
-
-fn r(v: U) -> r {
-    r {
-        v: v
-    }
-}
-
-struct t(Node);
-
-struct Node {
-    next: Option<@mut t>,
-    r: r
-}
-
-pub fn main() {
-    unsafe {
-        let i1 = ~0xA;
-        let i1p = cast::transmute_copy(&i1);
-        cast::forget(i1);
-        let i2 = ~0xA;
-        let i2p = cast::transmute_copy(&i2);
-        cast::forget(i2);
-
-        let u1 = U {a: 0xB, b: 0xC, c: i1p};
-        let u2 = U {a: 0xB, b: 0xC, c: i2p};
-
-        let x1 = @mut t(Node {
-            next: None,
-            r: r(u1)
-        });
-        let x2 = @mut t(Node {
-            next: None,
-            r: r(u2)
-        });
-        x1.next = Some(x2);
-        x2.next = Some(x1);
-    }
-}
diff --git a/src/test/run-pass/resource-cycle3.rs b/src/test/run-pass/resource-cycle3.rs
deleted file mode 100644
index 8d11eca4492..00000000000
--- a/src/test/run-pass/resource-cycle3.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2012 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.
-
-#[feature(managed_boxes)];
-
-// same as resource-cycle2, but be sure to give r multiple fields...
-
-// Don't leak the unique pointers
-
-use std::cast;
-
-struct U {
-    a: int,
-    b: int,
-    c: *int
-}
-
-struct R {
-  v: U,
-  w: int,
-  x: *int,
-}
-
-impl Drop for R {
-    fn drop(&mut self) {
-        unsafe {
-            let _v2: ~int = cast::transmute(self.v.c);
-            // let _v3: ~int = cast::transmute_copy(self.x);
-        }
-    }
-}
-
-fn r(v: U, w: int, _x: *int) -> R {
-    unsafe {
-        R {
-            v: v,
-            w: w,
-            x: cast::transmute(0)
-        }
-    }
-}
-
-struct t(Node);
-
-struct Node {
-    next: Option<@mut t>,
-    r: R
-}
-
-pub fn main() {
-    unsafe {
-        let i1 = ~0xA;
-        let i1p = cast::transmute_copy(&i1);
-        cast::forget(i1);
-        let i2 = ~0xA;
-        let i2p = cast::transmute_copy(&i2);
-        cast::forget(i2);
-
-        let u1 = U {a: 0xB, b: 0xC, c: i1p};
-        let u2 = U {a: 0xB, b: 0xC, c: i2p};
-
-        let x1 = @mut t(Node{
-            next: None,
-            r: r(u1, 42, i1p)
-        });
-        let x2 = @mut t(Node{
-            next: None,
-            r: r(u2, 42, i2p)
-        });
-        x1.next = Some(x2);
-        x2.next = Some(x1);
-    }
-}
diff --git a/src/test/run-pass/resource-destruct.rs b/src/test/run-pass/resource-destruct.rs
index d85759dff19..93183f8dba4 100644
--- a/src/test/run-pass/resource-destruct.rs
+++ b/src/test/run-pass/resource-destruct.rs
@@ -10,30 +10,32 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 struct shrinky_pointer {
-  i: @@mut int,
+  i: @@Cell<int>,
 }
 
 #[unsafe_destructor]
 impl Drop for shrinky_pointer {
     fn drop(&mut self) {
-        error!("Hello!"); **(self.i) -= 1;
+        error!("Hello!"); self.i.set(self.i.get() - 1);
     }
 }
 
 impl shrinky_pointer {
-    pub fn look_at(&self) -> int { return **(self.i); }
+    pub fn look_at(&self) -> int { return self.i.get(); }
 }
 
-fn shrinky_pointer(i: @@mut int) -> shrinky_pointer {
+fn shrinky_pointer(i: @@Cell<int>) -> shrinky_pointer {
     shrinky_pointer {
         i: i
     }
 }
 
 pub fn main() {
-    let my_total = @@mut 10;
+    let my_total = @@Cell::new(10);
     { let pt = shrinky_pointer(my_total); assert!((pt.look_at() == 10)); }
-    error!("my_total = {}", **my_total);
-    assert_eq!(**my_total, 9);
+    error!("my_total = {}", my_total.get());
+    assert_eq!(my_total.get(), 9);
 }
diff --git a/src/test/run-pass/resource-in-struct.rs b/src/test/run-pass/resource-in-struct.rs
index c76a9659c26..1c5ad9ce525 100644
--- a/src/test/run-pass/resource-in-struct.rs
+++ b/src/test/run-pass/resource-in-struct.rs
@@ -13,7 +13,9 @@
 // Ensures that class dtors run if the object is inside an enum
 // variant
 
-type closable = @mut bool;
+use std::cell::Cell;
+
+type closable = @Cell<bool>;
 
 struct close_res {
   i: closable,
@@ -23,7 +25,7 @@ struct close_res {
 #[unsafe_destructor]
 impl Drop for close_res {
     fn drop(&mut self) {
-        *(self.i) = false;
+        self.i.set(false);
     }
 }
 
@@ -38,8 +40,8 @@ enum option<T> { none, some(T), }
 fn sink(_res: option<close_res>) { }
 
 pub fn main() {
-    let c = @mut true;
+    let c = @Cell::new(true);
     sink(none);
     sink(some(close_res(c)));
-    assert!((!*c));
+    assert!(!c.get());
 }
diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs
index a490cc6020f..16e9cb53891 100644
--- a/src/test/run-pass/task-killjoin-rsrc.rs
+++ b/src/test/run-pass/task-killjoin-rsrc.rs
@@ -13,12 +13,14 @@
 // A port of task-killjoin to use a class with a dtor to manage
 // the join.
 
+use std::cell::Cell;
 use std::comm::*;
 use std::ptr;
 use std::task;
 
 struct notify {
-    ch: Chan<bool>, v: @mut bool,
+    ch: Chan<bool>,
+    v: @Cell<bool>,
 }
 
 #[unsafe_destructor]
@@ -36,7 +38,7 @@ impl Drop for notify {
     }
 }
 
-fn notify(ch: Chan<bool>, v: @mut bool) -> notify {
+fn notify(ch: Chan<bool>, v: @Cell<bool>) -> notify {
     notify {
         ch: ch,
         v: v
@@ -45,10 +47,10 @@ fn notify(ch: Chan<bool>, v: @mut bool) -> notify {
 
 fn joinable(f: proc()) -> Port<bool> {
     fn wrapper(c: Chan<bool>, f: ||) {
-        let b = @mut false;
+        let b = @Cell::new(false);
         error!("wrapper: task=%? allocated v=%x",
                0,
-               ptr::to_unsafe_ptr(&(*b)) as uint);
+               ptr::to_unsafe_ptr(&b) as uint);
         let _r = notify(c, b);
         f();
         *b = true;
diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs
index e5d91608997..bf8b0b5522d 100644
--- a/src/test/run-pass/trait-cast.rs
+++ b/src/test/run-pass/trait-cast.rs
@@ -12,7 +12,9 @@
 
 // Test cyclic detector when using trait instances.
 
-struct Tree(@mut TreeR);
+use std::cell::RefCell;
+
+struct Tree(@RefCell<TreeR>);
 struct TreeR {
     left: Option<Tree>,
     right: Option<Tree>,
@@ -38,8 +40,9 @@ impl to_str for int {
 
 impl to_str for Tree {
     fn to_str_(&self) -> ~str {
-        let (l, r) = (self.left, self.right);
-        let val = &self.val;
+        let this = self.borrow();
+        let (l, r) = (this.get().left, this.get().right);
+        let val = &this.get().val;
         format!("[{}, {}, {}]", val.to_str_(), l.to_str_(), r.to_str_())
     }
 }
@@ -47,14 +50,18 @@ impl to_str for Tree {
 fn foo<T:to_str>(x: T) -> ~str { x.to_str_() }
 
 pub fn main() {
-    let t1 = Tree(@mut TreeR{left: None,
-                             right: None,
-                             val: ~1 as ~to_str });
-    let t2 = Tree(@mut TreeR{left: Some(t1),
-                             right: Some(t1),
-                             val: ~2 as ~to_str });
+    let t1 = Tree(@RefCell::new(TreeR{left: None,
+                                      right: None,
+                                      val: ~1 as ~to_str}));
+    let t2 = Tree(@RefCell::new(TreeR{left: Some(t1),
+                                      right: Some(t1),
+                                      val: ~2 as ~to_str}));
     let expected = ~"[2, some([1, none, none]), some([1, none, none])]";
     assert!(t2.to_str_() == expected);
     assert!(foo(t2) == expected);
-    t1.left = Some(t2); // create cycle
+
+    {
+        let mut t1 = t1.borrow_mut();
+        t1.get().left = Some(t2); // create cycle
+    }
 }
diff --git a/src/test/run-pass/uniq-cc-generic.rs b/src/test/run-pass/uniq-cc-generic.rs
index ebf3da60db8..53836a6e17d 100644
--- a/src/test/run-pass/uniq-cc-generic.rs
+++ b/src/test/run-pass/uniq-cc-generic.rs
@@ -10,11 +10,12 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
 use std::ptr;
 
 enum maybe_pointy {
     none,
-    p(@mut Pointy),
+    p(@RefCell<Pointy>),
 }
 
 struct Pointy {
@@ -27,14 +28,17 @@ fn make_uniq_closure<A:Send>(a: A) -> proc() -> uint {
     result
 }
 
-fn empty_pointy() -> @mut Pointy {
-    return @mut Pointy {
+fn empty_pointy() -> @RefCell<Pointy> {
+    return @RefCell::new(Pointy {
         a : none,
         d : make_uniq_closure(~"hi")
-    }
+    })
 }
 
 pub fn main() {
     let v = empty_pointy();
-    v.a = p(v);
+    {
+        let mut vb = v.borrow_mut();
+        vb.get().a = p(v);
+    }
 }
diff --git a/src/test/run-pass/uniq-cc.rs b/src/test/run-pass/uniq-cc.rs
index 20b5761e6bd..23a27dece46 100644
--- a/src/test/run-pass/uniq-cc.rs
+++ b/src/test/run-pass/uniq-cc.rs
@@ -10,9 +10,11 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::RefCell;
+
 enum maybe_pointy {
     none,
-    p(@mut Pointy),
+    p(@RefCell<Pointy>),
 }
 
 struct Pointy {
@@ -21,15 +23,18 @@ struct Pointy {
     d : proc()->(),
 }
 
-fn empty_pointy() -> @mut Pointy {
-    return @mut Pointy {
+fn empty_pointy() -> @RefCell<Pointy> {
+    return @RefCell::new(Pointy {
         a : none,
         c : ~22,
         d : proc() {},
-    }
+    })
 }
 
 pub fn main() {
     let v = empty_pointy();
-    v.a = p(v);
+    {
+        let mut vb = v.borrow_mut();
+        vb.get().a = p(v);
+    }
 }
diff --git a/src/test/run-pass/unique-pinned-nocopy-2.rs b/src/test/run-pass/unique-pinned-nocopy-2.rs
deleted file mode 100644
index a7c326ba11c..00000000000
--- a/src/test/run-pass/unique-pinned-nocopy-2.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 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.
-
-#[feature(managed_boxes)];
-
-struct r {
-  i: @mut int,
-}
-
-#[unsafe_destructor]
-impl Drop for r {
-    fn drop(&mut self) {
-        *(self.i) = *(self.i) + 1;
-    }
-}
-
-fn r(i: @mut int) -> r {
-    r {
-        i: i
-    }
-}
-
-pub fn main() {
-    let i = @mut 0;
-    {
-        let _j = ~r(i);
-    }
-    assert_eq!(*i, 1);
-}
diff --git a/src/test/run-pass/vec-slice-drop.rs b/src/test/run-pass/vec-slice-drop.rs
index c8493f0cb15..f8e28dc792c 100644
--- a/src/test/run-pass/vec-slice-drop.rs
+++ b/src/test/run-pass/vec-slice-drop.rs
@@ -10,29 +10,31 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
+
 // Make sure that destructors get run on slice literals
 struct foo {
-    x: @mut int,
+    x: @Cell<int>,
 }
 
 #[unsafe_destructor]
 impl Drop for foo {
     fn drop(&mut self) {
-        *self.x += 1;
+        self.x.set(self.x.get() + 1);
     }
 }
 
-fn foo(x: @mut int) -> foo {
+fn foo(x: @Cell<int>) -> foo {
     foo {
         x: x
     }
 }
 
 pub fn main() {
-    let x = @mut 0;
+    let x = @Cell::new(0);
     {
         let l = &[foo(x)];
-        assert_eq!(*l[0].x, 0);
+        assert_eq!(l[0].x.get(), 0);
     }
-    assert_eq!(*x, 1);
+    assert_eq!(x.get(), 1);
 }
diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs
index 70803c9bd55..f62ab6f59a0 100644
--- a/src/test/run-pass/weird-exprs.rs
+++ b/src/test/run-pass/weird-exprs.rs
@@ -10,6 +10,7 @@
 
 #[feature(managed_boxes)];
 
+use std::cell::Cell;
 use std::util;
 
 // Just a grab bag of stuff that you wouldn't want to actually write.
@@ -22,11 +23,13 @@ fn funny() {
 }
 
 fn what() {
-    fn the(x: @mut bool) { return while !*x { *x = true; }; }
-    let i = @mut false;
+    fn the(x: @Cell<bool>) {
+        return while !x.get() { x.set(true); };
+    }
+    let i = @Cell::new(false);
     let dont = {||the(i)};
     dont();
-    assert!((*i));
+    assert!((i.get()));
 }
 
 fn zombiejesus() {