about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/bench/msgsend-ring-mutex-arcs.rs17
-rw-r--r--src/test/bench/msgsend-ring-pipes.rs20
-rw-r--r--src/test/bench/msgsend-ring-rw-arcs.rs17
-rw-r--r--src/test/bench/task-perf-jargon-metal-smoke.rs8
-rw-r--r--src/test/compile-fail/mutable-huh-variance-deep.rs4
-rw-r--r--src/test/compile-fail/mutable-huh-variance-unique.rs21
-rw-r--r--src/test/compile-fail/no-send-res-ports.rs7
-rw-r--r--src/test/compile-fail/unique-mut.rs14
-rw-r--r--src/test/run-pass/borrowck-preserve-box-in-uniq.rs2
-rw-r--r--src/test/run-pass/explicit-self-closures.rs3
-rw-r--r--src/test/run-pass/intrinsic-atomics.rs2
-rw-r--r--src/test/run-pass/issue-2718.rs14
-rw-r--r--src/test/run-pass/pipe-pingpong-bounded.rs19
-rw-r--r--src/test/run-pass/pipe-pingpong-proto.rs19
-rw-r--r--src/test/run-pass/pure-sum.rs4
-rw-r--r--src/test/run-pass/rcvr-borrowed-to-region.rs2
-rw-r--r--src/test/run-pass/task-killjoin-rsrc.rs7
-rw-r--r--src/test/run-pass/unique-assign-copy.rs2
-rw-r--r--src/test/run-pass/unique-decl-init-copy.rs2
-rw-r--r--src/test/run-pass/unique-in-vec-copy.rs2
-rw-r--r--src/test/run-pass/unique-mutable.rs2
21 files changed, 121 insertions, 67 deletions
diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs
index 22045007134..9b6fee5e23b 100644
--- a/src/test/bench/msgsend-ring-mutex-arcs.rs
+++ b/src/test/bench/msgsend-ring-mutex-arcs.rs
@@ -87,12 +87,17 @@ fn main() {
     for uint::range(1u, num_tasks) |i| {
         //error!("spawning %?", i);
         let (new_chan, num_port) = init();
-        let num_chan2 = Cell(num_chan);
-        let num_port = Cell(num_port);
-        let new_future = do future::spawn() {
-            let num_chan = num_chan2.take();
-            let num_port1 = num_port.take();
-            thread_ring(i, msg_per_task, num_chan, num_port1)
+        let num_chan2 = ~mut None;
+        *num_chan2 <-> num_chan;
+        let num_port = ~mut Some(num_port);
+        let new_future = do future::spawn() || {
+            let mut num_chan = None;
+            num_chan <-> *num_chan2;
+            let mut num_port1 = None;
+            num_port1 <-> *num_port;
+            thread_ring(i, msg_per_task,
+                        option::unwrap(num_chan),
+                        option::unwrap(num_port1))
         };
         futures.push(new_future);
         num_chan = Some(new_chan);
diff --git a/src/test/bench/msgsend-ring-pipes.rs b/src/test/bench/msgsend-ring-pipes.rs
index dfe5c6de832..0f7c41f5997 100644
--- a/src/test/bench/msgsend-ring-pipes.rs
+++ b/src/test/bench/msgsend-ring-pipes.rs
@@ -17,12 +17,11 @@
 // This version uses automatically compiled channel contracts.
 
 extern mod std;
-
-use core::cell::Cell;
-use core::pipes::recv;
 use std::time;
 use std::future;
 
+use core::pipes::recv;
+
 proto! ring (
     num:send {
         num(uint) -> num
@@ -81,12 +80,17 @@ fn main() {
     for uint::range(1u, num_tasks) |i| {
         //error!("spawning %?", i);
         let (new_chan, num_port) = ring::init();
-        let num_chan2 = Cell(num_chan);
-        let num_port = Cell(num_port);
+        let num_chan2 = ~mut None;
+        *num_chan2 <-> num_chan;
+        let num_port = ~mut Some(num_port);
         let new_future = do future::spawn || {
-            let num_chan = num_chan2.take();
-            let num_port1 = num_port.take();
-            thread_ring(i, msg_per_task, num_chan, num_port1)
+            let mut num_chan = None;
+            num_chan <-> *num_chan2;
+            let mut num_port1 = None;
+            num_port1 <-> *num_port;
+            thread_ring(i, msg_per_task,
+                        option::unwrap(num_chan),
+                        option::unwrap(num_port1))
         };
         futures.push(new_future);
         num_chan = Some(new_chan);
diff --git a/src/test/bench/msgsend-ring-rw-arcs.rs b/src/test/bench/msgsend-ring-rw-arcs.rs
index 98c0129918a..eaae8370d6b 100644
--- a/src/test/bench/msgsend-ring-rw-arcs.rs
+++ b/src/test/bench/msgsend-ring-rw-arcs.rs
@@ -87,12 +87,17 @@ fn main() {
     for uint::range(1u, num_tasks) |i| {
         //error!("spawning %?", i);
         let (new_chan, num_port) = init();
-        let num_chan2 = Cell(num_chan);
-        let num_port = Cell(num_port);
-        let new_future = do future::spawn {
-            let num_chan = num_chan2.take();
-            let num_port1 = num_port.take();
-            thread_ring(i, msg_per_task, num_chan, num_port1)
+        let num_chan2 = ~mut None;
+        *num_chan2 <-> num_chan;
+        let num_port = ~mut Some(num_port);
+        let new_future = do future::spawn || {
+            let mut num_chan = None;
+            num_chan <-> *num_chan2;
+            let mut num_port1 = None;
+            num_port1 <-> *num_port;
+            thread_ring(i, msg_per_task,
+                        option::unwrap(num_chan),
+                        option::unwrap(num_port1))
         };
         futures.push(new_future);
         num_chan = Some(new_chan);
diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs
index 9bdc5aae3f2..49a06fd491c 100644
--- a/src/test/bench/task-perf-jargon-metal-smoke.rs
+++ b/src/test/bench/task-perf-jargon-metal-smoke.rs
@@ -17,15 +17,13 @@
 //
 // The filename is a song reference; google it in quotes.
 
-use core::cell::Cell;
-
 fn child_generation(gens_left: uint, -c: comm::Chan<()>) {
     // This used to be O(n^2) in the number of generations that ever existed.
     // With this code, only as many generations are alive at a time as tasks
     // alive at a time,
-    let c = Cell(c);
-    do task::spawn_supervised {
-        let c = c.take();
+    let c = ~mut Some(c);
+    do task::spawn_supervised || {
+        let c = option::swap_unwrap(c);
         if gens_left & 1 == 1 {
             task::yield(); // shake things up a bit
         }
diff --git a/src/test/compile-fail/mutable-huh-variance-deep.rs b/src/test/compile-fail/mutable-huh-variance-deep.rs
index 51d5a6177f6..4f0c6d7a4c8 100644
--- a/src/test/compile-fail/mutable-huh-variance-deep.rs
+++ b/src/test/compile-fail/mutable-huh-variance-deep.rs
@@ -11,9 +11,9 @@
 // error-pattern: mismatched types
 
 fn main() {
-    let v = @[mut @mut @mut @[0]];
+    let v = ~[mut @mut ~mut ~[0]];
 
-    fn f(&&v: @[mut @mut @mut @[const int]]) {
+    fn f(&&v: ~[mut @mut ~mut ~[const int]]) {
     }
 
     f(v);
diff --git a/src/test/compile-fail/mutable-huh-variance-unique.rs b/src/test/compile-fail/mutable-huh-variance-unique.rs
new file mode 100644
index 00000000000..f2188911346
--- /dev/null
+++ b/src/test/compile-fail/mutable-huh-variance-unique.rs
@@ -0,0 +1,21 @@
+// 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.
+
+// error-pattern: mismatched types
+
+fn main() {
+    let v = ~mut ~[0];
+
+    fn f(&&v: ~mut ~[const int]) {
+        *v = ~[mut 3]
+    }
+
+    f(v);
+}
diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs
index 0d7e2d2377c..4954bbfa09d 100644
--- a/src/test/compile-fail/no-send-res-ports.rs
+++ b/src/test/compile-fail/no-send-res-ports.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use core::cell::Cell;
-
 struct Port<T>(@T);
 
 fn main() {
@@ -27,10 +25,11 @@ fn main() {
         }
     }
 
-    let x = Cell(foo(Port(@())));
+    let x = ~mut Some(foo(Port(@())));
 
     do task::spawn {
-        let y = x.take();   //~ ERROR value has non-owned type
+        let mut y = None;
+        *x <-> y; //~ ERROR value has non-owned type
         log(error, y);
     }
 }
diff --git a/src/test/compile-fail/unique-mut.rs b/src/test/compile-fail/unique-mut.rs
new file mode 100644
index 00000000000..a3a197505a3
--- /dev/null
+++ b/src/test/compile-fail/unique-mut.rs
@@ -0,0 +1,14 @@
+// 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.
+
+//error-pattern:mismatched types
+fn main() {
+    let i: ~int = ~mut 0;
+}
diff --git a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs
index b11a5356f69..9724717f2d5 100644
--- a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs
+++ b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs
@@ -20,7 +20,7 @@ fn borrow(x: &int, f: fn(x: &int)) {
 struct F { f: ~int }
 
 pub fn main() {
-    let mut x = ~@F{f: ~3};
+    let mut x = ~mut @F{f: ~3};
     do borrow(x.f) |b_x| {
         assert *b_x == 3;
         assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x));
diff --git a/src/test/run-pass/explicit-self-closures.rs b/src/test/run-pass/explicit-self-closures.rs
index d40b2f72ae8..4c12b6ad47c 100644
--- a/src/test/run-pass/explicit-self-closures.rs
+++ b/src/test/run-pass/explicit-self-closures.rs
@@ -21,6 +21,9 @@ impl Box {
     fn set_many2(@mut self, xs: &[uint]) {
         for xs.each |x| { self.x = *x; }
     }
+    fn set_many3(~mut self, xs: &[uint]) {
+        for xs.each |x| { self.x = *x; }
+    }
 }
 
 pub fn main() {}
diff --git a/src/test/run-pass/intrinsic-atomics.rs b/src/test/run-pass/intrinsic-atomics.rs
index 7d5bf65dad7..eb10a51c0bd 100644
--- a/src/test/run-pass/intrinsic-atomics.rs
+++ b/src/test/run-pass/intrinsic-atomics.rs
@@ -29,7 +29,7 @@ extern mod rusti {
 
 pub fn main() {
     unsafe {
-        let mut x = ~1;
+        let x = ~mut 1;
 
         assert rusti::atomic_cxchg(x, 1, 2) == 1;
         assert *x == 2;
diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs
index b97ebb04f71..249d1c21376 100644
--- a/src/test/run-pass/issue-2718.rs
+++ b/src/test/run-pass/issue-2718.rs
@@ -318,16 +318,18 @@ pub fn main() {
 //    Commented out because of option::get error
 
     let (client_, server_) = pingpong::init();
-    let client_ = Cell(client_);
-    let server_ = Cell(server_);
+    let client_ = ~mut Some(client_);
+    let server_ = ~mut Some(server_);
 
     task::spawn {|client_|
-        let client__ = client_.take();
-        client(client__);
+        let mut client__ = none;
+        *client_ <-> client__;
+        client(option::unwrap(client__));
     };
     task::spawn {|server_|
-        let server__ = server_.take();
-        server(server_ˊ);
+        let mut server_ˊ = none;
+        *server_ <-> server_ˊ;
+        server(option::unwrap(server_ˊ));
     };
   */
 }
diff --git a/src/test/run-pass/pipe-pingpong-bounded.rs b/src/test/run-pass/pipe-pingpong-bounded.rs
index 23f2bc10046..2ada6df76a6 100644
--- a/src/test/run-pass/pipe-pingpong-bounded.rs
+++ b/src/test/run-pass/pipe-pingpong-bounded.rs
@@ -14,7 +14,6 @@
 // experiment with what code the compiler should generate for bounded
 // protocols.
 
-use core::cell::Cell;
 
 // This was generated initially by the pipe compiler, but it's been
 // modified in hopefully straightforward ways.
@@ -112,14 +111,16 @@ mod test {
 
 pub fn main() {
     let (client_, server_) = ::pingpong::init();
-    let client_ = Cell(client_);
-    let server_ = Cell(server_);
-    do task::spawn {
-        let client__ = client_.take();
-        test::client(client__);
+    let client_ = ~mut Some(client_);
+    let server_ = ~mut Some(server_);
+    do task::spawn || {
+        let mut client__ = None;
+        *client_ <-> client__;
+        test::client(option::unwrap(client__));
     };
-    do task::spawn {
-        let server__ = server_.take();
-        test::server(server_ˊ);
+    do task::spawn || {
+        let mut server_ˊ = None;
+        *server_ <-> server_ˊ;
+        test::server(option::unwrap(server_ˊ));
     };
 }
diff --git a/src/test/run-pass/pipe-pingpong-proto.rs b/src/test/run-pass/pipe-pingpong-proto.rs
index a4a1c562bca..050ff76ef9b 100644
--- a/src/test/run-pass/pipe-pingpong-proto.rs
+++ b/src/test/run-pass/pipe-pingpong-proto.rs
@@ -12,7 +12,6 @@
 
 // An example to make sure the protocol parsing syntax extension works.
 
-use core::cell::Cell;
 use core::option;
 
 proto! pingpong (
@@ -50,15 +49,17 @@ mod test {
 
 pub fn main() {
     let (client_, server_) = pingpong::init();
-    let client_ = Cell(client_);
-    let server_ = Cell(server_);
+    let client_ = ~mut Some(client_);
+    let server_ = ~mut Some(server_);
 
-    do task::spawn {
-        let client__ = client_.take();
-        test::client(client__);
+    do task::spawn || {
+        let mut client__ = None;
+        *client_ <-> client__;
+        test::client(option::unwrap(client__));
     };
-    do task::spawn {
-        let server__ = server_.take();
-        test::server(server_ˊ);
+    do task::spawn || {
+        let mut server_ˊ = None;
+        *server_ <-> server_ˊ;
+        test::server(option::unwrap(server_ˊ));
     };
 }
diff --git a/src/test/run-pass/pure-sum.rs b/src/test/run-pass/pure-sum.rs
index cac6b4ef349..f4c92c869e4 100644
--- a/src/test/run-pass/pure-sum.rs
+++ b/src/test/run-pass/pure-sum.rs
@@ -20,7 +20,7 @@ pure fn sums_to(v: ~[int], sum: int) -> bool {
 }
 
 pure fn sums_to_using_uniq(v: ~[int], sum: int) -> bool {
-    let mut i = 0u, sum0 = ~0;
+    let mut i = 0u, sum0 = ~mut 0;
     while i < v.len() {
         *sum0 += v[i];
         i += 1u;
@@ -40,7 +40,7 @@ pure fn sums_to_using_rec(v: ~[int], sum: int) -> bool {
 struct F<T> { f: T }
 
 pure fn sums_to_using_uniq_rec(v: ~[int], sum: int) -> bool {
-    let mut i = 0u, sum0 = F {f: ~0};
+    let mut i = 0u, sum0 = F {f: ~mut 0};
     while i < v.len() {
         *sum0.f += v[i];
         i += 1u;
diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs
index 7011f5ba1ad..61cb473bf8f 100644
--- a/src/test/run-pass/rcvr-borrowed-to-region.rs
+++ b/src/test/run-pass/rcvr-borrowed-to-region.rs
@@ -31,7 +31,7 @@ pub fn main() {
     debug!("y=%d", y);
     assert y == 6;
 
-    let mut x = ~6;
+    let x = ~mut 6;
     let y = x.get();
     debug!("y=%d", y);
     assert y == 6;
diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs
index 991025a1ad2..b90c39ab34e 100644
--- a/src/test/run-pass/task-killjoin-rsrc.rs
+++ b/src/test/run-pass/task-killjoin-rsrc.rs
@@ -13,7 +13,6 @@
 // A port of task-killjoin to use a class with a dtor to manage
 // the join.
 
-use core::cell::Cell;
 use core::comm::*;
 
 struct notify {
@@ -50,9 +49,11 @@ fn joinable(f: fn~()) -> Port<bool> {
         *b = true;
     }
     let (p, c) = stream();
-    let c = Cell(c);
+    let c = ~mut Some(c);
     do task::spawn_unlinked {
-        let ccc = c.take();
+        let mut cc = None;
+        *c <-> cc;
+        let ccc = option::unwrap(cc);
         wrapper(ccc, f)
     }
     p
diff --git a/src/test/run-pass/unique-assign-copy.rs b/src/test/run-pass/unique-assign-copy.rs
index 1bb04aef286..4723356dcd0 100644
--- a/src/test/run-pass/unique-assign-copy.rs
+++ b/src/test/run-pass/unique-assign-copy.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub fn main() {
-    let mut i = ~1;
+    let i = ~mut 1;
     // Should be a copy
     let mut j;
     j = copy i;
diff --git a/src/test/run-pass/unique-decl-init-copy.rs b/src/test/run-pass/unique-decl-init-copy.rs
index a0b7fc336e2..628eb7265a5 100644
--- a/src/test/run-pass/unique-decl-init-copy.rs
+++ b/src/test/run-pass/unique-decl-init-copy.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub fn main() {
-    let mut i = ~1;
+    let i = ~mut 1;
     // Should be a copy
     let j = copy i;
     *i = 2;
diff --git a/src/test/run-pass/unique-in-vec-copy.rs b/src/test/run-pass/unique-in-vec-copy.rs
index ac8796674ab..54ea0258c7c 100644
--- a/src/test/run-pass/unique-in-vec-copy.rs
+++ b/src/test/run-pass/unique-in-vec-copy.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub fn main() {
-    let mut a = ~[~10];
+    let a = ~[~mut 10];
     let b = copy a;
 
     assert *a[0] == 10;
diff --git a/src/test/run-pass/unique-mutable.rs b/src/test/run-pass/unique-mutable.rs
index 8784dbeb0af..c52d3b563ac 100644
--- a/src/test/run-pass/unique-mutable.rs
+++ b/src/test/run-pass/unique-mutable.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub fn main() {
-    let mut i = ~0;
+    let i = ~mut 0;
     *i = 1;
     assert *i == 1;
 }