Skip to content

Commit 00d8db5

Browse files
committed
Revert "test: De-~mut the test suite. rs=demuting"
This reverts commit f63efdc.
1 parent f63efdc commit 00d8db5

21 files changed

+121
-67
lines changed

src/test/bench/msgsend-ring-mutex-arcs.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,17 @@ fn main() {
8787
for uint::range(1u, num_tasks) |i| {
8888
//error!("spawning %?", i);
8989
let (new_chan, num_port) = init();
90-
let num_chan2 = Cell(num_chan);
91-
let num_port = Cell(num_port);
92-
let new_future = do future::spawn() {
93-
let num_chan = num_chan2.take();
94-
let num_port1 = num_port.take();
95-
thread_ring(i, msg_per_task, num_chan, num_port1)
90+
let num_chan2 = ~mut None;
91+
*num_chan2 <-> num_chan;
92+
let num_port = ~mut Some(num_port);
93+
let new_future = do future::spawn() || {
94+
let mut num_chan = None;
95+
num_chan <-> *num_chan2;
96+
let mut num_port1 = None;
97+
num_port1 <-> *num_port;
98+
thread_ring(i, msg_per_task,
99+
option::unwrap(num_chan),
100+
option::unwrap(num_port1))
96101
};
97102
futures.push(new_future);
98103
num_chan = Some(new_chan);

src/test/bench/msgsend-ring-pipes.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
// This version uses automatically compiled channel contracts.
1818

1919
extern mod std;
20-
21-
use core::cell::Cell;
22-
use core::pipes::recv;
2320
use std::time;
2421
use std::future;
2522

23+
use core::pipes::recv;
24+
2625
proto! ring (
2726
num:send {
2827
num(uint) -> num
@@ -81,12 +80,17 @@ fn main() {
8180
for uint::range(1u, num_tasks) |i| {
8281
//error!("spawning %?", i);
8382
let (new_chan, num_port) = ring::init();
84-
let num_chan2 = Cell(num_chan);
85-
let num_port = Cell(num_port);
83+
let num_chan2 = ~mut None;
84+
*num_chan2 <-> num_chan;
85+
let num_port = ~mut Some(num_port);
8686
let new_future = do future::spawn || {
87-
let num_chan = num_chan2.take();
88-
let num_port1 = num_port.take();
89-
thread_ring(i, msg_per_task, num_chan, num_port1)
87+
let mut num_chan = None;
88+
num_chan <-> *num_chan2;
89+
let mut num_port1 = None;
90+
num_port1 <-> *num_port;
91+
thread_ring(i, msg_per_task,
92+
option::unwrap(num_chan),
93+
option::unwrap(num_port1))
9094
};
9195
futures.push(new_future);
9296
num_chan = Some(new_chan);

src/test/bench/msgsend-ring-rw-arcs.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,17 @@ fn main() {
8787
for uint::range(1u, num_tasks) |i| {
8888
//error!("spawning %?", i);
8989
let (new_chan, num_port) = init();
90-
let num_chan2 = Cell(num_chan);
91-
let num_port = Cell(num_port);
92-
let new_future = do future::spawn {
93-
let num_chan = num_chan2.take();
94-
let num_port1 = num_port.take();
95-
thread_ring(i, msg_per_task, num_chan, num_port1)
90+
let num_chan2 = ~mut None;
91+
*num_chan2 <-> num_chan;
92+
let num_port = ~mut Some(num_port);
93+
let new_future = do future::spawn || {
94+
let mut num_chan = None;
95+
num_chan <-> *num_chan2;
96+
let mut num_port1 = None;
97+
num_port1 <-> *num_port;
98+
thread_ring(i, msg_per_task,
99+
option::unwrap(num_chan),
100+
option::unwrap(num_port1))
96101
};
97102
futures.push(new_future);
98103
num_chan = Some(new_chan);

src/test/bench/task-perf-jargon-metal-smoke.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717
//
1818
// The filename is a song reference; google it in quotes.
1919

20-
use core::cell::Cell;
21-
2220
fn child_generation(gens_left: uint, -c: comm::Chan<()>) {
2321
// This used to be O(n^2) in the number of generations that ever existed.
2422
// With this code, only as many generations are alive at a time as tasks
2523
// alive at a time,
26-
let c = Cell(c);
27-
do task::spawn_supervised {
28-
let c = c.take();
24+
let c = ~mut Some(c);
25+
do task::spawn_supervised || {
26+
let c = option::swap_unwrap(c);
2927
if gens_left & 1 == 1 {
3028
task::yield(); // shake things up a bit
3129
}

src/test/compile-fail/mutable-huh-variance-deep.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
// error-pattern: mismatched types
1212

1313
fn main() {
14-
let v = @[mut @mut @mut @[0]];
14+
let v = ~[mut @mut ~mut ~[0]];
1515

16-
fn f(&&v: @[mut @mut @mut @[const int]]) {
16+
fn f(&&v: ~[mut @mut ~mut ~[const int]]) {
1717
}
1818

1919
f(v);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// error-pattern: mismatched types
12+
13+
fn main() {
14+
let v = ~mut ~[0];
15+
16+
fn f(&&v: ~mut ~[const int]) {
17+
*v = ~[mut 3]
18+
}
19+
20+
f(v);
21+
}

src/test/compile-fail/no-send-res-ports.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use core::cell::Cell;
12-
1311
struct Port<T>(@T);
1412

1513
fn main() {
@@ -27,10 +25,11 @@ fn main() {
2725
}
2826
}
2927

30-
let x = Cell(foo(Port(@())));
28+
let x = ~mut Some(foo(Port(@())));
3129

3230
do task::spawn {
33-
let y = x.take(); //~ ERROR value has non-owned type
31+
let mut y = None;
32+
*x <-> y; //~ ERROR value has non-owned type
3433
log(error, y);
3534
}
3635
}

src/test/compile-fail/unique-mut.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//error-pattern:mismatched types
12+
fn main() {
13+
let i: ~int = ~mut 0;
14+
}

src/test/run-pass/borrowck-preserve-box-in-uniq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn borrow(x: &int, f: fn(x: &int)) {
2020
struct F { f: ~int }
2121

2222
pub fn main() {
23-
let mut x = ~@F{f: ~3};
23+
let mut x = ~mut @F{f: ~3};
2424
do borrow(x.f) |b_x| {
2525
assert *b_x == 3;
2626
assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x));

src/test/run-pass/explicit-self-closures.rs

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ impl Box {
2121
fn set_many2(@mut self, xs: &[uint]) {
2222
for xs.each |x| { self.x = *x; }
2323
}
24+
fn set_many3(~mut self, xs: &[uint]) {
25+
for xs.each |x| { self.x = *x; }
26+
}
2427
}
2528

2629
pub fn main() {}

src/test/run-pass/intrinsic-atomics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern mod rusti {
2929

3030
pub fn main() {
3131
unsafe {
32-
let mut x = ~1;
32+
let x = ~mut 1;
3333

3434
assert rusti::atomic_cxchg(x, 1, 2) == 1;
3535
assert *x == 2;

src/test/run-pass/issue-2718.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,18 @@ pub fn main() {
318318
// Commented out because of option::get error
319319
320320
let (client_, server_) = pingpong::init();
321-
let client_ = Cell(client_);
322-
let server_ = Cell(server_);
321+
let client_ = ~mut Some(client_);
322+
let server_ = ~mut Some(server_);
323323
324324
task::spawn {|client_|
325-
let client__ = client_.take();
326-
client(client__);
325+
let mut client__ = none;
326+
*client_ <-> client__;
327+
client(option::unwrap(client__));
327328
};
328329
task::spawn {|server_|
329-
let server__ = server_.take();
330-
server(server_ˊ);
330+
let mut server_ˊ = none;
331+
*server_ <-> server_ˊ;
332+
server(option::unwrap(server_ˊ));
331333
};
332334
*/
333335
}

src/test/run-pass/pipe-pingpong-bounded.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// experiment with what code the compiler should generate for bounded
1515
// protocols.
1616

17-
use core::cell::Cell;
1817

1918
// This was generated initially by the pipe compiler, but it's been
2019
// modified in hopefully straightforward ways.
@@ -112,14 +111,16 @@ mod test {
112111

113112
pub fn main() {
114113
let (client_, server_) = ::pingpong::init();
115-
let client_ = Cell(client_);
116-
let server_ = Cell(server_);
117-
do task::spawn {
118-
let client__ = client_.take();
119-
test::client(client__);
114+
let client_ = ~mut Some(client_);
115+
let server_ = ~mut Some(server_);
116+
do task::spawn || {
117+
let mut client__ = None;
118+
*client_ <-> client__;
119+
test::client(option::unwrap(client__));
120120
};
121-
do task::spawn {
122-
let server__ = server_.take();
123-
test::server(server_ˊ);
121+
do task::spawn || {
122+
let mut server_ˊ = None;
123+
*server_ <-> server_ˊ;
124+
test::server(option::unwrap(server_ˊ));
124125
};
125126
}

src/test/run-pass/pipe-pingpong-proto.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
// An example to make sure the protocol parsing syntax extension works.
1414

15-
use core::cell::Cell;
1615
use core::option;
1716

1817
proto! pingpong (
@@ -50,15 +49,17 @@ mod test {
5049

5150
pub fn main() {
5251
let (client_, server_) = pingpong::init();
53-
let client_ = Cell(client_);
54-
let server_ = Cell(server_);
52+
let client_ = ~mut Some(client_);
53+
let server_ = ~mut Some(server_);
5554

56-
do task::spawn {
57-
let client__ = client_.take();
58-
test::client(client__);
55+
do task::spawn || {
56+
let mut client__ = None;
57+
*client_ <-> client__;
58+
test::client(option::unwrap(client__));
5959
};
60-
do task::spawn {
61-
let server__ = server_.take();
62-
test::server(server_ˊ);
60+
do task::spawn || {
61+
let mut server_ˊ = None;
62+
*server_ <-> server_ˊ;
63+
test::server(option::unwrap(server_ˊ));
6364
};
6465
}

src/test/run-pass/pure-sum.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pure fn sums_to(v: ~[int], sum: int) -> bool {
2020
}
2121

2222
pure fn sums_to_using_uniq(v: ~[int], sum: int) -> bool {
23-
let mut i = 0u, sum0 = ~0;
23+
let mut i = 0u, sum0 = ~mut 0;
2424
while i < v.len() {
2525
*sum0 += v[i];
2626
i += 1u;
@@ -40,7 +40,7 @@ pure fn sums_to_using_rec(v: ~[int], sum: int) -> bool {
4040
struct F<T> { f: T }
4141

4242
pure fn sums_to_using_uniq_rec(v: ~[int], sum: int) -> bool {
43-
let mut i = 0u, sum0 = F {f: ~0};
43+
let mut i = 0u, sum0 = F {f: ~mut 0};
4444
while i < v.len() {
4545
*sum0.f += v[i];
4646
i += 1u;

src/test/run-pass/rcvr-borrowed-to-region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn main() {
3131
debug!("y=%d", y);
3232
assert y == 6;
3333

34-
let mut x = ~6;
34+
let x = ~mut 6;
3535
let y = x.get();
3636
debug!("y=%d", y);
3737
assert y == 6;

src/test/run-pass/task-killjoin-rsrc.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// A port of task-killjoin to use a class with a dtor to manage
1414
// the join.
1515

16-
use core::cell::Cell;
1716
use core::comm::*;
1817

1918
struct notify {
@@ -50,9 +49,11 @@ fn joinable(f: fn~()) -> Port<bool> {
5049
*b = true;
5150
}
5251
let (p, c) = stream();
53-
let c = Cell(c);
52+
let c = ~mut Some(c);
5453
do task::spawn_unlinked {
55-
let ccc = c.take();
54+
let mut cc = None;
55+
*c <-> cc;
56+
let ccc = option::unwrap(cc);
5657
wrapper(ccc, f)
5758
}
5859
p

src/test/run-pass/unique-assign-copy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
pub fn main() {
12-
let mut i = ~1;
12+
let i = ~mut 1;
1313
// Should be a copy
1414
let mut j;
1515
j = copy i;

src/test/run-pass/unique-decl-init-copy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
pub fn main() {
12-
let mut i = ~1;
12+
let i = ~mut 1;
1313
// Should be a copy
1414
let j = copy i;
1515
*i = 2;

src/test/run-pass/unique-in-vec-copy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
pub fn main() {
12-
let mut a = ~[~10];
12+
let a = ~[~mut 10];
1313
let b = copy a;
1414

1515
assert *a[0] == 10;

src/test/run-pass/unique-mutable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
pub fn main() {
12-
let mut i = ~0;
12+
let i = ~mut 0;
1313
*i = 1;
1414
assert *i == 1;
1515
}

0 commit comments

Comments
 (0)