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

Lines changed: 11 additions & 6 deletions
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

Lines changed: 12 additions & 8 deletions
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

Lines changed: 11 additions & 6 deletions
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

Lines changed: 3 additions & 5 deletions
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

Lines changed: 2 additions & 2 deletions
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);
Lines changed: 21 additions & 0 deletions
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

Lines changed: 3 additions & 4 deletions
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

Lines changed: 14 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 0 deletions
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() {}

0 commit comments

Comments
 (0)