From 3dbc1c34e694f38daeef741cfffc558606443c15 Mon Sep 17 00:00:00 2001 From: Scott Lawrence Date: Mon, 27 Jan 2014 18:29:50 -0500 Subject: [PATCH] Remove do keyword from test/ --- src/test/auxiliary/cci_capture_clause.rs | 4 +- src/test/bench/msgsend-pipes-shared.rs | 8 ++-- src/test/bench/msgsend-pipes.rs | 12 ++--- src/test/bench/msgsend-ring-mutex-arcs.rs | 4 +- src/test/bench/msgsend-ring-rw-arcs.rs | 4 +- src/test/bench/rt-messaging-ping-pong.rs | 8 ++-- src/test/bench/rt-parfib.rs | 4 +- src/test/bench/rt-spawn-rate.rs | 2 +- src/test/bench/shootout-binarytrees.rs | 4 +- src/test/bench/shootout-chameneos-redux.rs | 4 +- src/test/bench/shootout-k-nucleotide-pipes.rs | 4 +- src/test/bench/shootout-pfib.rs | 4 +- src/test/bench/shootout-spectralnorm.rs | 4 +- src/test/bench/shootout-threadring.rs | 8 ++-- src/test/bench/silly-test-spawn.rs | 2 +- src/test/bench/spawnone.rs | 2 +- src/test/bench/task-perf-alloc-unwind.rs | 4 +- .../bench/task-perf-jargon-metal-smoke.rs | 4 +- src/test/bench/task-perf-linked-failure.rs | 16 +++---- src/test/bench/task-perf-one-million.rs | 8 ++-- .../arc-rw-read-mode-shouldnt-escape.rs | 2 +- .../arc-rw-write-mode-shouldnt-escape.rs | 2 +- .../borrowck-loan-blocks-move-cc.rs | 4 +- .../compile-fail/do-lambda-requires-braces.rs | 15 ------- src/test/compile-fail/do1.rs | 13 ------ src/test/compile-fail/do2.rs | 16 ------- src/test/compile-fail/issue-3044.rs | 6 +-- .../compile-fail/keyword-do-as-identifier.rs | 15 ------- .../moves-based-on-type-capture-clause-bad.rs | 4 +- src/test/compile-fail/mutex-arc-nested.rs | 4 +- src/test/compile-fail/no-capture-arc.rs | 4 +- src/test/compile-fail/no-reuse-move-arc.rs | 4 +- src/test/compile-fail/no-send-res-ports.rs | 4 +- .../once-cant-call-twice-on-heap.rs | 4 +- .../sync-rwlock-read-mode-shouldnt-escape.rs | 2 +- .../sync-rwlock-write-mode-shouldnt-escape.rs | 2 +- src/test/run-fail/extern-fail.rs | 8 ++-- src/test/run-fail/fail-task-name-none.rs | 4 +- src/test/run-fail/fail-task-name-owned.rs | 4 +- src/test/run-fail/fail-task-name-send-str.rs | 4 +- src/test/run-fail/fail-task-name-static.rs | 4 +- src/test/run-fail/morestack2.rs | 4 +- src/test/run-fail/morestack3.rs | 4 +- src/test/run-fail/morestack4.rs | 4 +- src/test/run-fail/native-failure.rs | 4 +- src/test/run-fail/rt-set-exit-status-fail2.rs | 4 +- .../bootstrap-from-c-with-green/lib.rs | 8 ++-- .../bootstrap-from-c-with-native/lib.rs | 8 ++-- src/test/run-make/static-unwinding/main.rs | 4 +- src/test/run-pass-fulldeps/qquote.rs | 4 +- .../block-arg-can-be-followed-by-binop.rs | 20 --------- .../block-arg-can-be-followed-by-block-arg.rs | 17 ------- .../block-arg-can-be-followed-by-call.rs | 18 -------- src/test/run-pass/block-arg-in-parentheses.rs | 38 ---------------- src/test/run-pass/block-arg-used-as-any.rs | 18 -------- src/test/run-pass/block-arg.rs | 45 ------------------- src/test/run-pass/capture_nil.rs | 4 +- src/test/run-pass/capturing-logging.rs | 8 ++-- .../closure-bounds-can-capture-chan.rs | 4 +- src/test/run-pass/closure-reform.rs | 5 --- src/test/run-pass/do-empty-args.rs | 23 ---------- src/test/run-pass/do-no-args.rs | 19 -------- src/test/run-pass/do1.rs | 15 ------- src/test/run-pass/do2.rs | 15 ------- src/test/run-pass/do3.rs | 15 ------- src/test/run-pass/extern-call-deep2.rs | 4 +- src/test/run-pass/extern-call-scrub.rs | 4 +- src/test/run-pass/extern-stress.rs | 4 +- src/test/run-pass/extern-yield.rs | 4 +- .../run-pass/fail-in-dtor-drops-fields.rs | 4 +- src/test/run-pass/foreign-call-no-runtime.rs | 4 +- src/test/run-pass/infinite-loops.rs | 4 +- src/test/run-pass/issue-2185.rs | 8 ++-- src/test/run-pass/issue-3168.rs | 8 ++-- src/test/run-pass/issue-3609.rs | 5 +-- src/test/run-pass/issue-4241.rs | 8 ++-- src/test/run-pass/issue-4446.rs | 4 +- src/test/run-pass/issue-4448.rs | 4 +- .../kindck-implicit-close-over-mut-var.rs | 12 ++--- src/test/run-pass/logging-only-prints-once.rs | 4 +- .../moves-based-on-type-capture-clause.rs | 4 +- src/test/run-pass/native-always-waits.rs | 8 ++-- src/test/run-pass/no-landing-pads.rs | 4 +- src/test/run-pass/once-move-out-on-heap.rs | 4 +- src/test/run-pass/preempt.rs | 4 +- src/test/run-pass/send-resource.rs | 4 +- src/test/run-pass/task-comm-12.rs | 4 +- src/test/run-pass/task-comm-7.rs | 16 +++---- src/test/run-pass/task-comm-9.rs | 4 +- src/test/run-pass/task-killjoin-rsrc.rs | 4 +- src/test/run-pass/trait-bounds-in-arc.rs | 6 +-- .../run-pass/unit-like-struct-drop-run.rs | 4 +- 92 files changed, 191 insertions(+), 499 deletions(-) delete mode 100644 src/test/compile-fail/do-lambda-requires-braces.rs delete mode 100644 src/test/compile-fail/do1.rs delete mode 100644 src/test/compile-fail/do2.rs delete mode 100644 src/test/compile-fail/keyword-do-as-identifier.rs delete mode 100644 src/test/run-pass/block-arg-can-be-followed-by-binop.rs delete mode 100644 src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs delete mode 100644 src/test/run-pass/block-arg-can-be-followed-by-call.rs delete mode 100644 src/test/run-pass/block-arg-in-parentheses.rs delete mode 100644 src/test/run-pass/block-arg-used-as-any.rs delete mode 100644 src/test/run-pass/do-empty-args.rs delete mode 100644 src/test/run-pass/do-no-args.rs delete mode 100644 src/test/run-pass/do1.rs delete mode 100644 src/test/run-pass/do2.rs delete mode 100644 src/test/run-pass/do3.rs diff --git a/src/test/auxiliary/cci_capture_clause.rs b/src/test/auxiliary/cci_capture_clause.rs index ed896af69b41..3bf084b5fdae 100644 --- a/src/test/auxiliary/cci_capture_clause.rs +++ b/src/test/auxiliary/cci_capture_clause.rs @@ -12,8 +12,8 @@ use std::task; pub fn foo(x: T) -> Port { let (p, c) = Chan::new(); - do task::spawn() { + task::spawn(proc() { c.send(x.clone()); - } + }); p } diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index 50cb00b25d4b..aa4e0f1ae580 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -64,17 +64,17 @@ fn run(args: &[~str]) { let to_child = to_child.clone(); let mut builder = task::task(); worker_results.push(builder.future_result()); - do builder.spawn { + builder.spawn(proc() { for _ in range(0u, size / workers) { //error!("worker {:?}: sending {:?} bytes", i, num_bytes); to_child.send(bytes(num_bytes)); } //error!("worker {:?} exiting", i); - } + }); } - do task::spawn || { + task::spawn(proc() { server(&from_parent, &to_parent); - } + }); for r in worker_results.iter() { r.recv(); diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 3cf1a97a36e0..6ce0f9de8d0a 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -58,13 +58,13 @@ fn run(args: &[~str]) { let (from_parent, to_child) = Chan::new(); let mut builder = task::task(); worker_results.push(builder.future_result()); - do builder.spawn { + builder.spawn(proc() { for _ in range(0u, size / workers) { //error!("worker {:?}: sending {:?} bytes", i, num_bytes); to_child.send(bytes(num_bytes)); } //error!("worker {:?} exiting", i); - }; + }); from_parent } else { let (from_parent, to_child) = SharedChan::new(); @@ -72,19 +72,19 @@ fn run(args: &[~str]) { let to_child = to_child.clone(); let mut builder = task::task(); worker_results.push(builder.future_result()); - do builder.spawn { + builder.spawn(proc() { for _ in range(0u, size / workers) { //error!("worker {:?}: sending {:?} bytes", i, num_bytes); to_child.send(bytes(num_bytes)); } //error!("worker {:?} exiting", i); - }; + }); } from_parent }; - do task::spawn || { + task::spawn(proc() { server(&from_parent, &to_parent); - } + }); for r in worker_results.iter() { r.recv(); diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index a5838f201738..b1b2300466a5 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -91,9 +91,9 @@ fn main() { //error!("spawning %?", i); let (new_chan, num_port) = init(); let num_chan_2 = num_chan.clone(); - let new_future = do Future::spawn() { + let new_future = Future::spawn(proc() { thread_ring(i, msg_per_task, num_chan_2, num_port) - }; + }); futures.push(new_future); num_chan = new_chan; }; diff --git a/src/test/bench/msgsend-ring-rw-arcs.rs b/src/test/bench/msgsend-ring-rw-arcs.rs index fa7026b6569f..d7bd0f2f6bd3 100644 --- a/src/test/bench/msgsend-ring-rw-arcs.rs +++ b/src/test/bench/msgsend-ring-rw-arcs.rs @@ -87,9 +87,9 @@ fn main() { //error!("spawning %?", i); let (new_chan, num_port) = init(); let num_chan_2 = num_chan.clone(); - let new_future = do Future::spawn { + let new_future = Future::spawn(proc() { thread_ring(i, msg_per_task, num_chan_2, num_port) - }; + }); futures.push(new_future); num_chan = new_chan; }; diff --git a/src/test/bench/rt-messaging-ping-pong.rs b/src/test/bench/rt-messaging-ping-pong.rs index 6eef71622c5c..29904de897eb 100644 --- a/src/test/bench/rt-messaging-ping-pong.rs +++ b/src/test/bench/rt-messaging-ping-pong.rs @@ -26,23 +26,23 @@ fn ping_pong_bench(n: uint, m: uint) { // Create a stream B->A let (pb,cb) = Chan::<()>::new(); - do spawn() || { + spawn(proc() { let chan = ca; let port = pb; n.times(|| { chan.send(()); port.recv(); }) - } + }); - do spawn() || { + spawn(proc() { let chan = cb; let port = pa; n.times(|| { port.recv(); chan.send(()); }) - } + }); } m.times(|| { diff --git a/src/test/bench/rt-parfib.rs b/src/test/bench/rt-parfib.rs index 6e3c42f2a4de..59f5afa47daf 100644 --- a/src/test/bench/rt-parfib.rs +++ b/src/test/bench/rt-parfib.rs @@ -23,9 +23,9 @@ fn parfib(n: uint) -> uint { } let (port,chan) = Chan::new(); - do spawn { + spawn(proc() { chan.send(parfib(n-1)); - }; + }); let m2 = parfib(n-2); return (port.recv() + m2); } diff --git a/src/test/bench/rt-spawn-rate.rs b/src/test/bench/rt-spawn-rate.rs index e057d6862e6a..f3bb168f6511 100644 --- a/src/test/bench/rt-spawn-rate.rs +++ b/src/test/bench/rt-spawn-rate.rs @@ -27,7 +27,7 @@ fn main() { }; n.times(|| { - do spawn || {}; + spawn(proc() {}); }) } diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index 7abbbdd278cf..1a4ad2297181 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -64,7 +64,7 @@ fn main() { let mut messages = range_step(min_depth, max_depth + 1, 2).map(|depth| { use std::num::pow; let iterations = pow(2, (max_depth - depth + min_depth) as uint); - do Future::spawn { + Future::spawn(proc() { let mut chk = 0; for i in range(1, iterations + 1) { let arena = TypedArena::new(); @@ -74,7 +74,7 @@ fn main() { } format!("{}\t trees of depth {}\t check: {}", iterations * 2, depth, chk) - } + }) }).to_owned_vec(); for message in messages.mut_iter() { diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 2a5f7f0b87e9..7281667e6769 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -152,13 +152,13 @@ fn rendezvous(nn: uint, set: ~[color]) { let to_rendezvous = to_rendezvous.clone(); let to_rendezvous_log = to_rendezvous_log.clone(); let (from_rendezvous, to_creature) = Chan::new(); - do task::spawn { + task::spawn(proc() { creature(ii, col, from_rendezvous, to_rendezvous.clone(), to_rendezvous_log.clone()); - } + }); to_creature }).collect(); diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 83eb1388c6b1..375f9154841f 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -168,9 +168,9 @@ fn main() { let (from_parent, to_child) = Chan::new(); - do spawn { + spawn(proc() { make_sequence_processor(sz, &from_parent, &to_parent_); - } + }); to_child }).collect::<~[Chan<~[u8]>]>(); diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index aa060ceb0973..040c8526ee04 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -79,9 +79,9 @@ fn stress(num_tasks: int) { for i in range(0, num_tasks) { let mut builder = task::task(); results.push(builder.future_result()); - do builder.spawn { + builder.spawn(proc() { stress_task(i); - } + }); } for r in results.iter() { r.recv(); diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs index 8174347e3869..d68ca4e0abba 100644 --- a/src/test/bench/shootout-spectralnorm.rs +++ b/src/test/bench/shootout-spectralnorm.rs @@ -41,13 +41,13 @@ fn mult(v: RWArc<~[f64]>, out: RWArc<~[f64]>, f: fn(&~[f64], uint) -> f64) { let w = wait.clone(); let v = v.clone(); let out = out.clone(); - do spawn { + spawn(proc() { for i in range(chk, min(len, chk + chunk)) { let val = v.read(|v| f(v, i)); out.write(|out| out[i] = val); } let _ = w; - } + }); } let _ = wait.unwrap(); } diff --git a/src/test/bench/shootout-threadring.rs b/src/test/bench/shootout-threadring.rs index 862b047db22f..7063194eab86 100644 --- a/src/test/bench/shootout-threadring.rs +++ b/src/test/bench/shootout-threadring.rs @@ -23,17 +23,17 @@ fn start(n_tasks: int, token: int) { let (next_p, ch) = Chan::new(); let imm_i = i; let imm_p = p; - do spawn { + spawn(proc() { roundtrip(imm_i, n_tasks, &imm_p, &ch); - }; + }); p = next_p; i += 1; } let imm_p = p; let imm_ch = ch1; - do spawn { + spawn(proc() { roundtrip(1, n_tasks, &imm_p, &imm_ch); - } + }); } fn roundtrip(id: int, n_tasks: int, p: &Port, ch: &Chan) { diff --git a/src/test/bench/silly-test-spawn.rs b/src/test/bench/silly-test-spawn.rs index 900796efe33d..16a9c03225ad 100644 --- a/src/test/bench/silly-test-spawn.rs +++ b/src/test/bench/silly-test-spawn.rs @@ -11,6 +11,6 @@ // Useful smoketest for scheduler performance. fn main() { for _ in range(1, 100_000) { - do spawn { } + spawn(proc() {}) } } diff --git a/src/test/bench/spawnone.rs b/src/test/bench/spawnone.rs index 75485a7fb9ec..b55f471bdb24 100644 --- a/src/test/bench/spawnone.rs +++ b/src/test/bench/spawnone.rs @@ -10,5 +10,5 @@ // Useful for checking syscall usage of baseline scheduler usage fn main() { - do spawn { } + spawn(proc() {}); } diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index db46c3db439a..58fdadc2064d 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -34,9 +34,9 @@ fn main() { fn run(repeat: int, depth: int) { for _ in range(0, repeat) { info!("starting {:.4f}", precise_time_s()); - do task::try { + task::try(proc() { recurse_or_fail(depth, None) - }; + }); info!("stopping {:.4f}", precise_time_s()); } } diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs index dc31ef06fa6f..b41f6bcc50ad 100644 --- a/src/test/bench/task-perf-jargon-metal-smoke.rs +++ b/src/test/bench/task-perf-jargon-metal-smoke.rs @@ -26,7 +26,7 @@ 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, - do spawn { + spawn(proc() { if gens_left & 1 == 1 { task::deschedule(); // shake things up a bit } @@ -35,7 +35,7 @@ fn child_generation(gens_left: uint, c: comm::Chan<()>) { } else { c.send(()) } - } + }); } fn main() { diff --git a/src/test/bench/task-perf-linked-failure.rs b/src/test/bench/task-perf-linked-failure.rs index eb0e64268f35..052900102c9a 100644 --- a/src/test/bench/task-perf-linked-failure.rs +++ b/src/test/bench/task-perf-linked-failure.rs @@ -36,11 +36,11 @@ fn grandchild_group(num_tasks: uint) { for _ in range(0, num_tasks) { let ch = ch.clone(); let mut t = task::task(); - do t.spawn { // linked + t.spawn(proc() { // linked ch.send(()); let (p, _c) = stream::<()>(); p.recv(); // block forever - } + }); } error!("Grandchild group getting started"); for _ in range(0, num_tasks) { @@ -77,17 +77,17 @@ fn main() { // Main group #0 waits for unsupervised group #1. // Grandparent group #1 waits for middle group #2, then fails, killing #3. // Middle group #2 creates grandchild_group #3, waits for it to be ready, exits. - let x: result::Result<(), ~Any> = do task::try { // unlinked - do spawn_supervised_blocking("grandparent") { - do spawn_supervised_blocking("middle") { + let x: result::Result<(), ~Any> = task::try(proc() { // unlinked + spawn_supervised_blocking("grandparent", proc() { + spawn_supervised_blocking("middle", proc() { grandchild_group(num_tasks); - } + }); // When grandchild group is ready to go, make the middle group exit. error!("Middle group wakes up and exits"); - } + }); // Grandparent group waits for middle group to be gone, then fails error!("Grandparent group wakes up and fails"); fail!(); - }; + }); assert!(x.is_err()); } diff --git a/src/test/bench/task-perf-one-million.rs b/src/test/bench/task-perf-one-million.rs index e9a9ed194749..454c7e45cc16 100644 --- a/src/test/bench/task-perf-one-million.rs +++ b/src/test/bench/task-perf-one-million.rs @@ -21,9 +21,9 @@ fn calc(children: uint, parent_wait_chan: &Chan>>) { let wait_ports: ~[Port>>] = vec::from_fn(children, |_| { let (wait_port, wait_chan) = stream::>>(); - do task::spawn { + task::spawn(proc() { calc(children / 2, &wait_chan); - } + }); wait_port }); @@ -58,9 +58,9 @@ fn main() { let children = from_str::(args[1]).unwrap(); let (wait_port, wait_chan) = stream(); - do task::spawn { + task::spawn(proc() { calc(children, &wait_chan); - }; + }); let start_chan = wait_port.recv(); let (sum_port, sum_chan) = stream::(); diff --git a/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs b/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs index 2fe2095ca879..716dfe2c8b5c 100644 --- a/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs +++ b/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs @@ -19,5 +19,5 @@ fn main() { }); y.unwrap(); // Adding this line causes a method unification failure instead - // do (&option::unwrap(y)).read |state| { assert!(*state == 1); } + // (&option::unwrap(y)).read(|state| { assert!(*state == 1); }) } diff --git a/src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs b/src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs index d9247ab4fc17..213bf48a0875 100644 --- a/src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs +++ b/src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs @@ -17,5 +17,5 @@ fn main() { x.write_downgrade(|write_mode| y = Some(write_mode)); y.unwrap(); // Adding this line causes a method unification failure instead - // do (&option::unwrap(y)).write |state| { assert!(*state == 1); } + // (&option::unwrap(y)).write(|state| { assert!(*state == 1); }) } diff --git a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs index c935c9deeac1..c193288468a2 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs @@ -17,10 +17,10 @@ fn borrow(v: &int, f: |x: &int|) { fn box_imm() { let v = ~3; let _w = &v; - do task::spawn { + task::spawn(proc() { info!("v={}", *v); //~^ ERROR cannot move `v` into closure - } + }); let v = ~3; let _w = &v; diff --git a/src/test/compile-fail/do-lambda-requires-braces.rs b/src/test/compile-fail/do-lambda-requires-braces.rs deleted file mode 100644 index a836556dff88..000000000000 --- a/src/test/compile-fail/do-lambda-requires-braces.rs +++ /dev/null @@ -1,15 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - do something - |x| do somethingelse //~ ERROR: expected `{` but found `do` - |y| say(x, y) -} diff --git a/src/test/compile-fail/do1.rs b/src/test/compile-fail/do1.rs deleted file mode 100644 index d16fa4eadd56..000000000000 --- a/src/test/compile-fail/do1.rs +++ /dev/null @@ -1,13 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - let x = do y; //~ ERROR: expected `{` but found -} diff --git a/src/test/compile-fail/do2.rs b/src/test/compile-fail/do2.rs deleted file mode 100644 index 309abe218f6f..000000000000 --- a/src/test/compile-fail/do2.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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn f(f: proc(int) -> bool) -> bool { f(10i) } - -fn main() { - assert!(do f() |i| { i == 10i } == 10i); - //~^ ERROR: expected `bool` but found `int` -} diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/compile-fail/issue-3044.rs index 310de3657b38..5fab2ed195ce 100644 --- a/src/test/compile-fail/issue-3044.rs +++ b/src/test/compile-fail/issue-3044.rs @@ -10,9 +10,9 @@ fn main() { let needlesArr: ~[char] = ~['a', 'f']; - do needlesArr.iter().fold() |x, y| { - } - //~^^ ERROR 1 parameter was supplied (including the closure passed by the `do` keyword) + needlesArr.iter().fold(|x, y| { + }); + //~^^ ERROR this function takes 2 parameters but 1 parameter was supplied // // the first error is, um, non-ideal. } diff --git a/src/test/compile-fail/keyword-do-as-identifier.rs b/src/test/compile-fail/keyword-do-as-identifier.rs deleted file mode 100644 index b2a0c8a02a90..000000000000 --- a/src/test/compile-fail/keyword-do-as-identifier.rs +++ /dev/null @@ -1,15 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This file was auto-generated using 'src/etc/generate-keyword-tests.py do' - -fn main() { - let do = "foo"; //~ error: ident -} diff --git a/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs b/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs index dd68cb8e994e..fe9c7ede83a0 100644 --- a/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs +++ b/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs @@ -2,8 +2,8 @@ use std::task; fn main() { let x = ~"Hello world!"; - do task::spawn { + task::spawn(proc() { println!("{}", x); - } + }); println!("{}", x); //~ ERROR use of moved value } diff --git a/src/test/compile-fail/mutex-arc-nested.rs b/src/test/compile-fail/mutex-arc-nested.rs index 476b890efcd6..24a141c4799d 100644 --- a/src/test/compile-fail/mutex-arc-nested.rs +++ b/src/test/compile-fail/mutex-arc-nested.rs @@ -17,10 +17,10 @@ fn test_mutex_arc_nested() { let arc = ~MutexArc::new(1); let arc2 = ~MutexArc::new(*arc); - do task::spawn || { + task::spawn(proc() { (*arc2).access(|mutex| { //~ ERROR instantiating a type parameter with an incompatible type }) - }; + }); } fn main() {} diff --git a/src/test/compile-fail/no-capture-arc.rs b/src/test/compile-fail/no-capture-arc.rs index 65e0c07b3580..5ae38e69ec0e 100644 --- a/src/test/compile-fail/no-capture-arc.rs +++ b/src/test/compile-fail/no-capture-arc.rs @@ -19,10 +19,10 @@ fn main() { let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; let arc_v = arc::Arc::new(v); - do task::spawn() { + task::spawn(proc() { let v = arc_v.get(); assert_eq!(v[3], 4); - }; + }); assert_eq!((arc_v.get())[2], 3); diff --git a/src/test/compile-fail/no-reuse-move-arc.rs b/src/test/compile-fail/no-reuse-move-arc.rs index 3cd048040c6f..c6c0ba41ab91 100644 --- a/src/test/compile-fail/no-reuse-move-arc.rs +++ b/src/test/compile-fail/no-reuse-move-arc.rs @@ -17,10 +17,10 @@ fn main() { let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; let arc_v = arc::Arc::new(v); - do task::spawn() { + task::spawn(proc() { let v = arc_v.get(); assert_eq!(v[3], 4); - }; + }); assert_eq!((arc_v.get())[2], 3); //~ ERROR use of moved value: `arc_v` diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index 87173d779240..9e564e997e67 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -32,8 +32,8 @@ fn main() { let x = foo(Port(@())); - do task::spawn { + task::spawn(proc() { let y = x; //~ ERROR does not fulfill `Send` error!("{:?}", y); - } + }); } diff --git a/src/test/compile-fail/once-cant-call-twice-on-heap.rs b/src/test/compile-fail/once-cant-call-twice-on-heap.rs index e2220355980e..8d5e2229b2e5 100644 --- a/src/test/compile-fail/once-cant-call-twice-on-heap.rs +++ b/src/test/compile-fail/once-cant-call-twice-on-heap.rs @@ -22,8 +22,8 @@ fn foo(blk: proc()) { fn main() { let x = arc::Arc::new(true); - do foo { + foo(proc() { assert!(*x.get()); drop(x); - } + }); } diff --git a/src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs b/src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs index e71dfc588161..0078841acb13 100644 --- a/src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs +++ b/src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs @@ -18,5 +18,5 @@ fn main() { y = Some(x.downgrade(write_mode)); }) // Adding this line causes a method unification failure instead - // do (&option::unwrap(y)).read { } + // (&option::unwrap(y)).read(proc() { }); } diff --git a/src/test/compile-fail/sync-rwlock-write-mode-shouldnt-escape.rs b/src/test/compile-fail/sync-rwlock-write-mode-shouldnt-escape.rs index af0149182aeb..6e9216830750 100644 --- a/src/test/compile-fail/sync-rwlock-write-mode-shouldnt-escape.rs +++ b/src/test/compile-fail/sync-rwlock-write-mode-shouldnt-escape.rs @@ -18,5 +18,5 @@ fn main() { y = Some(write_mode); }); // Adding this line causes a method unification failure instead - // do (&option::unwrap(y)).write { } + // (&option::unwrap(y)).write(proc() { }) } diff --git a/src/test/run-fail/extern-fail.rs b/src/test/run-fail/extern-fail.rs index ce5ea56502cc..b998056176e3 100644 --- a/src/test/run-fail/extern-fail.rs +++ b/src/test/run-fail/extern-fail.rs @@ -41,11 +41,11 @@ fn count(n: uint) -> uint { } fn main() { - do 10u.times { - do task::spawn { + 10u.times(proc() { + task::spawn(proc() { let result = count(5u); info!("result = %?", result); fail!(); - }; - } + }); + }); } diff --git a/src/test/run-fail/fail-task-name-none.rs b/src/test/run-fail/fail-task-name-none.rs index 9d58c1820087..3f662e6d0e3e 100644 --- a/src/test/run-fail/fail-task-name-none.rs +++ b/src/test/run-fail/fail-task-name-none.rs @@ -13,8 +13,8 @@ use std::task; fn main() { - do task::try { + task::try(proc() { fail!("test"); 1 - }.unwrap() + }).unwrap() } diff --git a/src/test/run-fail/fail-task-name-owned.rs b/src/test/run-fail/fail-task-name-owned.rs index 9e87b59db649..a1115a09fb17 100644 --- a/src/test/run-fail/fail-task-name-owned.rs +++ b/src/test/run-fail/fail-task-name-owned.rs @@ -15,8 +15,8 @@ use std::task; fn main() { let mut t = task::task(); t.name(~"owned name"); - do t.try { + t.try(proc() { fail!("test"); 1 - }.unwrap() + }).unwrap() } diff --git a/src/test/run-fail/fail-task-name-send-str.rs b/src/test/run-fail/fail-task-name-send-str.rs index 0e3ef39cd1db..ca2472cfa55f 100644 --- a/src/test/run-fail/fail-task-name-send-str.rs +++ b/src/test/run-fail/fail-task-name-send-str.rs @@ -13,8 +13,8 @@ fn main() { let mut t = ::std::task::task(); t.name("send name".to_send_str()); - do t.try { + t.try(proc() { fail!("test"); 3 - }.unwrap() + }).unwrap() } diff --git a/src/test/run-fail/fail-task-name-static.rs b/src/test/run-fail/fail-task-name-static.rs index 4fd19fb2a6f2..2303ab102d40 100644 --- a/src/test/run-fail/fail-task-name-static.rs +++ b/src/test/run-fail/fail-task-name-static.rs @@ -13,7 +13,7 @@ fn main() { let mut t = ::std::task::task(); t.name("static name"); - do t.try { + t.try(proc() { fail!("test"); - }.unwrap() + }).unwrap() } diff --git a/src/test/run-fail/morestack2.rs b/src/test/run-fail/morestack2.rs index 5ac309264003..1094227770ef 100644 --- a/src/test/run-fail/morestack2.rs +++ b/src/test/run-fail/morestack2.rs @@ -62,8 +62,8 @@ fn and_then_get_big_again(x:int) -> and_then_get_big_again { } fn main() { - do task::spawn { + task::spawn(proc() { let r = and_then_get_big_again(4); getbig_call_c_and_fail(10000); - }; + }); } diff --git a/src/test/run-fail/morestack3.rs b/src/test/run-fail/morestack3.rs index e6f219710b37..6acfa0b79f41 100644 --- a/src/test/run-fail/morestack3.rs +++ b/src/test/run-fail/morestack3.rs @@ -48,7 +48,7 @@ fn and_then_get_big_again(x:int) -> and_then_get_big_again { } fn main() { - do task::spawn { + task::spawn(proc() { getbig_and_fail(400); - }; + }); } diff --git a/src/test/run-fail/morestack4.rs b/src/test/run-fail/morestack4.rs index 02a65e91d044..8be8e6b44f6a 100644 --- a/src/test/run-fail/morestack4.rs +++ b/src/test/run-fail/morestack4.rs @@ -41,7 +41,7 @@ fn and_then_get_big_again(x:int) -> and_then_get_big_again { } fn main() { - do task::spawn { + task::spawn(proc() { getbig_and_fail(1); - }; + }); } diff --git a/src/test/run-fail/native-failure.rs b/src/test/run-fail/native-failure.rs index 807ee94ce09a..20d8a543ae19 100644 --- a/src/test/run-fail/native-failure.rs +++ b/src/test/run-fail/native-failure.rs @@ -17,7 +17,7 @@ extern mod native; #[start] fn start(argc: int, argv: **u8) -> int { - do native::start(argc, argv) { + native::start(argc, argv, proc() { fail!(); - } + }) } diff --git a/src/test/run-fail/rt-set-exit-status-fail2.rs b/src/test/run-fail/rt-set-exit-status-fail2.rs index ea70bb0eab9a..d19788d8b5b8 100644 --- a/src/test/run-fail/rt-set-exit-status-fail2.rs +++ b/src/test/run-fail/rt-set-exit-status-fail2.rs @@ -34,8 +34,8 @@ fn r(x:int) -> r { fn main() { error!("whatever"); - do task::spawn { + task::spawn(proc() { let _i = r(5); - }; + }); fail!(); } diff --git a/src/test/run-make/bootstrap-from-c-with-green/lib.rs b/src/test/run-make/bootstrap-from-c-with-green/lib.rs index 452ee837d129..94119cc0278d 100644 --- a/src/test/run-make/bootstrap-from-c-with-green/lib.rs +++ b/src/test/run-make/bootstrap-from-c-with-green/lib.rs @@ -17,9 +17,9 @@ extern mod green; #[no_mangle] // this needs to get called from C pub extern "C" fn foo(argc: int, argv: **u8) -> int { - do green::start(argc, argv) { - do spawn { + green::start(argc, argv, proc() { + spawn(proc() { println!("hello"); - } - } + }); + }) } diff --git a/src/test/run-make/bootstrap-from-c-with-native/lib.rs b/src/test/run-make/bootstrap-from-c-with-native/lib.rs index 4f931bdb8011..2a783606d944 100644 --- a/src/test/run-make/bootstrap-from-c-with-native/lib.rs +++ b/src/test/run-make/bootstrap-from-c-with-native/lib.rs @@ -16,9 +16,9 @@ extern mod native; #[no_mangle] // this needs to get called from C pub extern "C" fn foo(argc: int, argv: **u8) -> int { - do native::start(argc, argv) { - do spawn { + native::start(argc, argv, proc() { + spawn(proc() { println!("hello"); - } - } + }); + }) } diff --git a/src/test/run-make/static-unwinding/main.rs b/src/test/run-make/static-unwinding/main.rs index 029933a819cc..96dabf8f0769 100644 --- a/src/test/run-make/static-unwinding/main.rs +++ b/src/test/run-make/static-unwinding/main.rs @@ -12,11 +12,11 @@ impl Drop for A { } fn main() { - do task::try { + task::try(proc() { let _a = A; lib::callback(|| fail!()); 1 - }; + }); unsafe { assert!(lib::statik == 1); diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs index 0fcd49790e07..05225eb0e7ad 100644 --- a/src/test/run-pass-fulldeps/qquote.rs +++ b/src/test/run-pass-fulldeps/qquote.rs @@ -75,11 +75,11 @@ fn main() { fn check_pp(cx: fake_ext_ctxt, expr: T, f: |pprust::ps, T|, expect: ~str) { - let s = do io::with_str_writer |wr| { + let s = io::with_str_writer(|wr| { let pp = pprust::rust_printer(wr, cx.parse_sess().interner); f(pp, expr); pp::eof(pp.s); - }; + }); stdout().write_line(s); if expect != ~"" { error!("expect: '%s', got: '%s'", expect, s); diff --git a/src/test/run-pass/block-arg-can-be-followed-by-binop.rs b/src/test/run-pass/block-arg-can-be-followed-by-binop.rs deleted file mode 100644 index f2149e23210c..000000000000 --- a/src/test/run-pass/block-arg-can-be-followed-by-binop.rs +++ /dev/null @@ -1,20 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn add(x: proc(f64) -> f64) -> f64 { - x(10.0) -} - -pub fn main() { - // Trailing expressions don't require parentheses: - let y = do add |x| { x + 10.0 } + 10.0; - - assert_eq!(y, 30.0); -} diff --git a/src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs b/src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs deleted file mode 100644 index 2cdf0a1ffe1f..000000000000 --- a/src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs +++ /dev/null @@ -1,17 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn f(_: proc()) -> proc(proc() -> uint) { - proc(_: proc() -> uint) {} -} - -pub fn main() { - do do f {} { 20 }; -} diff --git a/src/test/run-pass/block-arg-can-be-followed-by-call.rs b/src/test/run-pass/block-arg-can-be-followed-by-call.rs deleted file mode 100644 index 544367bdfa9d..000000000000 --- a/src/test/run-pass/block-arg-can-be-followed-by-call.rs +++ /dev/null @@ -1,18 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn f(_: proc()) -> proc(uint) -> uint { - proc(x: uint) { x } -} - -pub fn main() { - let z = do f {} (22u); - assert_eq!(z, 22u); -} diff --git a/src/test/run-pass/block-arg-in-parentheses.rs b/src/test/run-pass/block-arg-in-parentheses.rs deleted file mode 100644 index 083217132de1..000000000000 --- a/src/test/run-pass/block-arg-in-parentheses.rs +++ /dev/null @@ -1,38 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn f(_: proc(int, int) -> int) -> int { - 10 -} - -fn w_semi() { - // the semicolon causes compiler not to - // complain about the ignored return value: - do f |x, y| { x+y }; -} - -fn w_paren1() -> int { - (do f |x, y| { x+y }) - 10 -} - -fn w_paren2() -> int { - (do f |x, y| { x+y } - 10) -} - -fn w_ret() -> int { - return do f |x, y| { x+y } - 10; -} - -pub fn main() { - w_semi(); - w_paren1(); - w_paren2(); - w_ret(); -} diff --git a/src/test/run-pass/block-arg-used-as-any.rs b/src/test/run-pass/block-arg-used-as-any.rs deleted file mode 100644 index 87a6cbd6fc2f..000000000000 --- a/src/test/run-pass/block-arg-used-as-any.rs +++ /dev/null @@ -1,18 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn call_any(f: proc() -> uint) -> uint { - return f(); -} - -pub fn main() { - let x_r = do call_any { 22u }; - assert_eq!(x_r, 22u); -} diff --git a/src/test/run-pass/block-arg.rs b/src/test/run-pass/block-arg.rs index afe7747457a8..d59804b23954 100644 --- a/src/test/run-pass/block-arg.rs +++ b/src/test/run-pass/block-arg.rs @@ -25,49 +25,4 @@ pub fn main() { info!("{:?}", *i); } - // Usable at all: - do inty |x| { x }; - - // Higher precedence than assignments: - let result = do inty |e| { e }; - assert_eq!(result, 100); - - // Higher precedence than unary operations: - let stringy = do inty |e| { e }.to_str(); - assert!(do booly |_| { true }); - assert!(!do booly |_| { false }); - - // Usable in funny statement-like forms: - if !do booly |_| { true } { - assert!(false); - } - match do booly |_| { false } { - true => { fail!("incorrect answer."); } - false => { } - } - match 3 { - _ if do booly |_| { true } => { - } - _ => { - fail!("wrong answer."); - } - } - - - // Lower precedence than binary operations: - let w = do inty |_| { 10 } + 10; - let y = do inty |_| { 10 } + 10; - let z = 10 + do inty |_| { 10 }; - assert_eq!(w, y); - assert_eq!(y, z); - - // In the tail of a block - let w = if true { - do booly |_| { - true - } - } else { - false - }; - assert!(w); } diff --git a/src/test/run-pass/capture_nil.rs b/src/test/run-pass/capture_nil.rs index 0d9fdea4a9d5..874075e8c140 100644 --- a/src/test/run-pass/capture_nil.rs +++ b/src/test/run-pass/capture_nil.rs @@ -28,9 +28,9 @@ use std::task; fn foo(x: ()) -> Port<()> { let (p, c) = Chan::<()>::new(); - do task::spawn() { + task::spawn(proc() { c.send(x); - } + }); p } diff --git a/src/test/run-pass/capturing-logging.rs b/src/test/run-pass/capturing-logging.rs index b810bfd1c6b7..171424d8b3b6 100644 --- a/src/test/run-pass/capturing-logging.rs +++ b/src/test/run-pass/capturing-logging.rs @@ -30,18 +30,18 @@ impl Logger for MyWriter { #[start] fn start(argc: int, argv: **u8) -> int { - do native::start(argc, argv) { + native::start(argc, argv, proc() { main(); - } + }) } fn main() { let (p, c) = Chan::new(); let (mut r, w) = (PortReader::new(p), ChanWriter::new(c)); - do spawn { + spawn(proc() { set_logger(~MyWriter(w) as ~Logger); debug!("debug"); info!("info"); - } + }); assert_eq!(r.read_to_str(), ~"info\n"); } diff --git a/src/test/run-pass/closure-bounds-can-capture-chan.rs b/src/test/run-pass/closure-bounds-can-capture-chan.rs index 3a92f4ba3f40..66fac94ba51e 100644 --- a/src/test/run-pass/closure-bounds-can-capture-chan.rs +++ b/src/test/run-pass/closure-bounds-can-capture-chan.rs @@ -16,8 +16,8 @@ fn foo(blk: proc()) { pub fn main() { let (p,c) = Chan::new(); - do foo { + foo(proc() { c.send(()); - } + }); p.recv(); } diff --git a/src/test/run-pass/closure-reform.rs b/src/test/run-pass/closure-reform.rs index 61175a401abe..3ed77cd9fb76 100644 --- a/src/test/run-pass/closure-reform.rs +++ b/src/test/run-pass/closure-reform.rs @@ -38,11 +38,6 @@ fn call_bare_again(f: extern "Rust" fn(&str)) { pub fn main() { // Procs - let greeting = ~"Hi "; - do call_it |s| { - greeting + s - } - let greeting = ~"Hello "; call_it(proc(s) { greeting + s diff --git a/src/test/run-pass/do-empty-args.rs b/src/test/run-pass/do-empty-args.rs deleted file mode 100644 index 56ba2ffddbb4..000000000000 --- a/src/test/run-pass/do-empty-args.rs +++ /dev/null @@ -1,23 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-reformat -// Testing various forms of `do` with empty arg lists - -fn f(_f: proc() -> bool) -> bool { - true -} - -pub fn main() { - do f() || { true }; - do f() { true }; - do f || { true }; - do f { true }; -} diff --git a/src/test/run-pass/do-no-args.rs b/src/test/run-pass/do-no-args.rs deleted file mode 100644 index 0df5c82ab077..000000000000 --- a/src/test/run-pass/do-no-args.rs +++ /dev/null @@ -1,19 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Testing that we can drop the || in do exprs - -fn f(_f: proc() -> bool) -> bool { true } - -fn d(_f: proc()) { } - -pub fn main() { - do d { } -} diff --git a/src/test/run-pass/do1.rs b/src/test/run-pass/do1.rs deleted file mode 100644 index bdbad74b3209..000000000000 --- a/src/test/run-pass/do1.rs +++ /dev/null @@ -1,15 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn f(f: proc(int)) { f(10) } - -pub fn main() { - do f() |i| { assert!(i == 10) } -} diff --git a/src/test/run-pass/do2.rs b/src/test/run-pass/do2.rs deleted file mode 100644 index f509f7b454d3..000000000000 --- a/src/test/run-pass/do2.rs +++ /dev/null @@ -1,15 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn f(f: proc(int) -> int) -> int { f(10) } - -pub fn main() { - assert_eq!(do f() |i| { i }, 10); -} diff --git a/src/test/run-pass/do3.rs b/src/test/run-pass/do3.rs deleted file mode 100644 index cdba14f1deda..000000000000 --- a/src/test/run-pass/do3.rs +++ /dev/null @@ -1,15 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn f(f: proc(int) -> int) -> int { f(10) } - -pub fn main() { - assert_eq!(do f |i| { i }, 10); -} diff --git a/src/test/run-pass/extern-call-deep2.rs b/src/test/run-pass/extern-call-deep2.rs index 00ac0bfa118e..500ae8951ec4 100644 --- a/src/test/run-pass/extern-call-deep2.rs +++ b/src/test/run-pass/extern-call-deep2.rs @@ -40,9 +40,9 @@ fn count(n: uint) -> uint { pub fn main() { // Make sure we're on a task with small Rust stacks (main currently // has a large stack) - do task::spawn { + task::spawn(proc() { let result = count(1000u); info!("result = {}", result); assert_eq!(result, 1000u); - }; + }); } diff --git a/src/test/run-pass/extern-call-scrub.rs b/src/test/run-pass/extern-call-scrub.rs index 0044f0f468f3..c35e84154d80 100644 --- a/src/test/run-pass/extern-call-scrub.rs +++ b/src/test/run-pass/extern-call-scrub.rs @@ -44,9 +44,9 @@ fn count(n: uint) -> uint { pub fn main() { // Make sure we're on a task with small Rust stacks (main currently // has a large stack) - do task::spawn { + task::spawn(proc() { let result = count(12u); info!("result = {}", result); assert_eq!(result, 2048u); - }; + }); } diff --git a/src/test/run-pass/extern-stress.rs b/src/test/run-pass/extern-stress.rs index 7c16ae74c4a9..26c7e6881a6c 100644 --- a/src/test/run-pass/extern-stress.rs +++ b/src/test/run-pass/extern-stress.rs @@ -42,8 +42,8 @@ fn count(n: uint) -> uint { pub fn main() { 100u.times(|| { - do task::spawn { + task::spawn(proc() { assert_eq!(count(5u), 16u); - }; + }); }) } diff --git a/src/test/run-pass/extern-yield.rs b/src/test/run-pass/extern-yield.rs index a4ac197ac6ae..da26f92ecdf3 100644 --- a/src/test/run-pass/extern-yield.rs +++ b/src/test/run-pass/extern-yield.rs @@ -39,10 +39,10 @@ fn count(n: uint) -> uint { pub fn main() { 10u.times(|| { - do task::spawn { + task::spawn(proc() { let result = count(5u); info!("result = {}", result); assert_eq!(result, 16u); - }; + }); }) } diff --git a/src/test/run-pass/fail-in-dtor-drops-fields.rs b/src/test/run-pass/fail-in-dtor-drops-fields.rs index 7c6bb1fa379b..be4a497989ce 100644 --- a/src/test/run-pass/fail-in-dtor-drops-fields.rs +++ b/src/test/run-pass/fail-in-dtor-drops-fields.rs @@ -33,9 +33,9 @@ impl Drop for B { } pub fn main() { - let ret = do task::try { + let ret = task::try(proc() { let _a = A { b: B { foo: 3 } }; - }; + }); assert!(ret.is_err()); unsafe { assert!(dropped); } } diff --git a/src/test/run-pass/foreign-call-no-runtime.rs b/src/test/run-pass/foreign-call-no-runtime.rs index ee54423a97d7..daaaac93791b 100644 --- a/src/test/run-pass/foreign-call-no-runtime.rs +++ b/src/test/run-pass/foreign-call-no-runtime.rs @@ -10,10 +10,10 @@ extern { pub fn main() { unsafe { - do run_in_bare_thread() { + run_in_bare_thread(proc() { let i = &100; rust_dbg_call(callback, cast::transmute(i)); - } + }); } } diff --git a/src/test/run-pass/infinite-loops.rs b/src/test/run-pass/infinite-loops.rs index dea0df2e52b3..633c096b6892 100644 --- a/src/test/run-pass/infinite-loops.rs +++ b/src/test/run-pass/infinite-loops.rs @@ -17,7 +17,7 @@ extern mod extra; fn loopy(n: int) { - if n > 0 { do spawn { loopy(n - 1) }; do spawn { loopy(n - 1) }; } + if n > 0 { spawn(proc() { loopy(n - 1) }); spawn(proc() { loopy(n - 1) }); } loop { } } @@ -25,5 +25,5 @@ pub fn main() { // Commenting this out, as this will hang forever otherwise. // Even after seeing the comment above, I'm not sure what the // intention of this test is. - // do spawn { loopy(5) }; + // spawn(proc() { loopy(5) }); } diff --git a/src/test/run-pass/issue-2185.rs b/src/test/run-pass/issue-2185.rs index 9ebeec092cf1..cef183e5f33c 100644 --- a/src/test/run-pass/issue-2185.rs +++ b/src/test/run-pass/issue-2185.rs @@ -51,16 +51,16 @@ impl iterable for 'static ||uint|| { } fn filter>(self: IA, prd: 'static |A| -> bool, blk: |A|) { - do self.iter |a| { + self.iter(|a| { if prd(a) { blk(a) } - } + }); } fn foldl>(self: IA, b0: B, blk: |B, A| -> B) -> B { let mut b = b0; - do self.iter |a| { + self.iter(|a| { b = blk(b, a); - } + }); b } diff --git a/src/test/run-pass/issue-3168.rs b/src/test/run-pass/issue-3168.rs index 978cd586975f..49b7e50c01e6 100644 --- a/src/test/run-pass/issue-3168.rs +++ b/src/test/run-pass/issue-3168.rs @@ -16,19 +16,19 @@ use std::task; pub fn main() { let (p,c) = comm::stream(); - do task::try || { + task::try(|| { let (p2,c2) = comm::stream(); - do task::spawn || { + task::spawn(|| { p2.recv(); error!("sibling fails"); fail!(); - } + }); let (p3,c3) = comm::stream(); c.send(c3); c2.send(()); error!("child blocks"); p3.recv(); - }; + }); error!("parent tries"); assert!(!p.recv().try_send(())); error!("all done!"); diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index 4922ab18f8d4..bcda2e27614c 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -12,8 +12,7 @@ enum Msg } fn foo(name: ~str, samples_chan: Chan) { - do task::spawn - { + task::spawn(proc() { let mut samples_chan = samples_chan; let callback: SamplesFn = proc(buffer) { for i in range(0u, buffer.len()) { @@ -21,7 +20,7 @@ fn foo(name: ~str, samples_chan: Chan) { } }; samples_chan.send(GetSamples(name.clone(), callback)); - }; + }); } pub fn main() {} diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs index 4cdf7aa3dd02..173f76434d30 100644 --- a/src/test/run-pass/issue-4241.rs +++ b/src/test/run-pass/issue-4241.rs @@ -45,13 +45,13 @@ priv fn parse_data(len: uint, io: @io::Reader) -> Result { priv fn parse_list(len: uint, io: @io::Reader) -> Result { let mut list: ~[Result] = ~[]; - do len.times { + len.times(proc() { let v = match io.read_char() { '$' => parse_bulk(io), ':' => parse_int(io), _ => fail!() - }; + }); list.push(v); } return List(list); @@ -119,11 +119,11 @@ fn query(cmd: ~[~str], sb: TcpSocketBuf) -> Result { fn query2(cmd: ~[~str]) -> Result { let _cmd = cmd_to_str(cmd); - do io::with_str_reader(~"$3\r\nXXX\r\n") |sb| { + io::with_str_reader(~"$3\r\nXXX\r\n")(|sb| { let res = parse_response(@sb as @io::Reader); println!("{:?}", res); res - } + }); } diff --git a/src/test/run-pass/issue-4446.rs b/src/test/run-pass/issue-4446.rs index baac8d0dcd14..8f2d9f32440b 100644 --- a/src/test/run-pass/issue-4446.rs +++ b/src/test/run-pass/issue-4446.rs @@ -13,9 +13,9 @@ use std::io::println; pub fn main() { let (port, chan) = Chan::new(); - do spawn { + spawn(proc() { println(port.recv()); - } + }); chan.send("hello, world"); } diff --git a/src/test/run-pass/issue-4448.rs b/src/test/run-pass/issue-4448.rs index c3f871c79124..8fbc35c72005 100644 --- a/src/test/run-pass/issue-4448.rs +++ b/src/test/run-pass/issue-4448.rs @@ -13,9 +13,9 @@ use std::task; pub fn main() { let (port, chan) = Chan::<&'static str>::new(); - do task::spawn { + task::spawn(proc() { assert_eq!(port.recv(), "hello, world"); - } + }); chan.send("hello, world"); } diff --git a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs index e0c1d35b3bc6..3f45e864da35 100644 --- a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs +++ b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs @@ -16,10 +16,10 @@ fn foo() { // Here, i is *copied* into the proc (heap closure). // Requires allocation. The proc's copy is not mutable. let mut i = 0; - do task::spawn { + task::spawn(proc() { user(i); println!("spawned {}", i) - } + }); i += 1; println!("original {}", i) } @@ -29,9 +29,9 @@ fn bar() { // mutable outside of the proc. let mut i = 0; while i < 10 { - do task::spawn { + task::spawn(proc() { user(i); - } + }); i += 1; } } @@ -40,11 +40,11 @@ fn car() { // Here, i must be shadowed in the proc to be mutable. let mut i = 0; while i < 10 { - do task::spawn { + task::spawn(proc() { let mut i = i; i += 1; user(i); - } + }); i += 1; } } diff --git a/src/test/run-pass/logging-only-prints-once.rs b/src/test/run-pass/logging-only-prints-once.rs index a06d025f6c7a..d81b5818d669 100644 --- a/src/test/run-pass/logging-only-prints-once.rs +++ b/src/test/run-pass/logging-only-prints-once.rs @@ -26,12 +26,12 @@ impl fmt::Default for Foo { pub fn main() { let (p,c) = Chan::new(); - do spawn { + spawn(proc() { let mut f = Foo(Cell::new(0)); debug!("{}", f); let Foo(ref mut f) = f; assert!(f.get() == 1); c.send(()); - } + }); p.recv(); } diff --git a/src/test/run-pass/moves-based-on-type-capture-clause.rs b/src/test/run-pass/moves-based-on-type-capture-clause.rs index 064fb385dccb..eb347ab28ff9 100644 --- a/src/test/run-pass/moves-based-on-type-capture-clause.rs +++ b/src/test/run-pass/moves-based-on-type-capture-clause.rs @@ -2,7 +2,7 @@ use std::task; pub fn main() { let x = ~"Hello world!"; - do task::spawn { + task::spawn(proc() { println!("{}", x); - } + }); } diff --git a/src/test/run-pass/native-always-waits.rs b/src/test/run-pass/native-always-waits.rs index cddee0be18df..8907db04dadc 100644 --- a/src/test/run-pass/native-always-waits.rs +++ b/src/test/run-pass/native-always-waits.rs @@ -18,11 +18,11 @@ static mut set: bool = false; #[start] fn start(argc: int, argv: **u8) -> int { // make sure that native::start always waits for all children to finish - do native::start(argc, argv) { - do spawn { + native::start(argc, argv, proc() { + spawn(proc() { unsafe { set = true; } - } - }; + }); + }); // if we didn't set the global, then return a nonzero code if unsafe {set} {0} else {1} diff --git a/src/test/run-pass/no-landing-pads.rs b/src/test/run-pass/no-landing-pads.rs index 3459f021f39b..f9567858022b 100644 --- a/src/test/run-pass/no-landing-pads.rs +++ b/src/test/run-pass/no-landing-pads.rs @@ -24,9 +24,9 @@ impl Drop for A { } fn main() { - do task::try::<()> { + task::try::<()>(proc() { let _a = A; fail!(); - }; + }); assert!(unsafe { !HIT }); } diff --git a/src/test/run-pass/once-move-out-on-heap.rs b/src/test/run-pass/once-move-out-on-heap.rs index 8c3f889c176c..bc56712ee3bc 100644 --- a/src/test/run-pass/once-move-out-on-heap.rs +++ b/src/test/run-pass/once-move-out-on-heap.rs @@ -22,8 +22,8 @@ fn foo(blk: proc()) { pub fn main() { let x = arc::Arc::new(true); - do foo { + foo(proc() { assert!(*x.get()); drop(x); - } + }); } diff --git a/src/test/run-pass/preempt.rs b/src/test/run-pass/preempt.rs index f34cc268a0c2..0527f47c112e 100644 --- a/src/test/run-pass/preempt.rs +++ b/src/test/run-pass/preempt.rs @@ -29,9 +29,9 @@ pub fn main() { let (port, chan) = stream(); info!("main started"); - do spawn { + spawn(proc() { starve_main(port); - }; + }); let mut i: int = 0; info!("main waiting for alive signal"); chan.send(i); diff --git a/src/test/run-pass/send-resource.rs b/src/test/run-pass/send-resource.rs index 7ede574a4d5b..474606ad347b 100644 --- a/src/test/run-pass/send-resource.rs +++ b/src/test/run-pass/send-resource.rs @@ -27,12 +27,12 @@ fn test(f: int) -> test { pub fn main() { let (p, c) = Chan::new(); - do task::spawn() { + task::spawn(proc() { let (pp, cc) = Chan::new(); c.send(cc); let _r = pp.recv(); - } + }); p.recv().send(test(42)); } diff --git a/src/test/run-pass/task-comm-12.rs b/src/test/run-pass/task-comm-12.rs index ce30071aaf44..f6f6f3ba240c 100644 --- a/src/test/run-pass/task-comm-12.rs +++ b/src/test/run-pass/task-comm-12.rs @@ -20,9 +20,9 @@ fn test00() { let i: int = 0; let mut builder = task::task(); let mut result = builder.future_result(); - do builder.spawn { + builder.spawn(proc() { start(i) - } + }); // Sleep long enough for the task to finish. let mut i = 0; diff --git a/src/test/run-pass/task-comm-7.rs b/src/test/run-pass/task-comm-7.rs index 43ac3957ae2e..8622ff760899 100644 --- a/src/test/run-pass/task-comm-7.rs +++ b/src/test/run-pass/task-comm-7.rs @@ -31,21 +31,21 @@ fn test00() { let number_of_messages: int = 10; let c = ch.clone(); - do task::spawn || { + task::spawn(proc() { test00_start(&c, number_of_messages * 0, number_of_messages); - } + }); let c = ch.clone(); - do task::spawn || { + task::spawn(proc() { test00_start(&c, number_of_messages * 1, number_of_messages); - } + }); let c = ch.clone(); - do task::spawn || { + task::spawn(proc() { test00_start(&c, number_of_messages * 2, number_of_messages); - } + }); let c = ch.clone(); - do task::spawn || { + task::spawn(proc() { test00_start(&c, number_of_messages * 3, number_of_messages); - } + }); let mut i: int = 0; while i < number_of_messages { diff --git a/src/test/run-pass/task-comm-9.rs b/src/test/run-pass/task-comm-9.rs index a2463ff76815..feae49ffeb83 100644 --- a/src/test/run-pass/task-comm-9.rs +++ b/src/test/run-pass/task-comm-9.rs @@ -29,10 +29,10 @@ fn test00() { let mut builder = task::task(); let result = builder.future_result(); - do builder.spawn { + builder.spawn(proc() { let mut ch = ch; test00_start(&mut ch, number_of_messages); - } + }); let mut i: int = 0; while i < number_of_messages { diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs index 16e9cb538919..a4be47323e5b 100644 --- a/src/test/run-pass/task-killjoin-rsrc.rs +++ b/src/test/run-pass/task-killjoin-rsrc.rs @@ -56,10 +56,10 @@ fn joinable(f: proc()) -> Port { *b = true; } let (p, c) = stream(); - do task::spawn_unlinked { + task::spawn_unlinked(proc() { let ccc = c; wrapper(ccc, f) - } + }); p } diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index b99e6a03bcb3..2bf18e1ae1d5 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -71,13 +71,13 @@ pub fn main() { ~dogge2 as ~Pet:Freeze+Send]); let (p1,c1) = Chan::new(); let arc1 = arc.clone(); - do task::spawn { check_legs(arc1); c1.send(()); } + task::spawn(proc() { check_legs(arc1); c1.send(()); }); let (p2,c2) = Chan::new(); let arc2 = arc.clone(); - do task::spawn { check_names(arc2); c2.send(()); } + task::spawn(proc() { check_names(arc2); c2.send(()); }); let (p3,c3) = Chan::new(); let arc3 = arc.clone(); - do task::spawn { check_pedigree(arc3); c3.send(()); } + task::spawn(proc() { check_pedigree(arc3); c3.send(()); }); p1.recv(); p2.recv(); p3.recv(); diff --git a/src/test/run-pass/unit-like-struct-drop-run.rs b/src/test/run-pass/unit-like-struct-drop-run.rs index 5707406de146..04507dd01ce5 100644 --- a/src/test/run-pass/unit-like-struct-drop-run.rs +++ b/src/test/run-pass/unit-like-struct-drop-run.rs @@ -21,9 +21,9 @@ impl Drop for Foo { } pub fn main() { - let x = do task::try { + let x = task::try(proc() { let _b = Foo; - }; + }); let s = x.unwrap_err().move::<&'static str>().unwrap(); assert_eq!(s.as_slice(), "This failure should happen.");