diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-06 12:34:08 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-06 15:36:30 -0700 |
| commit | ecaf9e39c9435fa2de4fe393c4b263be36eb2d99 (patch) | |
| tree | 775f69be65adff65551d96173dd797e32e2c3157 /src/test | |
| parent | d3a9bb1bd4a1d510bbaca2ab1121e4c85a239247 (diff) | |
| download | rust-ecaf9e39c9435fa2de4fe393c4b263be36eb2d99.tar.gz rust-ecaf9e39c9435fa2de4fe393c4b263be36eb2d99.zip | |
Convert alt to match. Stop parsing alt
Diffstat (limited to 'src/test')
167 files changed, 275 insertions, 275 deletions
diff --git a/src/test/auxiliary/issue2378a.rs b/src/test/auxiliary/issue2378a.rs index 3a681ef7a3b..b34ba63404c 100644 --- a/src/test/auxiliary/issue2378a.rs +++ b/src/test/auxiliary/issue2378a.rs @@ -2,7 +2,7 @@ enum maybe<T> { just(T), nothing } impl methods<T:copy> for maybe<T> { fn ~[](idx: uint) -> T { - alt self { + match self { just(t) { t } nothing { fail; } } diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 3c7057320ec..dd92b28c41c 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -76,7 +76,7 @@ fn str_set() { let mut found = 0; for int::range(0, 1000) |_i| { - alt s.find(r.gen_str(10)) { + match s.find(r.gen_str(10)) { some(_) => { found += 1; } none => { } } diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs index dfc74f12cef..d510b978f93 100644 --- a/src/test/bench/graph500-bfs.rs +++ b/src/test/bench/graph500-bfs.rs @@ -157,7 +157,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { }; fn is_gray(c: color) -> bool { - alt c { + match c { gray(_) => { true } _ => { false } } @@ -170,7 +170,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { i += 1u; colors = do colors.mapi() |i, c| { let c : color = c; - alt c { + match c { white => { let i = i as node_id; @@ -196,7 +196,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { // Convert the results. do vec::map(colors) |c| { - alt c { + match c { white => { -1i64 } black(parent) => { parent } _ => { fail ~"Found remaining gray nodes in BFS" } @@ -227,7 +227,7 @@ fn pbfs(&&graph: arc::arc<graph>, key: node_id) -> bfs_result { #[inline(always)] fn is_gray(c: color) -> bool { - alt c { + match c { gray(_) => { true } _ => { false } } @@ -249,7 +249,7 @@ fn pbfs(&&graph: arc::arc<graph>, key: node_id) -> bfs_result { let c : color = c; let colors = arc::get(&colors); let graph = arc::get(&graph); - alt c { + match c { white => { let i = i as node_id; @@ -276,7 +276,7 @@ fn pbfs(&&graph: arc::arc<graph>, key: node_id) -> bfs_result { // Convert the results. do par::map(colors) |c| { - alt c { + match c { white => { -1i64 } black(parent) => { parent } _ => { fail ~"Found remaining gray nodes in BFS" } diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index e0ebda079f7..423cec10f5a 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -31,7 +31,7 @@ fn server(requests: port<request>, responses: pipes::chan<uint>) { let mut count = 0u; let mut done = false; while !done { - alt requests.try_recv() { + match requests.try_recv() { some(get_count) => { responses.send(copy count); } some(bytes(b)) => { //error!{"server: received %? bytes", b}; diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 067bd710b3d..60cc52825e8 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -26,7 +26,7 @@ fn server(requests: port_set<request>, responses: pipes::chan<uint>) { let mut count = 0u; let mut done = false; while !done { - alt requests.try_recv() { + match requests.try_recv() { some(get_count) => { responses.send(copy count); } some(bytes(b)) => { //error!{"server: received %? bytes", b}; diff --git a/src/test/bench/msgsend-ring-pipes.rs b/src/test/bench/msgsend-ring-pipes.rs index c494bfc485a..42df57f5bf3 100644 --- a/src/test/bench/msgsend-ring-pipes.rs +++ b/src/test/bench/msgsend-ring-pipes.rs @@ -43,7 +43,7 @@ fn thread_ring(i: uint, num_port2 <-> num_port; num_chan = some(ring::client::num(option::unwrap(num_chan2), i * j)); let port = option::unwrap(num_port2); - alt recv(port) { + match recv(port) { ring::num(_n, p) => { //log(error, _n); num_port = some(move_out!{p}); diff --git a/src/test/bench/msgsend.rs b/src/test/bench/msgsend.rs index 5b2488efa2f..adbf6253214 100644 --- a/src/test/bench/msgsend.rs +++ b/src/test/bench/msgsend.rs @@ -18,7 +18,7 @@ fn server(requests: comm::port<request>, responses: comm::chan<uint>) { let mut count = 0u; let mut done = false; while !done { - alt comm::recv(requests) { + match comm::recv(requests) { get_count => { comm::send(responses, copy count); } bytes(b) => { count += b; } stop => { done = true; } diff --git a/src/test/bench/pingpong.rs b/src/test/bench/pingpong.rs index 2a9a20fc07d..17830af6869 100644 --- a/src/test/bench/pingpong.rs +++ b/src/test/bench/pingpong.rs @@ -40,7 +40,7 @@ macro_rules! follow { { $($message:path($($x: ident),+) -> $next:ident $e:expr)+ } => ( - |m| alt move m { + |m| match move m { $(some($message($($x,)* next)) => { // FIXME (#2329) use regular move here once move out of // enums is supported. @@ -53,7 +53,7 @@ macro_rules! follow { { $($message:path -> $next:ident $e:expr)+ } => ( - |m| alt move m { + |m| match move m { $(some($message(next)) => { // FIXME (#2329) use regular move here once move out of // enums is supported. diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index be3a868beb2..c9a984117da 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -5,7 +5,7 @@ import methods = std::arena::arena; enum tree/& { nil, node(&tree, &tree, int), } fn item_check(t: &tree) -> int { - alt *t { + match *t { nil => { return 0; } node(left, right, item) => { return item + item_check(left) - item_check(right); diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 7adc176bcff..fd367181df4 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -22,7 +22,7 @@ enum color { Red, Yellow, Blue } type creature_info = { name: uint, color: color }; fn show_color(cc: color) -> ~str { - alt (cc) { + match (cc) { Red => {~"red"} Yellow => {~"yellow"} Blue => {~"blue"} @@ -39,7 +39,7 @@ fn show_color_list(set: ~[color]) -> ~str { } fn show_digit(nn: uint) -> ~str { - alt (nn) { + match (nn) { 0 => {~"zero"} 1 => {~"one"} 2 => {~"two"} @@ -71,7 +71,7 @@ fn show_number(nn: uint) -> ~str { } fn transform(aa: color, bb: color) -> color { - alt (aa, bb) { + match (aa, bb) { (Red, Red ) => { Red } (Red, Yellow) => { Blue } (Red, Blue ) => { Yellow } @@ -101,7 +101,7 @@ fn creature( let resp = comm::recv(from_rendezvous); // log and change, or print and quit - alt resp { + match resp { option::some(other_creature) => { color = transform(color, other_creature.color); diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index ca014b61455..7aed4749eed 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -59,7 +59,7 @@ fn sort_and_fmt(mm: hashmap<~[u8], uint>, total: uint) -> ~str { // given a map, search for the frequency of a pattern fn find(mm: hashmap<~[u8], uint>, key: ~str) -> uint { - alt mm.find(str::bytes(str::to_lower(key))) { + match mm.find(str::bytes(str::to_lower(key))) { option::none => { return 0u; } option::some(num) => { return num; } } @@ -68,7 +68,7 @@ fn find(mm: hashmap<~[u8], uint>, key: ~str) -> uint { // given a map, increment the counter for a key fn update_freq(mm: hashmap<~[u8], uint>, key: &[u8]) { let key = vec::slice(key, 0, key.len()); - alt mm.find(key) { + match mm.find(key) { option::none => { mm.insert(key, 1u ); } option::some(val) => { mm.insert(key, 1u + val); } } @@ -110,7 +110,7 @@ fn make_sequence_processor(sz: uint, from_parent: pipes::port<~[u8]>, }); } - let buffer = alt sz { + let buffer = match sz { 1u => { sort_and_fmt(freqs, total) } 2u => { sort_and_fmt(freqs, total) } 3u => { fmt!{"%u\t%s", find(freqs, ~"GGT"), ~"GGT"} } @@ -172,11 +172,11 @@ fn main(args: ~[~str]) { if str::len(line) == 0u { again; } - alt (line[0], proc_mode) { + match (line[0], proc_mode) { // start processing if this is the one ('>' as u8, false) => { - alt str::find_str_from(line, ~"THREE", 1u) { + match str::find_str_from(line, ~"THREE", 1u) { option::some(_) => { proc_mode = true; } option::none => { } } diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 5ffa7cc4f26..6eeb50d52f5 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -57,7 +57,7 @@ fn sort_and_fmt(mm: hashmap<~[u8], uint>, total: uint) -> ~str { // given a map, search for the frequency of a pattern fn find(mm: hashmap<~[u8], uint>, key: ~str) -> uint { - alt mm.find(str::bytes(str::to_lower(key))) { + match mm.find(str::bytes(str::to_lower(key))) { option::none => { return 0u; } option::some(num) => { return num; } } @@ -66,7 +66,7 @@ fn find(mm: hashmap<~[u8], uint>, key: ~str) -> uint { // given a map, increment the counter for a key fn update_freq(mm: hashmap<~[u8], uint>, key: &[u8]) { let key = vec::slice(key, 0, key.len()); - alt mm.find(key) { + match mm.find(key) { option::none => { mm.insert(key, 1u ); } option::some(val) => { mm.insert(key, 1u + val); } } @@ -108,7 +108,7 @@ fn make_sequence_processor(sz: uint, from_parent: comm::port<~[u8]>, }); } - let buffer = alt sz { + let buffer = match sz { 1u => { sort_and_fmt(freqs, total) } 2u => { sort_and_fmt(freqs, total) } 3u => { fmt!{"%u\t%s", find(freqs, ~"GGT"), ~"GGT"} } @@ -159,11 +159,11 @@ fn main(args: ~[~str]) { if str::len(line) == 0u { again; } - alt (line[0], proc_mode) { + match (line[0], proc_mode) { // start processing if this is the one ('>' as u8, false) => { - alt str::find_str_from(line, ~"THREE", 1u) { + match str::find_str_from(line, ~"THREE", 1u) { option::some(_) => proc_mode = true, option::none => () } diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index f00396f9b14..93a1d60ff7f 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -103,7 +103,7 @@ fn writer(path: ~str, writech: comm::chan<comm::chan<line>>, size: uint) let p: comm::port<line> = comm::port(); let ch = comm::chan(p); comm::send(writech, ch); - let cout: io::writer = alt path { + let cout: io::writer = match path { ~"" => { {dn: 0} as io::writer } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 3889fa00ff0..4b4d41e72ba 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -51,7 +51,7 @@ fn parse_opts(argv: ~[~str]) -> config { let opt_args = vec::slice(argv, 1u, vec::len(argv)); - alt getopts::getopts(opt_args, opts) { + match getopts::getopts(opt_args, opts) { ok(m) => { return {stress: getopts::opt_present(m, ~"stress")} } err(_) => { fail; } } diff --git a/src/test/bench/shootout-threadring.rs b/src/test/bench/shootout-threadring.rs index e99d2946e81..26bc2b739fa 100644 --- a/src/test/bench/shootout-threadring.rs +++ b/src/test/bench/shootout-threadring.rs @@ -21,7 +21,7 @@ fn start(+token: int) { fn roundtrip(id: int, p: comm::port<int>, ch: comm::chan<int>) { while (true) { - alt comm::recv(p) { + match comm::recv(p) { 1 => { io::println(fmt!{"%d\n", id}); return; diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 2a8750b64bd..eac1f67dcaa 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -53,7 +53,7 @@ fn recurse_or_fail(depth: int, st: option<st>) { } else { let depth = depth - 1; - let st = alt st { + let st = match st { none => { st_({ box: @nil, diff --git a/src/test/bench/task-perf-one-million.rs b/src/test/bench/task-perf-one-million.rs index 85008b0daf9..7b434a5f255 100644 --- a/src/test/bench/task-perf-one-million.rs +++ b/src/test/bench/task-perf-one-million.rs @@ -19,7 +19,7 @@ fn calc(children: uint, parent_ch: comm::chan<msg>) { } for iter::repeat (children) { - alt check comm::recv(port) { + match check comm::recv(port) { ready(child_ch) => { vec::push(child_chs, child_ch); } @@ -28,7 +28,7 @@ fn calc(children: uint, parent_ch: comm::chan<msg>) { comm::send(parent_ch, ready(chan)); - alt check comm::recv(port) { + match check comm::recv(port) { start => { do vec::iter (child_chs) |child_ch| { comm::send(child_ch, start); @@ -37,7 +37,7 @@ fn calc(children: uint, parent_ch: comm::chan<msg>) { } for iter::repeat (children) { - alt check comm::recv(port) { + match check comm::recv(port) { done(child_sum) => { sum += child_sum; } } } @@ -60,12 +60,12 @@ fn main(args: ~[~str]) { do task::spawn { calc(children, chan); }; - alt check comm::recv(port) { + match check comm::recv(port) { ready(chan) => { comm::send(chan, start); } } - let sum = alt check comm::recv(port) { + let sum = match check comm::recv(port) { done(sum) => { sum } }; error!{"How many tasks? %d tasks.", sum}; diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index c31ccde2ca6..2281939b57a 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -79,7 +79,7 @@ impl of word_reader for io::reader { } fn file_word_reader(filename: ~str) -> word_reader { - alt io::file_reader(filename) { + match io::file_reader(filename) { result::ok(f) => { f as word_reader } result::err(e) => { fail fmt!{"%?", e} } } @@ -88,7 +88,7 @@ fn file_word_reader(filename: ~str) -> word_reader { fn map(f: fn~() -> word_reader, emit: map_reduce::putter<~str, int>) { let f = f(); loop { - alt f.read_word() { + match f.read_word() { some(w) => { emit(w, 1); } none => { break; } } @@ -98,7 +98,7 @@ fn map(f: fn~() -> word_reader, emit: map_reduce::putter<~str, int>) { fn reduce(&&word: ~str, get: map_reduce::getter<int>) { let mut count = 0; - loop { alt get() { some(_) => { count += 1; } none => { break; } } } + loop { match get() { some(_) => { count += 1; } none => { break; } } } io::println(fmt!{"%s\t%?", word, count}); } @@ -181,12 +181,12 @@ mod map_reduce { do map(input) |key, val| { let mut c = none; - alt intermediates.find(key) { + match intermediates.find(key) { some(_c) => { c = some(_c); } none => { do ctrl.swap |ctrl| { let ctrl = ctrl_proto::client::find_reducer(ctrl, key); - alt pipes::recv(ctrl) { + match pipes::recv(ctrl) { ctrl_proto::reducer(c_, ctrl) => { c = some(c_); move_out!{ctrl} @@ -224,7 +224,7 @@ mod map_reduce { &ref_count: int, &is_done: bool) -> option<V> { while !is_done || ref_count > 0 { - alt recv(p) { + match recv(p) { emit_val(v) => { // error!{"received %d", v}; return some(v); @@ -259,7 +259,7 @@ mod map_reduce { while num_mappers > 0 { let (_ready, message, ctrls) = pipes::select(ctrl); - alt option::unwrap(message) { + match option::unwrap(message) { ctrl_proto::mapper_done => { // error!{"received mapper terminated."}; num_mappers -= 1; @@ -268,7 +268,7 @@ mod map_reduce { ctrl_proto::find_reducer(k, cc) => { let c; // log(error, "finding reducer for " + k); - alt reducers.find(k) { + match reducers.find(k) { some(_c) => { // log(error, // "reusing existing reducer for " + k); diff --git a/src/test/compile-fail/alt-arrows-block-then-binop.rs b/src/test/compile-fail/alt-arrows-block-then-binop.rs index 037e0c8b517..7b973633c7d 100644 --- a/src/test/compile-fail/alt-arrows-block-then-binop.rs +++ b/src/test/compile-fail/alt-arrows-block-then-binop.rs @@ -1,6 +1,6 @@ fn main() { - alt 0 { + match 0 { 0 => { } + 5 //~ ERROR unexpected token: `+` } diff --git a/src/test/compile-fail/alt-join.rs b/src/test/compile-fail/alt-join.rs index 1557ff12090..83dcc69609e 100644 --- a/src/test/compile-fail/alt-join.rs +++ b/src/test/compile-fail/alt-join.rs @@ -4,7 +4,7 @@ fn my_fail() -> ! { fail; } fn main() { - alt true { false => { my_fail(); } true => { } } + match true { false => { my_fail(); } true => { } } log(debug, x); //~ ERROR unresolved name: x let x: int; diff --git a/src/test/compile-fail/alt-pattern-field-mismatch-2.rs b/src/test/compile-fail/alt-pattern-field-mismatch-2.rs index 6ba942decfc..617bb168629 100644 --- a/src/test/compile-fail/alt-pattern-field-mismatch-2.rs +++ b/src/test/compile-fail/alt-pattern-field-mismatch-2.rs @@ -6,7 +6,7 @@ fn main() { } fn foo(c: color) { - alt c { + match c { rgb(_, _, _) => { } cmyk(_, _, _, _) => { } no_color(_) => { } diff --git a/src/test/compile-fail/alt-pattern-field-mismatch.rs b/src/test/compile-fail/alt-pattern-field-mismatch.rs index 71f44764e14..9a54985efc1 100644 --- a/src/test/compile-fail/alt-pattern-field-mismatch.rs +++ b/src/test/compile-fail/alt-pattern-field-mismatch.rs @@ -6,7 +6,7 @@ fn main() { } fn foo(c: color) { - alt c { + match c { rgb(_, _) => { } //~^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields cmyk(_, _, _, _) => { } diff --git a/src/test/compile-fail/alt-range-fail-dominate.rs b/src/test/compile-fail/alt-range-fail-dominate.rs index d1ba0f625b1..f58d0865265 100644 --- a/src/test/compile-fail/alt-range-fail-dominate.rs +++ b/src/test/compile-fail/alt-range-fail-dominate.rs @@ -5,27 +5,27 @@ //error-pattern: unreachable fn main() { - alt check 5u { + match check 5u { 1u to 10u => { } 5u to 6u => { } }; - alt check 5u { + match check 5u { 3u to 6u => { } 4u to 6u => { } }; - alt check 5u { + match check 5u { 4u to 6u => { } 4u to 6u => { } }; - alt check 'c' { + match check 'c' { 'A' to 'z' => {} 'a' to 'z' => {} }; - alt check 1.0 { + match check 1.0 { 0.01 to 6.5 => {} 0.02 => {} }; diff --git a/src/test/compile-fail/alt-range-fail.rs b/src/test/compile-fail/alt-range-fail.rs index afda6d7015e..229b5c47eba 100644 --- a/src/test/compile-fail/alt-range-fail.rs +++ b/src/test/compile-fail/alt-range-fail.rs @@ -3,16 +3,16 @@ //error-pattern: mismatched types fn main() { - alt 5u { + match 5u { 6u to 1u => { } _ => { } }; - alt "wow" { + match "wow" { "bar" to "foo" => { } }; - alt 5u { + match 5u { 'c' to 100u => { } _ => { } }; diff --git a/src/test/compile-fail/alt-tag-nullary.rs b/src/test/compile-fail/alt-tag-nullary.rs index 4f34c675cef..9f7b471221d 100644 --- a/src/test/compile-fail/alt-tag-nullary.rs +++ b/src/test/compile-fail/alt-tag-nullary.rs @@ -3,5 +3,5 @@ enum a { A, } enum b { B, } -fn main() { let x: a = A; alt x { B => { } } } +fn main() { let x: a = A; match x { B => { } } } diff --git a/src/test/compile-fail/alt-tag-unary.rs b/src/test/compile-fail/alt-tag-unary.rs index f0546574912..5902454c461 100644 --- a/src/test/compile-fail/alt-tag-unary.rs +++ b/src/test/compile-fail/alt-tag-unary.rs @@ -3,5 +3,5 @@ enum a { A(int), } enum b { B(int), } -fn main() { let x: a = A(0); alt x { B(y) => { } } } +fn main() { let x: a = A(0); match x { B(y) => { } } } diff --git a/src/test/compile-fail/bad-alt.rs b/src/test/compile-fail/bad-alt.rs index 4d8de65492f..041f84bc6ee 100644 --- a/src/test/compile-fail/bad-alt.rs +++ b/src/test/compile-fail/bad-alt.rs @@ -2,5 +2,5 @@ fn main() { let int x = 5; - alt x; + match x; } diff --git a/src/test/compile-fail/bad-record-pat-2.rs b/src/test/compile-fail/bad-record-pat-2.rs index 4c8d72444c1..c043a076042 100644 --- a/src/test/compile-fail/bad-record-pat-2.rs +++ b/src/test/compile-fail/bad-record-pat-2.rs @@ -1,3 +1,3 @@ // error-pattern:did not expect a record with a field `q` -fn main() { alt {x: 1, y: 2} { {x: x, q: q} => { } } } +fn main() { match {x: 1, y: 2} { {x: x, q: q} => { } } } diff --git a/src/test/compile-fail/bad-record-pat.rs b/src/test/compile-fail/bad-record-pat.rs index 48155a0b529..d7e7fb16ad8 100644 --- a/src/test/compile-fail/bad-record-pat.rs +++ b/src/test/compile-fail/bad-record-pat.rs @@ -1,3 +1,3 @@ // error-pattern:expected a record with 2 fields, found one with 1 -fn main() { alt {x: 1, y: 2} { {x: x} => { } } } +fn main() { match {x: 1, y: 2} { {x: x} => { } } } diff --git a/src/test/compile-fail/bogus-tag.rs b/src/test/compile-fail/bogus-tag.rs index 0414bb5e867..06cfb60e1a8 100644 --- a/src/test/compile-fail/bogus-tag.rs +++ b/src/test/compile-fail/bogus-tag.rs @@ -6,7 +6,7 @@ enum color { rgb(int, int, int), rgba(int, int, int, int), } fn main() { let red: color = rgb(255, 0, 0); - alt red { + match red { rgb(r, g, b) => { debug!{"rgb"}; } hsl(h, s, l) => { debug!{"hsl"}; } } diff --git a/src/test/compile-fail/borrowck-binding-mutbl.rs b/src/test/compile-fail/borrowck-binding-mutbl.rs index 8a188fe9239..57c0375f4e4 100644 --- a/src/test/compile-fail/borrowck-binding-mutbl.rs +++ b/src/test/compile-fail/borrowck-binding-mutbl.rs @@ -4,7 +4,7 @@ fn impure(_v: ~[int]) { fn main() { let x = {mut f: ~[3]}; - alt x { + match x { {f: v} => { impure(v); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location //~^ NOTE impure due to access to impure function diff --git a/src/test/compile-fail/borrowck-issue-2657-1.rs b/src/test/compile-fail/borrowck-issue-2657-1.rs index 2d396bd591c..f8cbb52d996 100644 --- a/src/test/compile-fail/borrowck-issue-2657-1.rs +++ b/src/test/compile-fail/borrowck-issue-2657-1.rs @@ -1,6 +1,6 @@ fn main() { let x = some(~1); -alt x { //~ NOTE loan of immutable local variable granted here +match x { //~ NOTE loan of immutable local variable granted here some(y) => { let _a <- x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan } diff --git a/src/test/compile-fail/borrowck-issue-2657-2.rs b/src/test/compile-fail/borrowck-issue-2657-2.rs index 85d062dd98c..ab6e63174aa 100644 --- a/src/test/compile-fail/borrowck-issue-2657-2.rs +++ b/src/test/compile-fail/borrowck-issue-2657-2.rs @@ -1,6 +1,6 @@ fn main() { let x = some(~1); -alt x { +match x { some(y) => { let _b <- y; //~ ERROR moving out of pattern binding } diff --git a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs index acb018dbb2d..ef696048219 100644 --- a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs +++ b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs @@ -5,7 +5,7 @@ enum cycle { fn main() { let x = ~node({mut a: ~empty}); // Create a cycle! - alt check *x { //~ NOTE loan of immutable local variable granted here + match check *x { //~ NOTE loan of immutable local variable granted here node(y) => { y.a <- x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan } diff --git a/src/test/compile-fail/borrowck-pat-enum-in-box.rs b/src/test/compile-fail/borrowck-pat-enum-in-box.rs index 103de904609..cd4893f87f2 100644 --- a/src/test/compile-fail/borrowck-pat-enum-in-box.rs +++ b/src/test/compile-fail/borrowck-pat-enum-in-box.rs @@ -1,12 +1,12 @@ fn match_imm_box(v: &const @option<int>) -> int { - alt *v { + match *v { @some(i) => {i} @none => {0} } } fn match_const_box(v: &const @const option<int>) -> int { - alt *v { + match *v { @some(i) => { i } // ok because this is pure @none => {0} } @@ -15,7 +15,7 @@ fn match_const_box(v: &const @const option<int>) -> int { pure fn pure_process(_i: int) {} fn match_const_box_and_do_pure_things(v: &const @const option<int>) { - alt *v { + match *v { @some(i) => { pure_process(i) } @@ -26,7 +26,7 @@ fn match_const_box_and_do_pure_things(v: &const @const option<int>) { fn process(_i: int) {} fn match_const_box_and_do_bad_things(v: &const @const option<int>) { - alt *v { + match *v { @some(i) => { //~ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location process(i) //~ NOTE impure due to access to impure function } diff --git a/src/test/compile-fail/borrowck-pat-enum.rs b/src/test/compile-fail/borrowck-pat-enum.rs index 6dd37e647ac..b29321ed818 100644 --- a/src/test/compile-fail/borrowck-pat-enum.rs +++ b/src/test/compile-fail/borrowck-pat-enum.rs @@ -1,5 +1,5 @@ fn match_ref(&&v: option<int>) -> int { - alt v { + match v { some(i) => { i } @@ -8,14 +8,14 @@ fn match_ref(&&v: option<int>) -> int { } fn match_ref_unused(&&v: option<int>) { - alt v { + match v { some(_) => {} none => {} } } fn match_const_reg(v: &const option<int>) -> int { - alt *v { + match *v { some(i) => {i} // OK because this is pure none => {0} } @@ -25,14 +25,14 @@ fn impure(_i: int) { } fn match_const_reg_unused(v: &const option<int>) { - alt *v { + match *v { some(_) => {impure(0)} // OK because nothing is captured none => {} } } fn match_const_reg_impure(v: &const option<int>) { - alt *v { + match *v { some(i) => {impure(i)} //~ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location //~^ NOTE impure due to access to impure function none => {} @@ -40,7 +40,7 @@ fn match_const_reg_impure(v: &const option<int>) { } fn match_imm_reg(v: &option<int>) { - alt *v { + match *v { some(i) => {impure(i)} // OK because immutable none => {} } diff --git a/src/test/compile-fail/borrowck-pat-reassign-binding.rs b/src/test/compile-fail/borrowck-pat-reassign-binding.rs index 2d7f33e6620..02604f65227 100644 --- a/src/test/compile-fail/borrowck-pat-reassign-binding.rs +++ b/src/test/compile-fail/borrowck-pat-reassign-binding.rs @@ -2,7 +2,7 @@ fn main() { let mut x: option<int> = none; - alt x { //~ NOTE loan of mutable local variable granted here + match x { //~ NOTE loan of mutable local variable granted here none => {} some(i) => { // Not ok: i is an outstanding ptr into x. diff --git a/src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs b/src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs index 12c2d0ef6e8..42dd5024603 100644 --- a/src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs +++ b/src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs @@ -2,7 +2,7 @@ fn main() { let mut x = none; - alt x { //~ NOTE loan of mutable local variable granted here + match x { //~ NOTE loan of mutable local variable granted here none => { // It is ok to reassign x here, because there is in // fact no outstanding loan of x! diff --git a/src/test/compile-fail/borrowck-unchecked-with-borrow.rs b/src/test/compile-fail/borrowck-unchecked-with-borrow.rs index 34031aa70d6..86a855de6f1 100644 --- a/src/test/compile-fail/borrowck-unchecked-with-borrow.rs +++ b/src/test/compile-fail/borrowck-unchecked-with-borrow.rs @@ -2,7 +2,7 @@ fn impure(_i: int) {} // check that unchecked alone does not override borrowck: fn foo(v: &const option<int>) { - alt *v { + match *v { some(i) => { //~^ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location unchecked { @@ -15,7 +15,7 @@ fn foo(v: &const option<int>) { } fn bar(v: &const option<int>) { - alt *v { + match *v { some(i) => { unsafe { impure(i); diff --git a/src/test/compile-fail/deref-non-pointer.rs b/src/test/compile-fail/deref-non-pointer.rs index 5468a46a6a7..8c23b1db2de 100644 --- a/src/test/compile-fail/deref-non-pointer.rs +++ b/src/test/compile-fail/deref-non-pointer.rs @@ -1,6 +1,6 @@ // error-pattern:cannot be dereferenced fn main() { - alt *1 { + match *1 { _ => { fail; } } } \ No newline at end of file diff --git a/src/test/compile-fail/issue-1193.rs b/src/test/compile-fail/issue-1193.rs index 4ac885e5b10..e9a5d91c9d2 100644 --- a/src/test/compile-fail/issue-1193.rs +++ b/src/test/compile-fail/issue-1193.rs @@ -6,7 +6,7 @@ mod foo { const b : t = 1u8; fn bar(v: t) -> bool { - alt v { + match v { a => { return true; } b => { return false; } } diff --git a/src/test/compile-fail/issue-2111.rs b/src/test/compile-fail/issue-2111.rs index f5639a887f0..7c7ec4f5f8f 100644 --- a/src/test/compile-fail/issue-2111.rs +++ b/src/test/compile-fail/issue-2111.rs @@ -1,5 +1,5 @@ fn foo(a: option<uint>, b: option<uint>) { - alt (a,b) { //~ ERROR: non-exhaustive patterns: none not covered + match (a,b) { //~ ERROR: non-exhaustive patterns: none not covered (some(a), some(b)) if a == b => { } (some(_), none) | (none, some(_)) => { } diff --git a/src/test/compile-fail/issue-2354.rs b/src/test/compile-fail/issue-2354.rs index cf7a36224bb..ebda510e879 100644 --- a/src/test/compile-fail/issue-2354.rs +++ b/src/test/compile-fail/issue-2354.rs @@ -5,7 +5,7 @@ xfailed for now (see Issue #2354) */ fn foo() { //~ ERROR this open brace is not closed - alt some(x) { + match some(x) { some(y) { fail; } none { fail; } } diff --git a/src/test/compile-fail/issue-2848.rs b/src/test/compile-fail/issue-2848.rs index 376426bb82e..c721887e496 100644 --- a/src/test/compile-fail/issue-2848.rs +++ b/src/test/compile-fail/issue-2848.rs @@ -8,7 +8,7 @@ mod bar { fn main() { import bar::{alpha, charlie}; - alt alpha { + match alpha { alpha | beta => {} //~ ERROR: inconsistent number of bindings charlie => {} } diff --git a/src/test/compile-fail/issue-2849.rs b/src/test/compile-fail/issue-2849.rs index 6085fc9fe8f..5e8a9905c2f 100644 --- a/src/test/compile-fail/issue-2849.rs +++ b/src/test/compile-fail/issue-2849.rs @@ -1,7 +1,7 @@ enum foo { alpha, beta(int) } fn main() { - alt alpha { + match alpha { alpha | beta(i) => {} //~ ERROR inconsistent number of bindings } } diff --git a/src/test/compile-fail/issue-3038.rs b/src/test/compile-fail/issue-3038.rs index f5aa30c1416..ec66d3bafe6 100644 --- a/src/test/compile-fail/issue-3038.rs +++ b/src/test/compile-fail/issue-3038.rs @@ -8,17 +8,17 @@ enum k { m(int, int) } fn main() { - let _z = alt g(1, 2) { + let _z = match g(1, 2) { g(x, x) => { log(debug, x + x); } //~^ ERROR Identifier x is bound more than once in the same pattern }; - let _z = alt i(l(1, 2), m(3, 4)) { + let _z = match i(l(1, 2), m(3, 4)) { i(l(x, _), m(_, x)) //~ ERROR Identifier x is bound more than once in the same pattern => { log(error, x + x); } }; - let _z = alt (1, 2) { + let _z = match (1, 2) { (x, x) => { x } //~ ERROR Identifier x is bound more than once in the same pattern }; diff --git a/src/test/compile-fail/liveness-missing-ret2.rs b/src/test/compile-fail/liveness-missing-ret2.rs index e1803b0248a..5f488c4dc5a 100644 --- a/src/test/compile-fail/liveness-missing-ret2.rs +++ b/src/test/compile-fail/liveness-missing-ret2.rs @@ -1,9 +1,9 @@ // error-pattern: not all control paths return a value fn f() -> int { - // Make sure typestate doesn't interpreturn this alt expression + // Make sure typestate doesn't interpreturn this match expression // as the function result - alt check true { true => { } }; + match check true { true => { } }; } fn main() { } diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs index 4f9e62e0502..c1d4cdb4a57 100644 --- a/src/test/compile-fail/liveness-unused.rs +++ b/src/test/compile-fail/liveness-unused.rs @@ -27,7 +27,7 @@ fn f3b() { } fn f4() { - alt some(3) { + match some(3) { some(i) => { } none => {} diff --git a/src/test/compile-fail/non-exhaustive-match-nested.rs b/src/test/compile-fail/non-exhaustive-match-nested.rs index dea250a734c..01641f5b9c7 100644 --- a/src/test/compile-fail/non-exhaustive-match-nested.rs +++ b/src/test/compile-fail/non-exhaustive-match-nested.rs @@ -5,7 +5,7 @@ enum u { c, d } fn main() { let x = a(c); - alt x { + match x { a(d) => { fail ~"hello"; } b => { fail ~"goodbye"; } } diff --git a/src/test/compile-fail/non-exhaustive-match.rs b/src/test/compile-fail/non-exhaustive-match.rs index e712406ba19..173fd2b4109 100644 --- a/src/test/compile-fail/non-exhaustive-match.rs +++ b/src/test/compile-fail/non-exhaustive-match.rs @@ -2,25 +2,25 @@ enum t { a, b, } fn main() { let x = a; - alt x { b => { } } //~ ERROR non-exhaustive patterns - alt true { //~ ERROR non-exhaustive patterns + match x { b => { } } //~ ERROR non-exhaustive patterns + match true { //~ ERROR non-exhaustive patterns true => {} } - alt @some(10) { //~ ERROR non-exhaustive patterns + match @some(10) { //~ ERROR non-exhaustive patterns @none => {} } - alt (2, 3, 4) { //~ ERROR non-exhaustive patterns + match (2, 3, 4) { //~ ERROR non-exhaustive patterns (_, _, 4) => {} } - alt (a, a) { //~ ERROR non-exhaustive patterns + match (a, a) { //~ ERROR non-exhaustive patterns (a, b) => {} (b, a) => {} } - alt a { //~ ERROR b not covered + match a { //~ ERROR b not covered a => {} } // This is exhaustive, though the algorithm got it wrong at one point - alt (a, b) { + match (a, b) { (a, _) => {} (_, a) => {} (b, b) => {} diff --git a/src/test/compile-fail/occurs-check-3.rs b/src/test/compile-fail/occurs-check-3.rs index 207bbd91cc5..e8c8f32b72f 100644 --- a/src/test/compile-fail/occurs-check-3.rs +++ b/src/test/compile-fail/occurs-check-3.rs @@ -1,4 +1,4 @@ // error-pattern:mismatched types // From Issue #778 enum clam<T> { a(T), } -fn main() { let c; c = a(c); alt c { a::<int>(_) => { } } } +fn main() { let c; c = a(c); match c { a::<int>(_) => { } } } diff --git a/src/test/compile-fail/or-patter-mismatch.rs b/src/test/compile-fail/or-patter-mismatch.rs index 37d194cbd50..f309ead4623 100644 --- a/src/test/compile-fail/or-patter-mismatch.rs +++ b/src/test/compile-fail/or-patter-mismatch.rs @@ -2,4 +2,4 @@ enum blah { a(int, int, uint), b(int, int), } -fn main() { alt a(1, 1, 2u) { a(_, x, y) | b(x, y) => { } } } +fn main() { match a(1, 1, 2u) { a(_, x, y) | b(x, y) => { } } } diff --git a/src/test/compile-fail/pattern-tyvar-2.rs b/src/test/compile-fail/pattern-tyvar-2.rs index 1dee20e0ef6..f1e8224efc5 100644 --- a/src/test/compile-fail/pattern-tyvar-2.rs +++ b/src/test/compile-fail/pattern-tyvar-2.rs @@ -8,6 +8,6 @@ import option::some; enum bar { t1((), option<~[int]>), t2, } -fn foo(t: bar) -> int { alt t { t1(_, some(x)) => { return x * 3; } _ => { fail; } } } +fn foo(t: bar) -> int { match t { t1(_, some(x)) => { return x * 3; } _ => { fail; } } } fn main() { } diff --git a/src/test/compile-fail/pattern-tyvar.rs b/src/test/compile-fail/pattern-tyvar.rs index 2622dadc040..8b7c065dbf7 100644 --- a/src/test/compile-fail/pattern-tyvar.rs +++ b/src/test/compile-fail/pattern-tyvar.rs @@ -8,7 +8,7 @@ import option::some; enum bar { t1((), option<~[int]>), t2, } fn foo(t: bar) { - alt t { + match t { t1(_, some::<int>(x)) => { log(debug, x); } diff --git a/src/test/compile-fail/regions-creating-enums.rs b/src/test/compile-fail/regions-creating-enums.rs index 0702618c68c..6cacf49300d 100644 --- a/src/test/compile-fail/regions-creating-enums.rs +++ b/src/test/compile-fail/regions-creating-enums.rs @@ -11,14 +11,14 @@ fn build() { } fn compute(x: &ast) -> uint { - alt *x { + match *x { num(x) => { x } add(x, y) => { compute(x) + compute(y) } } } fn map_nums(x: &ast, f: fn(uint) -> uint) -> &ast { - alt *x { + match *x { num(x) => { return &num(f(x)); //~ ERROR illegal borrow } diff --git a/src/test/compile-fail/restricted-keyword1.rs b/src/test/compile-fail/restricted-keyword1.rs index 2a9f5838c85..c301d8199de 100644 --- a/src/test/compile-fail/restricted-keyword1.rs +++ b/src/test/compile-fail/restricted-keyword1.rs @@ -1,7 +1,7 @@ // error-pattern:found `let` in restricted position fn main() { - alt true { + match true { {let} { } } } diff --git a/src/test/compile-fail/unreachable-arm.rs b/src/test/compile-fail/unreachable-arm.rs index 1865fe6aff9..71875e92a8f 100644 --- a/src/test/compile-fail/unreachable-arm.rs +++ b/src/test/compile-fail/unreachable-arm.rs @@ -2,4 +2,4 @@ enum foo { a(@foo, int), b(uint), } -fn main() { alt b(1u) { b(_) | a(@_, 1) => { } a(_, 1) => { } } } +fn main() { match b(1u) { b(_) | a(@_, 1) => { } a(_, 1) => { } } } diff --git a/src/test/pretty/alt-naked-expr-long.rs b/src/test/pretty/alt-naked-expr-long.rs index 817a4056f10..3e3b4581f62 100644 --- a/src/test/pretty/alt-naked-expr-long.rs +++ b/src/test/pretty/alt-naked-expr-long.rs @@ -6,7 +6,7 @@ fn main() { let x = some(3); let y = - alt x { + match x { some(_) => ~"some" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very" + ~"long" + ~"string", diff --git a/src/test/pretty/alt-naked-expr-medium.rs b/src/test/pretty/alt-naked-expr-medium.rs index 70099e46806..9c6e74f4833 100644 --- a/src/test/pretty/alt-naked-expr-medium.rs +++ b/src/test/pretty/alt-naked-expr-medium.rs @@ -3,7 +3,7 @@ fn main() { let x = some(3); let _y = - alt x { + match x { some(_) => ~[~"some(_)", ~"not", ~"SO", ~"long", ~"string"], none => ~[~"none"] }; diff --git a/src/test/pretty/alt-naked-expr.rs b/src/test/pretty/alt-naked-expr.rs index 2df23671857..0ad75ab68f9 100644 --- a/src/test/pretty/alt-naked-expr.rs +++ b/src/test/pretty/alt-naked-expr.rs @@ -2,6 +2,6 @@ fn main() { let x = some(3); - let y = alt x { some(_) => ~"some(_)", none => ~"none" }; + let y = match x { some(_) => ~"some(_)", none => ~"none" }; assert y == ~"some(_)"; } diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index 14a8629ab72..357a6d19fe4 100644 --- a/src/test/pretty/block-disambig.rs +++ b/src/test/pretty/block-disambig.rs @@ -8,7 +8,7 @@ fn test2() -> int { let val = @0; { } *val } fn test3() { let regs = @{mut eax: 0}; - alt check true { true => { } } + match check true { true => { } } (*regs).eax = 1; } @@ -20,13 +20,13 @@ fn test6() -> bool { { } (true || false) && true } fn test7() -> uint { let regs = @0; - alt check true { true => { } } + match check true { true => { } } (*regs < 2) as uint } fn test8() -> int { let val = @0; - alt check true { + match check true { true => { } } if *val < 1 { @@ -36,11 +36,11 @@ fn test8() -> int { } } -fn test9() { let regs = @mut 0; alt check true { true => { } } *regs += 1; } +fn test9() { let regs = @mut 0; match check true { true => { } } *regs += 1; } fn test10() -> int { let regs = @mut ~[0]; - alt check true { true => { } } + match check true { true => { } } (*regs)[0] } diff --git a/src/test/pretty/unary-op-disambig.rs b/src/test/pretty/unary-op-disambig.rs index 1f9d68cc8a2..1e2c95fa325 100644 --- a/src/test/pretty/unary-op-disambig.rs +++ b/src/test/pretty/unary-op-disambig.rs @@ -10,8 +10,8 @@ fn if_semi() -> int { if true { f() } else { f() }; -1 } fn if_nosemi() -> int { (if true { 0 } else { 0 }) - 1 } -fn alt_semi() -> int { alt check true { true => { f() } }; -1 } +fn alt_semi() -> int { match check true { true => { f() } }; -1 } -fn alt_no_semi() -> int { (alt check true { true => { 0 } }) - 1 } +fn alt_no_semi() -> int { (match check true { true => { 0 } }) - 1 } fn stmt() { { f() }; -1; } diff --git a/src/test/run-fail/alt-bot-fail.rs b/src/test/run-fail/alt-bot-fail.rs index 08320af9775..da4ffdd5afc 100644 --- a/src/test/run-fail/alt-bot-fail.rs +++ b/src/test/run-fail/alt-bot-fail.rs @@ -4,6 +4,6 @@ fn foo(s: ~str) { } fn main() { let i = - alt some::<int>(3) { none::<int> => { fail } some::<int>(_) => { fail } }; + match some::<int>(3) { none::<int> => { fail } some::<int>(_) => { fail } }; foo(i); } diff --git a/src/test/run-fail/alt-disc-bot.rs b/src/test/run-fail/alt-disc-bot.rs index ab444a8273e..e3bc3c16384 100644 --- a/src/test/run-fail/alt-disc-bot.rs +++ b/src/test/run-fail/alt-disc-bot.rs @@ -1,4 +1,4 @@ // error-pattern:quux fn f() -> ! { fail ~"quux" } -fn g() -> int { alt f() { true => { 1 } false => { 0 } } } +fn g() -> int { match f() { true => { 1 } false => { 0 } } } fn main() { g(); } diff --git a/src/test/run-fail/alt-wildcards.rs b/src/test/run-fail/alt-wildcards.rs index 3a3c4c5a0a8..39a381dd3ac 100644 --- a/src/test/run-fail/alt-wildcards.rs +++ b/src/test/run-fail/alt-wildcards.rs @@ -1,6 +1,6 @@ // error-pattern:squirrelcupcake fn cmp() -> int { - alt check (option::some('a'), option::none::<char>) { + match check (option::some('a'), option::none::<char>) { (option::some(_), _) => { fail ~"squirrelcupcake"; } (_, option::some(_)) => { fail; } } diff --git a/src/test/run-fail/expr-alt-fail-fn.rs b/src/test/run-fail/expr-alt-fail-fn.rs index f6d3779b9f0..6c21859baeb 100644 --- a/src/test/run-fail/expr-alt-fail-fn.rs +++ b/src/test/run-fail/expr-alt-fail-fn.rs @@ -4,6 +4,6 @@ // error-pattern:explicit failure fn f() -> ! { fail } -fn g() -> int { let x = alt true { true => { f() } false => { 10 } }; return x; } +fn g() -> int { let x = match true { true => { f() } false => { 10 } }; return x; } fn main() { g(); } diff --git a/src/test/run-fail/expr-alt-fail.rs b/src/test/run-fail/expr-alt-fail.rs index 3a70b690755..a7f19c6d3ce 100644 --- a/src/test/run-fail/expr-alt-fail.rs +++ b/src/test/run-fail/expr-alt-fail.rs @@ -2,4 +2,4 @@ // error-pattern:explicit failure -fn main() { let x = alt true { false => { 0 } true => { fail } }; } +fn main() { let x = match true { false => { 0 } true => { fail } }; } diff --git a/src/test/run-fail/fail-parens.rs b/src/test/run-fail/fail-parens.rs index 849d4b41d3b..ddbd1200fcf 100644 --- a/src/test/run-fail/fail-parens.rs +++ b/src/test/run-fail/fail-parens.rs @@ -5,7 +5,7 @@ fn bigfail() { do { while (fail) { if (fail) { - alt (fail) { _ { + match (fail) { _ { }} }}} while fail; } diff --git a/src/test/run-fail/issue-2156.rs b/src/test/run-fail/issue-2156.rs index 026af3a2f65..d18c7de3d34 100644 --- a/src/test/run-fail/issue-2156.rs +++ b/src/test/run-fail/issue-2156.rs @@ -5,6 +5,6 @@ import io::{reader, reader_util}; fn main() { do io::with_str_reader(~"") |rdr| { - alt rdr.read_char() { '=' => { } _ => { fail } } + match rdr.read_char() { '=' => { } _ => { fail } } } } diff --git a/src/test/run-fail/unwind-alt.rs b/src/test/run-fail/unwind-alt.rs index d5f013a42b6..579067927ca 100644 --- a/src/test/run-fail/unwind-alt.rs +++ b/src/test/run-fail/unwind-alt.rs @@ -4,7 +4,7 @@ fn test_box() { @0; } fn test_str() { - let res = alt check false { true => { ~"happy" } }; + let res = match check false { true => { ~"happy" } }; assert res == ~"happy"; } fn main() { diff --git a/src/test/run-pass/alt-arrows-blocky-commas.rs b/src/test/run-pass/alt-arrows-blocky-commas.rs index 100ec11cd96..289018013d3 100644 --- a/src/test/run-pass/alt-arrows-blocky-commas.rs +++ b/src/test/run-pass/alt-arrows-blocky-commas.rs @@ -1,6 +1,6 @@ // no-reformat // Testing the presense or absense of commas separating block-structure -// alt arm expressions +// match arm expressions fn fun(_f: fn()) { } @@ -10,13 +10,13 @@ fn it(_f: fn() -> bool) { fn main() { - alt 0 { + match 0 { 00 => { } 01 => if true { } else { } - 03 => alt 0 { + 03 => match 0 { _ => () } 04 => do fun { @@ -36,7 +36,7 @@ fn main() { 11 => if true { } else { }, - 13 => alt 0 { + 13 => match 0 { _ => () }, 14 => do fun { diff --git a/src/test/run-pass/alt-bot-2.rs b/src/test/run-pass/alt-bot-2.rs index cbf1519dc34..8b9f606d8d8 100644 --- a/src/test/run-pass/alt-bot-2.rs +++ b/src/test/run-pass/alt-bot-2.rs @@ -1,3 +1,3 @@ // n.b. This was only ever failing with optimization disabled. -fn a() -> int { alt check return 1 { 2 => 3 } } +fn a() -> int { match check return 1 { 2 => 3 } } fn main() { a(); } diff --git a/src/test/run-pass/alt-bot.rs b/src/test/run-pass/alt-bot.rs index 7162bf69aa5..06b6eca4b83 100644 --- a/src/test/run-pass/alt-bot.rs +++ b/src/test/run-pass/alt-bot.rs @@ -1,6 +1,6 @@ fn main() { let i: int = - alt some::<int>(3) { none::<int> => { fail } some::<int>(_) => { 5 } }; + match some::<int>(3) { none::<int> => { fail } some::<int>(_) => { 5 } }; log(debug, i); } diff --git a/src/test/run-pass/alt-implicit-copy-unique.rs b/src/test/run-pass/alt-implicit-copy-unique.rs index 796a73a0204..eca726e8277 100644 --- a/src/test/run-pass/alt-implicit-copy-unique.rs +++ b/src/test/run-pass/alt-implicit-copy-unique.rs @@ -1,6 +1,6 @@ fn main() { let x = ~{mut a: ~10, b: ~20}; - alt x { + match x { ~{a, b} => { assert *a == 10; (*x).a = ~30; assert *a == 30; } } } diff --git a/src/test/run-pass/alt-implicit-copy.rs b/src/test/run-pass/alt-implicit-copy.rs index 355e678d3a3..f4d14cbc728 100644 --- a/src/test/run-pass/alt-implicit-copy.rs +++ b/src/test/run-pass/alt-implicit-copy.rs @@ -1,6 +1,6 @@ fn main() { let x = @{mut a: @10, b: @20}; - alt x { + match x { @{a, b} => { assert *a == 10; (*x).a = @30; assert *a == 30; } } } diff --git a/src/test/run-pass/alt-join.rs b/src/test/run-pass/alt-join.rs index 2d4078ced04..5c51fd0d34d 100644 --- a/src/test/run-pass/alt-join.rs +++ b/src/test/run-pass/alt-join.rs @@ -10,7 +10,7 @@ fn foo<T>(y: option<T>) { if true { } else { - alt y { + match y { none::<T> => x = 17, _ => x = 42 } diff --git a/src/test/run-pass/alt-naked-record-expr.rs b/src/test/run-pass/alt-naked-record-expr.rs index 2fe2bfefa98..df2e9f5acd8 100644 --- a/src/test/run-pass/alt-naked-record-expr.rs +++ b/src/test/run-pass/alt-naked-record-expr.rs @@ -1,5 +1,5 @@ fn main() { - let x = alt 0 { + let x = match 0 { _ => { x: 0 }.x diff --git a/src/test/run-pass/alt-naked-record.rs b/src/test/run-pass/alt-naked-record.rs index 76cfb4cd11b..042861d0a86 100644 --- a/src/test/run-pass/alt-naked-record.rs +++ b/src/test/run-pass/alt-naked-record.rs @@ -1,5 +1,5 @@ fn main() { - let x = alt 0 { + let x = match 0 { _ => { x: 0 } diff --git a/src/test/run-pass/alt-path.rs b/src/test/run-pass/alt-path.rs index aa9e9f18481..cd8b21fc248 100644 --- a/src/test/run-pass/alt-path.rs +++ b/src/test/run-pass/alt-path.rs @@ -4,6 +4,6 @@ mod m1 { enum foo { foo1, foo2, } } -fn bar(x: m1::foo) { alt x { m1::foo1 => { } m1::foo2 => { } } } +fn bar(x: m1::foo) { match x { m1::foo1 => { } m1::foo2 => { } } } fn main() { } diff --git a/src/test/run-pass/alt-pattern-drop.rs b/src/test/run-pass/alt-pattern-drop.rs index 92366e54b30..ba8bef7e124 100644 --- a/src/test/run-pass/alt-pattern-drop.rs +++ b/src/test/run-pass/alt-pattern-drop.rs @@ -9,7 +9,7 @@ fn foo(s: @int) { let count = sys::refcount(s); let x: t = make_t(s); // ref up - alt x { + match x { make_t(y) => { log(debug, y); // ref up then down diff --git a/src/test/run-pass/alt-pattern-lit.rs b/src/test/run-pass/alt-pattern-lit.rs index bc1f788abc0..e5f86159421 100644 --- a/src/test/run-pass/alt-pattern-lit.rs +++ b/src/test/run-pass/alt-pattern-lit.rs @@ -1,7 +1,7 @@ fn altlit(f: int) -> int { - alt check f { + match check f { 10 => { debug!{"case 10"}; return 20; } 11 => { debug!{"case 11"}; return 22; } } diff --git a/src/test/run-pass/alt-pattern-no-type-params.rs b/src/test/run-pass/alt-pattern-no-type-params.rs index badad32ce28..447fd417e8d 100644 --- a/src/test/run-pass/alt-pattern-no-type-params.rs +++ b/src/test/run-pass/alt-pattern-no-type-params.rs @@ -1,7 +1,7 @@ enum maybe<T> { nothing, just(T), } fn foo(x: maybe<int>) { - alt x { nothing => { error!{"A"}; } just(a) => { error!{"B"}; } } + match x { nothing => { error!{"A"}; } just(a) => { error!{"B"}; } } } fn main() { } diff --git a/src/test/run-pass/alt-pattern-simple.rs b/src/test/run-pass/alt-pattern-simple.rs index e4ca776bb61..fd31a235ba9 100644 --- a/src/test/run-pass/alt-pattern-simple.rs +++ b/src/test/run-pass/alt-pattern-simple.rs @@ -1,5 +1,5 @@ -fn altsimple(f: int) { alt f { x => () } } +fn altsimple(f: int) { match f { x => () } } fn main() { } diff --git a/src/test/run-pass/alt-phi.rs b/src/test/run-pass/alt-phi.rs index 358b8d64e6c..cea0e1b4533 100644 --- a/src/test/run-pass/alt-phi.rs +++ b/src/test/run-pass/alt-phi.rs @@ -6,7 +6,7 @@ fn foo(it: fn(int)) { it(10); } fn main() { let mut x = true; - alt a { + match a { a => { x = true; foo(|_i| { } ) } b => { x = false; } c => { x = false; } diff --git a/src/test/run-pass/alt-range.rs b/src/test/run-pass/alt-range.rs index 75ca1dd5e52..f3713fabb13 100644 --- a/src/test/run-pass/alt-range.rs +++ b/src/test/run-pass/alt-range.rs @@ -1,29 +1,29 @@ fn main() { - alt 5u { + match 5u { 1u to 5u => {} _ => fail ~"should match range", } - alt 5u { + match 5u { 6u to 7u => fail ~"shouldn't match range", _ => {} } - alt check 5u { + match check 5u { 1u => fail ~"should match non-first range", 2u to 6u => {} } - alt 'c' { + match 'c' { 'a' to 'z' => {} _ => fail ~"should suppport char ranges" } - alt -3 { + match -3 { -7 to 5 => {} _ => fail ~"should match signed range" } - alt 3.0 { + match 3.0 { 1.0 to 5.0 => {} _ => fail ~"should match float range" } - alt -1.5 { + match -1.5 { -3.6 to 3.6 => {} _ => fail ~"should match negative float range" } diff --git a/src/test/run-pass/alt-str.rs b/src/test/run-pass/alt-str.rs index 4693635458d..98754ecf0e2 100644 --- a/src/test/run-pass/alt-str.rs +++ b/src/test/run-pass/alt-str.rs @@ -1,21 +1,21 @@ // Issue #53 fn main() { - alt check ~"test" { ~"not-test" => fail, ~"test" => (), _ => fail } + match check ~"test" { ~"not-test" => fail, ~"test" => (), _ => fail } enum t { tag1(~str), tag2, } - alt tag1(~"test") { + match tag1(~"test") { tag2 => fail, tag1(~"not-test") => fail, tag1(~"test") => (), _ => fail } - let x = alt check ~"a" { ~"a" => 1, ~"b" => 2 }; + let x = match check ~"a" { ~"a" => 1, ~"b" => 2 }; assert (x == 1); - alt check ~"a" { ~"a" => { } ~"b" => { } } + match check ~"a" { ~"a" => { } ~"b" => { } } } diff --git a/src/test/run-pass/alt-tag.rs b/src/test/run-pass/alt-tag.rs index 4b8cdce110e..0c75cafa204 100644 --- a/src/test/run-pass/alt-tag.rs +++ b/src/test/run-pass/alt-tag.rs @@ -10,7 +10,7 @@ enum color { fn process(c: color) -> int { let mut x: int; - alt c { + match c { rgb(r, _, _) => { debug!{"rgb"}; log(debug, r); x = r; } rgba(_, _, _, a) => { debug!{"rgba"}; log(debug, a); x = a; } hsl(_, s, _) => { debug!{"hsl"}; log(debug, s); x = s; } diff --git a/src/test/run-pass/alt-type-simple.rs b/src/test/run-pass/alt-type-simple.rs index 207f718f3aa..4881a6bba4a 100644 --- a/src/test/run-pass/alt-type-simple.rs +++ b/src/test/run-pass/alt-type-simple.rs @@ -2,7 +2,7 @@ // xfail-test fn altsimple(any x) { - alt type (f) { + match type (f) { case (int i) { print("int"); } case (str s) { print("str"); } } diff --git a/src/test/run-pass/alt-unique-bind.rs b/src/test/run-pass/alt-unique-bind.rs index b907afa1e8d..7548d171d1c 100644 --- a/src/test/run-pass/alt-unique-bind.rs +++ b/src/test/run-pass/alt-unique-bind.rs @@ -1,5 +1,5 @@ fn main() { - alt ~100 { + match ~100 { ~x => { debug!{"%?", x}; assert x == 100; diff --git a/src/test/run-pass/alt-with-ret-arm.rs b/src/test/run-pass/alt-with-ret-arm.rs index 50c03e71be2..c07391b691b 100644 --- a/src/test/run-pass/alt-with-ret-arm.rs +++ b/src/test/run-pass/alt-with-ret-arm.rs @@ -2,7 +2,7 @@ fn main() { // sometimes we have had trouble finding // the right type for f, as we unified // bot and u32 here - let f = alt uint::from_str(~"1234") { + let f = match uint::from_str(~"1234") { none => return (), some(num) => num as u32 }; diff --git a/src/test/run-pass/binary-minus-without-space.rs b/src/test/run-pass/binary-minus-without-space.rs index d2df3b2dab3..86bdd52c6af 100644 --- a/src/test/run-pass/binary-minus-without-space.rs +++ b/src/test/run-pass/binary-minus-without-space.rs @@ -1,6 +1,6 @@ // Check that issue #954 stays fixed fn main() { - alt check -1 { -1 => {} } + match check -1 { -1 => {} } assert 1-1 == 0; } diff --git a/src/test/run-pass/block-arg.rs b/src/test/run-pass/block-arg.rs index 685f68c61ad..db941d32e11 100644 --- a/src/test/run-pass/block-arg.rs +++ b/src/test/run-pass/block-arg.rs @@ -24,11 +24,11 @@ fn main() { if !do vec::any(v) |e| { float::is_positive(e) } { assert false; } - alt do vec::all(v) |e| { float::is_negative(e) } { + match do vec::all(v) |e| { float::is_negative(e) } { true => { fail ~"incorrect answer."; } false => { } } - alt 3 { + match 3 { _ if do vec::any(v) |e| { float::is_negative(e) } => { } _ => { diff --git a/src/test/run-pass/borrowck-pat-reassign-no-binding.rs b/src/test/run-pass/borrowck-pat-reassign-no-binding.rs index bbc2abf51af..5f4804c778b 100644 --- a/src/test/run-pass/borrowck-pat-reassign-no-binding.rs +++ b/src/test/run-pass/borrowck-pat-reassign-no-binding.rs @@ -1,6 +1,6 @@ fn main() { let mut x = none; - alt x { + match x { none => { // It is ok to reassign x here, because there is in // fact no outstanding loan of x! diff --git a/src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs b/src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs index 87b4fd59e5f..58694e8f135 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs @@ -2,7 +2,7 @@ fn main() { let x: @mut @option<~int> = @mut @none; - alt x { + match x { @@some(y) => { // here, the refcount of `*x` is bumped so // `y` remains valid even if `*x` is modified. diff --git a/src/test/run-pass/borrowck-preserve-box-in-discr.rs b/src/test/run-pass/borrowck-preserve-box-in-discr.rs index 99b446ce315..101f9c787d3 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-discr.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-discr.rs @@ -2,7 +2,7 @@ fn main() { let mut x = @{f: ~3}; - alt *x { + match *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/borrowck-preserve-box-in-pat.rs b/src/test/run-pass/borrowck-preserve-box-in-pat.rs index 7a37432db74..c5d5fd96673 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-pat.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-pat.rs @@ -2,7 +2,7 @@ fn main() { let mut x = @mut @{f: ~3}; - alt x { + match 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/borrowck-preserve-box-sometimes-needed.rs b/src/test/run-pass/borrowck-preserve-box-sometimes-needed.rs index f8bf02a7703..11bc8e6fa7f 100644 --- a/src/test/run-pass/borrowck-preserve-box-sometimes-needed.rs +++ b/src/test/run-pass/borrowck-preserve-box-sometimes-needed.rs @@ -2,7 +2,7 @@ fn switcher(x: option<@int>) { let mut x = x; - alt x { + match x { some(@y) => { copy y; x = none; } none => { } } diff --git a/src/test/run-pass/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck-univariant-enum.rs index fde259046a7..15f22e7ced8 100644 --- a/src/test/run-pass/borrowck-univariant-enum.rs +++ b/src/test/run-pass/borrowck-univariant-enum.rs @@ -9,7 +9,7 @@ fn main() { let x = @mut 5; let y = @mut newtype(3); - let z = alt *y { + let z = match *y { newtype(b) => { *x += 1; *x * b diff --git a/src/test/run-pass/box-pattern.rs b/src/test/run-pass/box-pattern.rs index faf3ff73b01..90228f3dcf2 100644 --- a/src/test/run-pass/box-pattern.rs +++ b/src/test/run-pass/box-pattern.rs @@ -2,7 +2,7 @@ type foo = {a: int, b: uint}; enum bar { u(@foo), w(int), } fn main() { - assert (alt u(@{a: 10, b: 40u}) { + assert (match u(@{a: 10, b: 40u}) { u(@{a: a, b: b}) => { a + (b as int) } _ => { 66 } } == 50); diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index 175c5f9936a..fc85484193c 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -48,7 +48,7 @@ class cat<T: copy> : map<int, T> { fn contains_key(+k: int) -> bool { k <= self.meows } fn contains_key_ref(k: &int) -> bool { self.contains_key(*k) } - fn get(+k:int) -> T { alt self.find(k) { + fn get(+k:int) -> T { match self.find(k) { some(v) => { v } none => { fail ~"epic fail"; } } @@ -61,7 +61,7 @@ class cat<T: copy> : map<int, T> { } fn remove(+k:int) -> option<T> { - alt self.find(k) { + match self.find(k) { some(x) => { self.meows -= k; some(x) } diff --git a/src/test/run-pass/drop-on-empty-block-exit.rs b/src/test/run-pass/drop-on-empty-block-exit.rs index 3b9d41fc82a..4a397970669 100644 --- a/src/test/run-pass/drop-on-empty-block-exit.rs +++ b/src/test/run-pass/drop-on-empty-block-exit.rs @@ -2,4 +2,4 @@ enum t { foo(@int), } -fn main() { let tt = foo(@10); alt tt { foo(z) => { } } } +fn main() { let tt = foo(@10); match tt { foo(z) => { } } } diff --git a/src/test/run-pass/expr-alt-box.rs b/src/test/run-pass/expr-alt-box.rs index 8930f113431..eb49160ce6f 100644 --- a/src/test/run-pass/expr-alt-box.rs +++ b/src/test/run-pass/expr-alt-box.rs @@ -3,14 +3,14 @@ // -*- rust -*- -// Tests for alt as expressions resulting in boxed types +// Tests for match as expressions resulting in boxed types fn test_box() { - let res = alt check true { true => { @100 } }; + let res = match check true { true => { @100 } }; assert (*res == 100); } fn test_str() { - let res = alt check true { true => { ~"happy" } }; + let res = match check true { true => { ~"happy" } }; assert (res == ~"happy"); } diff --git a/src/test/run-pass/expr-alt-fail-all.rs b/src/test/run-pass/expr-alt-fail-all.rs index a38464f6d0a..bd55f4d663e 100644 --- a/src/test/run-pass/expr-alt-fail-all.rs +++ b/src/test/run-pass/expr-alt-fail-all.rs @@ -1,12 +1,12 @@ -// When all branches of an alt expression result in fail, the entire -// alt expression results in fail. +// When all branches of an match expression result in fail, the entire +// match expression results in fail. fn main() { let x = - alt true { + match true { true => { 10 } - false => { alt true { true => { fail } false => { fail } } } + false => { match true { true => { fail } false => { fail } } } }; } diff --git a/src/test/run-pass/expr-alt-fail.rs b/src/test/run-pass/expr-alt-fail.rs index 5635a660f42..a490aac5c95 100644 --- a/src/test/run-pass/expr-alt-fail.rs +++ b/src/test/run-pass/expr-alt-fail.rs @@ -1,10 +1,10 @@ fn test_simple() { - let r = alt true { true => { true } false => { fail } }; + let r = match true { true => { true } false => { fail } }; assert (r == true); } fn test_box() { - let r = alt true { true => { ~[10] } false => { fail } }; + let r = match true { true => { ~[10] } false => { fail } }; assert (r[0] == 10); } diff --git a/src/test/run-pass/expr-alt-generic-box1.rs b/src/test/run-pass/expr-alt-generic-box1.rs index f3f9dee2ff4..40121de92db 100644 --- a/src/test/run-pass/expr-alt-generic-box1.rs +++ b/src/test/run-pass/expr-alt-generic-box1.rs @@ -5,7 +5,7 @@ type compare<T> = fn@(@T, @T) -> bool; fn test_generic<T>(expected: @T, eq: compare<T>) { - let actual: @T = alt check true { true => { expected } }; + let actual: @T = match check true { true => { expected } }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-box2.rs b/src/test/run-pass/expr-alt-generic-box2.rs index e03c196c289..73c6a4b68b4 100644 --- a/src/test/run-pass/expr-alt-generic-box2.rs +++ b/src/test/run-pass/expr-alt-generic-box2.rs @@ -5,7 +5,7 @@ type compare<T> = fn@(T, T) -> bool; fn test_generic<T: copy>(expected: T, eq: compare<T>) { - let actual: T = alt check true { true => { expected } }; + let actual: T = match check true { true => { expected } }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique1.rs b/src/test/run-pass/expr-alt-generic-unique1.rs index 5168fd5ca80..420cb030134 100644 --- a/src/test/run-pass/expr-alt-generic-unique1.rs +++ b/src/test/run-pass/expr-alt-generic-unique1.rs @@ -4,7 +4,7 @@ type compare<T> = fn@(~T, ~T) -> bool; fn test_generic<T: copy>(expected: ~T, eq: compare<T>) { - let actual: ~T = alt check true { true => { expected } }; + let actual: ~T = match check true { true => { expected } }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique2.rs b/src/test/run-pass/expr-alt-generic-unique2.rs index e1475373dc2..c425bedcef9 100644 --- a/src/test/run-pass/expr-alt-generic-unique2.rs +++ b/src/test/run-pass/expr-alt-generic-unique2.rs @@ -5,7 +5,7 @@ type compare<T> = fn@(T, T) -> bool; fn test_generic<T: copy>(expected: T, eq: compare<T>) { - let actual: T = alt check true { true => { expected } }; + let actual: T = match check true { true => { expected } }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic.rs b/src/test/run-pass/expr-alt-generic.rs index 98536b1afe1..6f947402a13 100644 --- a/src/test/run-pass/expr-alt-generic.rs +++ b/src/test/run-pass/expr-alt-generic.rs @@ -5,7 +5,7 @@ type compare<T> = fn@(T, T) -> bool; fn test_generic<T: copy>(expected: T, eq: compare<T>) { - let actual: T = alt check true { true => { expected } }; + let actual: T = match check true { true => { expected } }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-struct.rs b/src/test/run-pass/expr-alt-struct.rs index 2bfef283f9d..c0be37942a5 100644 --- a/src/test/run-pass/expr-alt-struct.rs +++ b/src/test/run-pass/expr-alt-struct.rs @@ -3,15 +3,15 @@ // -*- rust -*- -// Tests for alt as expressions resulting in structural types +// Tests for match as expressions resulting in structural types fn test_rec() { - let rs = alt check true { true => { {i: 100} } }; + let rs = match check true { true => { {i: 100} } }; assert (rs == {i: 100}); } fn test_tag() { enum mood { happy, sad, } - let rs = alt true { true => { happy } false => { sad } }; + let rs = match true { true => { happy } false => { sad } }; assert (rs == happy); } diff --git a/src/test/run-pass/expr-alt-unique.rs b/src/test/run-pass/expr-alt-unique.rs index 58a88bee1d3..6e261899123 100644 --- a/src/test/run-pass/expr-alt-unique.rs +++ b/src/test/run-pass/expr-alt-unique.rs @@ -3,9 +3,9 @@ // -*- rust -*- -// Tests for alt as expressions resulting in boxed types +// Tests for match as expressions resulting in boxed types fn test_box() { - let res = alt check true { true => { ~100 } }; + let res = match check true { true => { ~100 } }; assert (*res == 100); } diff --git a/src/test/run-pass/expr-alt.rs b/src/test/run-pass/expr-alt.rs index 2e855ce36fa..f744193e7dc 100644 --- a/src/test/run-pass/expr-alt.rs +++ b/src/test/run-pass/expr-alt.rs @@ -3,16 +3,16 @@ // -*- rust -*- -// Tests for using alt as an expression +// Tests for using match as an expression fn test_basic() { - let mut rs: bool = alt true { true => { true } false => { false } }; + let mut rs: bool = match true { true => { true } false => { false } }; assert (rs); - rs = alt false { true => { false } false => { true } }; + rs = match false { true => { false } false => { true } }; assert (rs); } fn test_inferrence() { - let mut rs = alt true { true => { true } false => { false } }; + let mut rs = match true { true => { true } false => { false } }; assert (rs); } @@ -20,7 +20,7 @@ fn test_alt_as_alt_head() { // Yeah, this is kind of confusing ... let rs = - alt alt false { true => { true } false => { false } } { + match match false { true => { true } false => { false } } { true => { false } false => { true } }; @@ -29,9 +29,9 @@ fn test_alt_as_alt_head() { fn test_alt_as_block_result() { let rs = - alt false { + match false { true => { false } - false => { alt true { true => { true } false => { false } } } + false => { match true { true => { true } false => { false } } } }; assert (rs); } diff --git a/src/test/run-pass/expr-empty-ret.rs b/src/test/run-pass/expr-empty-ret.rs index 1148d145ba0..42bf4bd973b 100644 --- a/src/test/run-pass/expr-empty-ret.rs +++ b/src/test/run-pass/expr-empty-ret.rs @@ -1,5 +1,5 @@ // Issue #521 -fn f() { let x = alt true { true => { 10 } false => { return } }; } +fn f() { let x = match true { true => { 10 } false => { return } }; } fn main() { } diff --git a/src/test/run-pass/expr-fn.rs b/src/test/run-pass/expr-fn.rs index 8d38e5d2941..f181b3f3261 100644 --- a/src/test/run-pass/expr-fn.rs +++ b/src/test/run-pass/expr-fn.rs @@ -14,7 +14,7 @@ fn test_generic() { } fn test_alt() { - fn f() -> int { alt true { false => { 10 } true => { 20 } } } + fn f() -> int { match true { false => { 10 } true => { 20 } } } assert (f() == 20); } diff --git a/src/test/run-pass/fat-arrow-alt.rs b/src/test/run-pass/fat-arrow-alt.rs index a117039946d..5c80ebfae23 100644 --- a/src/test/run-pass/fat-arrow-alt.rs +++ b/src/test/run-pass/fat-arrow-alt.rs @@ -8,7 +8,7 @@ enum color { } fn main() { - log(error, alt red { + log(error, match red { red => { 1 } green => { 2 } blue => { 3 } diff --git a/src/test/run-pass/generic-tag-alt.rs b/src/test/run-pass/generic-tag-alt.rs index 68013a41072..fab82aaf7ae 100644 --- a/src/test/run-pass/generic-tag-alt.rs +++ b/src/test/run-pass/generic-tag-alt.rs @@ -4,7 +4,7 @@ enum foo<T> { arm(T), } fn altfoo<T>(f: foo<T>) { let mut hit = false; - alt f { arm::<T>(x) => { debug!{"in arm"}; hit = true; } } + match f { arm::<T>(x) => { debug!{"in arm"}; hit = true; } } assert (hit); } diff --git a/src/test/run-pass/generic-tag-values.rs b/src/test/run-pass/generic-tag-values.rs index 237c8c7f844..db18b4681e6 100644 --- a/src/test/run-pass/generic-tag-values.rs +++ b/src/test/run-pass/generic-tag-values.rs @@ -6,9 +6,9 @@ enum noption<T> { some(T), } fn main() { let nop: noption<int> = some::<int>(5); - alt nop { some::<int>(n) => { log(debug, n); assert (n == 5); } } + match nop { some::<int>(n) => { log(debug, n); assert (n == 5); } } let nop2: noption<{x: int, y: int}> = some({x: 17, y: 42}); - alt nop2 { + match nop2 { some(t) => { log(debug, t.x); log(debug, t.y); diff --git a/src/test/run-pass/guards.rs b/src/test/run-pass/guards.rs index a34fa14860d..07ea8088431 100644 --- a/src/test/run-pass/guards.rs +++ b/src/test/run-pass/guards.rs @@ -1,10 +1,10 @@ fn main() { let a = - alt 10 { x if x < 7 => { 1 } x if x < 11 => { 2 } 10 => { 3 } _ => { 4 } }; + match 10 { x if x < 7 => { 1 } x if x < 11 => { 2 } 10 => { 3 } _ => { 4 } }; assert (a == 2); let b = - alt {x: 10, y: 20} { + match {x: 10, y: 20} { x if x.x < 5 && x.y < 5 => { 1 } {x: x, y: y} if x == 10 && y == 20 => { 2 } {x: x, y: y} => { 3 } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index e4fc8c1650f..d0098dd8afe 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -45,7 +45,7 @@ mod map_reduce { fn emit(im: map::hashmap<~str, int>, ctrl: chan<ctrl_proto>, key: ~str, val: ~str) { let mut c; - alt im.find(key) { + match im.find(key) { some(_c) => { c = _c } none => { let p = port(); @@ -78,11 +78,11 @@ mod map_reduce { let mut num_mappers = vec::len(inputs) as int; while num_mappers > 0 { - alt recv(ctrl) { + match recv(ctrl) { mapper_done => { num_mappers -= 1; } find_reducer(k, cc) => { let mut c; - alt reducers.find(str::from_bytes(k)) { + match reducers.find(str::from_bytes(k)) { some(_c) => { c = _c; } none => { c = 0; } } diff --git a/src/test/run-pass/inferred-suffix-in-pattern-range.rs b/src/test/run-pass/inferred-suffix-in-pattern-range.rs index ae9c27d7880..17f08a3ce27 100644 --- a/src/test/run-pass/inferred-suffix-in-pattern-range.rs +++ b/src/test/run-pass/inferred-suffix-in-pattern-range.rs @@ -1,20 +1,20 @@ fn main() { let x = 2; - let x_message = alt x { + let x_message = match x { 0 to 1 => { ~"not many" } _ => { ~"lots" } }; assert x_message == ~"lots"; let y = 2i; - let y_message = alt y { + let y_message = match y { 0 to 1 => { ~"not many" } _ => { ~"lots" } }; assert y_message == ~"lots"; let z = 1u64; - let z_message = alt z { + let z_message = match z { 0 to 1 => { ~"not many" } _ => { ~"lots" } }; diff --git a/src/test/run-pass/issue-1701.rs b/src/test/run-pass/issue-1701.rs index 4c1f703733d..7b411128dac 100644 --- a/src/test/run-pass/issue-1701.rs +++ b/src/test/run-pass/issue-1701.rs @@ -5,7 +5,7 @@ enum ear_kind { lop, upright } enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } fn noise(a: animal) -> option<~str> { - alt a { + match a { cat(*) => { some(~"meow") } dog(*) => { some(~"woof") } rabbit(*) => { none } diff --git a/src/test/run-pass/issue-2101.rs b/src/test/run-pass/issue-2101.rs index 6309e967db2..8017d9da15f 100644 --- a/src/test/run-pass/issue-2101.rs +++ b/src/test/run-pass/issue-2101.rs @@ -12,7 +12,7 @@ fn init(ar: &a.arena::arena, str: str) -> &a.hold { fn main(args: ~[str]) { let ar = arena::arena(); let leak = init(&ar, args[0]); - alt *leak { + match *leak { s(astr) { io::println(fmt!{"%?", astr}); } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 8fb85a7d11e..315c334f472 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -58,7 +58,7 @@ mod pipes { assert (*p).payload == none; (*p).payload <- some(payload); let old_state = swap_state_rel((*p).state, full); - alt old_state { + match old_state { empty => { // Yay, fastpath. @@ -84,7 +84,7 @@ mod pipes { loop { let old_state = swap_state_acq((*p).state, blocked); - alt old_state { + match old_state { empty | blocked => { task::yield(); } full => { let mut payload = none; @@ -101,7 +101,7 @@ mod pipes { fn sender_terminate<T: send>(p: *packet<T>) { let p = unsafe { uniquify(p) }; - alt swap_state_rel((*p).state, terminated) { + match swap_state_rel((*p).state, terminated) { empty | blocked => { // The receiver will eventually clean up. unsafe { forget(p) } @@ -118,7 +118,7 @@ mod pipes { fn receiver_terminate<T: send>(p: *packet<T>) { let p = unsafe { uniquify(p) }; - alt swap_state_rel((*p).state, terminated) { + match swap_state_rel((*p).state, terminated) { empty => { // the sender will clean up unsafe { forget(p) } @@ -178,7 +178,7 @@ mod pingpong { enum pong = pipes::send_packet<ping>; fn liberate_ping(-p: ping) -> pipes::send_packet<pong> unsafe { - let addr : *pipes::send_packet<pong> = alt p { + let addr : *pipes::send_packet<pong> = match p { ping(x) => { unsafe::reinterpret_cast(ptr::addr_of(x)) } }; let liberated_value <- *addr; @@ -187,7 +187,7 @@ mod pingpong { } fn liberate_pong(-p: pong) -> pipes::send_packet<ping> unsafe { - let addr : *pipes::send_packet<ping> = alt p { + let addr : *pipes::send_packet<ping> = match p { pong(x) => { unsafe::reinterpret_cast(ptr::addr_of(x)) } }; let liberated_value <- *addr; diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index dbaa37abacd..5066ff573b9 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -11,7 +11,7 @@ enum object fn lookup(table: std::map::hashmap<~str, std::json::json>, key: ~str, default: ~str) -> ~str { - alt table.find(key) + match table.find(key) { option::some(std::json::string(s)) => { @@ -31,7 +31,7 @@ fn lookup(table: std::map::hashmap<~str, std::json::json>, key: ~str, default: ~ fn add_interface(store: int, managed_ip: ~str, data: std::json::json) -> (~str, object) { - alt data + match data { std::json::dict(interface) => { @@ -50,7 +50,7 @@ fn add_interface(store: int, managed_ip: ~str, data: std::json::json) -> (~str, fn add_interfaces(store: int, managed_ip: ~str, device: std::map::hashmap<~str, std::json::json>) -> ~[(~str, object)] { - alt device[~"interfaces"] + match device[~"interfaces"] { std::json::list(interfaces) => { diff --git a/src/test/run-pass/issue-2869.rs b/src/test/run-pass/issue-2869.rs index 67d993504d1..f37322938ec 100644 --- a/src/test/run-pass/issue-2869.rs +++ b/src/test/run-pass/issue-2869.rs @@ -4,7 +4,7 @@ enum pat { pat_ident(option<uint>) } fn f(pat: pat) -> bool { true } fn num_bindings(pat: pat) -> uint { - alt pat { + match pat { pat_ident(_) if f(pat) { 0 } pat_ident(none) { 1 } pat_ident(some(sub)) { sub } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index a7ae3a55000..de1819f9577 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -17,7 +17,7 @@ enum square { impl of to_str::to_str for square { fn to_str() -> ~str { - alt self { + match self { bot => { ~"R" } wall => { ~"#" } rock => { ~"*" } @@ -31,7 +31,7 @@ impl of to_str::to_str for square { } fn square_from_char(c: char) -> square { - alt c { + match c { 'R' => { bot } '#' => { wall } '*' => { rock } diff --git a/src/test/run-pass/issue-3037.rs b/src/test/run-pass/issue-3037.rs index 92e18bde012..3907c2a796b 100644 --- a/src/test/run-pass/issue-3037.rs +++ b/src/test/run-pass/issue-3037.rs @@ -2,7 +2,7 @@ enum what { } fn what_to_str(x: what) -> ~str { - alt x { + match x { } } diff --git a/src/test/run-pass/issue-687.rs b/src/test/run-pass/issue-687.rs index a314bf4856b..f8f983d767f 100644 --- a/src/test/run-pass/issue-687.rs +++ b/src/test/run-pass/issue-687.rs @@ -48,7 +48,7 @@ fn main() { loop { let msg = recv(p); - alt msg { + match msg { closed => { debug!{"Got close message"}; break; } received(data) => { debug!{"Got data. Length is:"}; diff --git a/src/test/run-pass/keyword-changes-2012-07-31.rs b/src/test/run-pass/keyword-changes-2012-07-31.rs index c7d48d95108..95ac37c66b7 100644 --- a/src/test/run-pass/keyword-changes-2012-07-31.rs +++ b/src/test/run-pass/keyword-changes-2012-07-31.rs @@ -1,6 +1,6 @@ // return -> return // mod -> module -// alt -> match +// match -> match fn main() { } diff --git a/src/test/run-pass/leaky_comm.rs b/src/test/run-pass/leaky_comm.rs index 3a3bfa4f515..fcdafc6d8c1 100644 --- a/src/test/run-pass/leaky_comm.rs +++ b/src/test/run-pass/leaky_comm.rs @@ -6,7 +6,7 @@ use test_comm; fn main() { let p = test_comm::port(); - alt none::<int> { + match none::<int> { none => {} some(_) =>{ if test_comm::recv(p) == 0 { diff --git a/src/test/run-pass/macro-interpolation.rs b/src/test/run-pass/macro-interpolation.rs index cbaa9182dc5..a138fa1e18f 100644 --- a/src/test/run-pass/macro-interpolation.rs +++ b/src/test/run-pass/macro-interpolation.rs @@ -3,7 +3,7 @@ macro_rules! overly_complicated { {$fnname:ident, $arg:ident, $ty:ty, $body:block, $val:expr, $pat:pat, $res:path} => { fn $fnname($arg: $ty) -> option<$ty> $body - alt $fnname($val) { + match $fnname($val) { some($pat) => { $res } diff --git a/src/test/run-pass/module-polymorphism4-files/cat.rs b/src/test/run-pass/module-polymorphism4-files/cat.rs index 832cca5c4f1..f19b72ed181 100644 --- a/src/test/run-pass/module-polymorphism4-files/cat.rs +++ b/src/test/run-pass/module-polymorphism4-files/cat.rs @@ -7,7 +7,7 @@ enum cat { fn animal() -> ~str { ~"cat" } fn talk(c: cat) -> ~str { - alt c { + match c { howlycat => { ~"howl" } meowlycat => { ~"meow" } } diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index 1e611804f9f..59ea633f218 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -16,7 +16,7 @@ trait option_monad<A> { impl monad<A> of option_monad<A> for option<A> { fn bind<B>(f: fn(A) -> option<B>) -> option<B> { - alt self { + match self { some(a) => { f(a) } none => { none } } diff --git a/src/test/run-pass/negative.rs b/src/test/run-pass/negative.rs index 38661bb84b2..2284728f181 100644 --- a/src/test/run-pass/negative.rs +++ b/src/test/run-pass/negative.rs @@ -1,5 +1,5 @@ fn main() { - alt -5 { + match -5 { -5 => {} _ => { fail } } diff --git a/src/test/run-pass/nested-alts.rs b/src/test/run-pass/nested-alts.rs index ff0f0228a63..795a42f9790 100644 --- a/src/test/run-pass/nested-alts.rs +++ b/src/test/run-pass/nested-alts.rs @@ -2,10 +2,10 @@ fn baz() -> ! { fail; } fn foo() { - alt some::<int>(5) { + match some::<int>(5) { some::<int>(x) => { let mut bar; - alt none::<int> { none::<int> => { bar = 5; } _ => { baz(); } } + match none::<int> { none::<int> => { bar = 5; } _ => { baz(); } } log(debug, bar); } none::<int> => { debug!{"hello"}; } diff --git a/src/test/run-pass/nested-exhaustive-alt.rs b/src/test/run-pass/nested-exhaustive-alt.rs index 51d7b7d4538..4cfd1eaea12 100644 --- a/src/test/run-pass/nested-exhaustive-alt.rs +++ b/src/test/run-pass/nested-exhaustive-alt.rs @@ -1,5 +1,5 @@ fn main() { - alt @{foo: true, bar: some(10), baz: 20} { + match @{foo: true, bar: some(10), baz: 20} { @{foo: true, bar: some(_), _} => {} @{foo: false, bar: none, _} => {} @{foo: true, bar: none, _} => {} diff --git a/src/test/run-pass/nested-pattern.rs b/src/test/run-pass/nested-pattern.rs index ae901d1f9f1..a79b0844934 100644 --- a/src/test/run-pass/nested-pattern.rs +++ b/src/test/run-pass/nested-pattern.rs @@ -9,7 +9,7 @@ import option::none; enum t { foo(int, uint), bar(int, option<int>), } fn nested(o: t) { - alt o { + match o { bar(i, some::<int>(_)) => { error!{"wrong pattern matched"}; fail; } _ => { error!{"succeeded"}; } } diff --git a/src/test/run-pass/nested-patterns.rs b/src/test/run-pass/nested-patterns.rs index 0b93154b566..1066b5c8aef 100644 --- a/src/test/run-pass/nested-patterns.rs +++ b/src/test/run-pass/nested-patterns.rs @@ -1,5 +1,5 @@ fn main() { - alt {a: 10, b: @20} { + match {a: 10, b: @20} { x@{a, b: @20} => { assert x.a == 10; assert a == 10; } {b, _} => { fail; } } diff --git a/src/test/run-pass/nil-pattern.rs b/src/test/run-pass/nil-pattern.rs index c1ef9c5970e..7261cf4e2da 100644 --- a/src/test/run-pass/nil-pattern.rs +++ b/src/test/run-pass/nil-pattern.rs @@ -1 +1 @@ -fn main() { let x = (); alt x { () => { } } } +fn main() { let x = (); match x { () => { } } } diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs index a338fd39101..5a86d54c77f 100644 --- a/src/test/run-pass/non-boolean-pure-fns.rs +++ b/src/test/run-pass/non-boolean-pure-fns.rs @@ -3,7 +3,7 @@ use std; import std::list::*; pure fn pure_length_go<T: copy>(ls: @list<T>, acc: uint) -> uint { - alt *ls { nil => { acc } cons(_, tl) => { pure_length_go(tl, acc + 1u) } } + match *ls { nil => { acc } cons(_, tl) => { pure_length_go(tl, acc + 1u) } } } pure fn pure_length<T: copy>(ls: @list<T>) -> uint { pure_length_go(ls, 0u) } diff --git a/src/test/run-pass/nullary-or-pattern.rs b/src/test/run-pass/nullary-or-pattern.rs index a856eb3e61b..a73c98bfa4e 100644 --- a/src/test/run-pass/nullary-or-pattern.rs +++ b/src/test/run-pass/nullary-or-pattern.rs @@ -1,7 +1,7 @@ enum blah { a, b, } fn or_alt(q: blah) -> int { - alt q { a | b => { 42 } } + match q { a | b => { 42 } } } fn main() { diff --git a/src/test/run-pass/or-pattern.rs b/src/test/run-pass/or-pattern.rs index 979bf5522e9..d1316e7c0ce 100644 --- a/src/test/run-pass/or-pattern.rs +++ b/src/test/run-pass/or-pattern.rs @@ -1,7 +1,7 @@ enum blah { a(int, int, uint), b(int, int), c, } fn or_alt(q: blah) -> int { - alt q { a(x, y, _) | b(x, y) => { return x + y; } c => { return 0; } } + match q { a(x, y, _) | b(x, y) => { return x + y; } c => { return 0; } } } fn main() { diff --git a/src/test/run-pass/paren-free.rs b/src/test/run-pass/paren-free.rs index 5e115abb0dc..b9ea40b2b52 100644 --- a/src/test/run-pass/paren-free.rs +++ b/src/test/run-pass/paren-free.rs @@ -1,5 +1,5 @@ fn main() { let x = true; if x { let mut i = 10; while i > 0 { i -= 1; } } - alt x { true => { debug!{"right"}; } false => { debug!{"wrong"}; } } + match x { true => { debug!{"right"}; } false => { debug!{"wrong"}; } } } diff --git a/src/test/run-pass/pattern-bound-var-in-for-each.rs b/src/test/run-pass/pattern-bound-var-in-for-each.rs index ae753296a2f..ca049e1718c 100644 --- a/src/test/run-pass/pattern-bound-var-in-for-each.rs +++ b/src/test/run-pass/pattern-bound-var-in-for-each.rs @@ -4,7 +4,7 @@ fn foo(src: uint) { - alt some(src) { + match some(src) { some(src_id) => { for uint::range(0u, 10u) |i| { let yyy = src_id; diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index 81e33bbbebb..a3383a688cb 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -47,7 +47,7 @@ macro_rules! follow { { $($message:path($($x: ident),+) => $next:ident $e:expr)+ } => ( - |m| alt move_it(m) { + |m| match move_it(m) { $(some($message($($x,)* next)) { let $next = move_it!{next}; $e })+ @@ -58,7 +58,7 @@ macro_rules! follow { { $($message:path => $next:ident $e:expr)+ } => ( - |m| alt move_it(m) { + |m| match move_it(m) { $(some($message(next)) { let $next = move_it!{next}; $e })+ @@ -91,7 +91,7 @@ fn client_follow(+bank: bank::client::login) { let bank = client::deposit(bank, 100.00); let bank = client::withdrawal(bank, 50.00); - alt try_recv(bank) { + match try_recv(bank) { some(money(m, _)) { io::println(~"Yay! I got money!"); } @@ -109,7 +109,7 @@ fn bank_client(+bank: bank::client::login) { import bank::*; let bank = client::login(bank, ~"theincredibleholk", ~"1234"); - let bank = alt try_recv(bank) { + let bank = match try_recv(bank) { some(ok(connected)) => { move_it!{connected} } @@ -119,7 +119,7 @@ fn bank_client(+bank: bank::client::login) { let bank = client::deposit(bank, 100.00); let bank = client::withdrawal(bank, 50.00); - alt try_recv(bank) { + match try_recv(bank) { some(money(m, _)) => { io::println(~"Yay! I got money!"); } diff --git a/src/test/run-pass/pipe-detect-term.rs b/src/test/run-pass/pipe-detect-term.rs index b68be9cb23c..9c99f1dce02 100644 --- a/src/test/run-pass/pipe-detect-term.rs +++ b/src/test/run-pass/pipe-detect-term.rs @@ -19,7 +19,7 @@ fn main() { let iotask = uv::global_loop::get(); pipes::spawn_service(oneshot::init, |p| { - alt try_recv(p) { + match try_recv(p) { some(*) => { fail } none => { } } diff --git a/src/test/run-pass/pipe-select.rs b/src/test/run-pass/pipe-select.rs index 856bb3fe5cc..6c315123f53 100644 --- a/src/test/run-pass/pipe-select.rs +++ b/src/test/run-pass/pipe-select.rs @@ -78,7 +78,7 @@ fn test_select2() { stream::client::send(ac, 42); - alt pipes::select2(ap, bp) { + match pipes::select2(ap, bp) { either::left(*) => { } either::right(*) => { fail } } @@ -92,7 +92,7 @@ fn test_select2() { stream::client::send(bc, ~"abc"); - alt pipes::select2(ap, bp) { + match pipes::select2(ap, bp) { either::left(*) => { fail } either::right(*) => { } } diff --git a/src/test/run-pass/record-pat.rs b/src/test/run-pass/record-pat.rs index 9ccdf58c4f1..0507b84d7af 100644 --- a/src/test/run-pass/record-pat.rs +++ b/src/test/run-pass/record-pat.rs @@ -3,7 +3,7 @@ type t2 = {x: t1, y: int}; enum t3 { c(t2, uint), } fn m(in: t3) -> int { - alt in { + match in { c({x: a(m), _}, _) => { return m; } c({x: b(m), y: y}, z) => { return ((m + z) as int) + y; } } diff --git a/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs b/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs index dccdc6ce384..d380f624ee3 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs @@ -7,7 +7,7 @@ fn main() { // below. note that it would it you // naively borrowed &x for the lifetime // of the variable x, as we once did - alt i { + match i { i => { let y = &x; assert i < *y; diff --git a/src/test/run-pass/regions-self-in-enums.rs b/src/test/run-pass/regions-self-in-enums.rs index bd03a2ff6e7..9f1588e9b2b 100644 --- a/src/test/run-pass/regions-self-in-enums.rs +++ b/src/test/run-pass/regions-self-in-enums.rs @@ -6,7 +6,7 @@ fn main() { let x = 3; let y = int_wrapper_ctor(&x); let mut z : ∫ - alt y { + match y { int_wrapper_ctor(zz) => { z = zz; } } log(debug, *z); diff --git a/src/test/run-pass/shadow.rs b/src/test/run-pass/shadow.rs index 96b018e6a3b..c01cc550260 100644 --- a/src/test/run-pass/shadow.rs +++ b/src/test/run-pass/shadow.rs @@ -4,7 +4,7 @@ fn foo(c: ~[int]) { let mut b: ~[int] = ~[]; - alt none::<int> { + match none::<int> { some::<int>(_) => { for c.each |i| { log(debug, a); diff --git a/src/test/run-pass/simple-alt-generic-tag.rs b/src/test/run-pass/simple-alt-generic-tag.rs index ef5bd284a0d..0fa6e4568d4 100644 --- a/src/test/run-pass/simple-alt-generic-tag.rs +++ b/src/test/run-pass/simple-alt-generic-tag.rs @@ -4,5 +4,5 @@ enum opt<T> { none, } fn main() { let x = none::<int>; - alt x { none::<int> => { debug!{"hello world"}; } } + match x { none::<int> => { debug!{"hello world"}; } } } diff --git a/src/test/run-pass/simple-generic-alt.rs b/src/test/run-pass/simple-generic-alt.rs index 2bf60273c54..0503e9b69bd 100644 --- a/src/test/run-pass/simple-generic-alt.rs +++ b/src/test/run-pass/simple-generic-alt.rs @@ -2,4 +2,4 @@ enum clam<T> { a(T), } -fn main() { let c = a(2); alt c { a::<int>(_) => { } } } +fn main() { let c = a(2); match c { a::<int>(_) => { } } } diff --git a/src/test/run-pass/size-and-align.rs b/src/test/run-pass/size-and-align.rs index 5c325e25f48..5403d79f4f9 100644 --- a/src/test/run-pass/size-and-align.rs +++ b/src/test/run-pass/size-and-align.rs @@ -5,7 +5,7 @@ enum clam<T> { a(T, int), b, } fn uhoh<T>(v: ~[clam<T>]) { - alt v[1] { + match v[1] { a::<T>(t, u) => { debug!{"incorrect"}; log(debug, u); fail; } b::<T> => { debug!{"correct"}; } } diff --git a/src/test/run-pass/tag-align-dyn-variants.rs b/src/test/run-pass/tag-align-dyn-variants.rs index 9ceede21207..1c0a7ccbc01 100644 --- a/src/test/run-pass/tag-align-dyn-variants.rs +++ b/src/test/run-pass/tag-align-dyn-variants.rs @@ -22,7 +22,7 @@ fn is_aligned<A>(amnt: uint, &&u: A) -> bool { } fn variant_data_is_aligned<A,B>(amnt: uint, &&u: a_tag<A,B>) -> bool { - alt u { + match u { varA(a) { is_aligned(amnt, a) } varB(b) { is_aligned(amnt, b) } } diff --git a/src/test/run-pass/tag-variant-disr-val.rs b/src/test/run-pass/tag-variant-disr-val.rs index 2b43cb7061f..95a84a30055 100644 --- a/src/test/run-pass/tag-variant-disr-val.rs +++ b/src/test/run-pass/tag-variant-disr-val.rs @@ -29,7 +29,7 @@ fn test_color(color: color, val: int, name: ~str) unsafe { } fn get_color_alt(color: color) -> ~str { - alt color { + match color { red => {~"red"} green => {~"green"} blue => {~"blue"} diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index a56061a8ff5..dc097c515ca 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -13,7 +13,7 @@ trait to_str { impl <T: to_str> of to_str for option<T> { fn to_str() -> ~str { - alt self { + match self { none => { ~"none" } some(t) => { ~"some(" + t.to_str() + ~")" } } diff --git a/src/test/run-pass/typestate-cfg-nesting.rs b/src/test/run-pass/typestate-cfg-nesting.rs index a1825737a4e..53d0ab7db0e 100644 --- a/src/test/run-pass/typestate-cfg-nesting.rs +++ b/src/test/run-pass/typestate-cfg-nesting.rs @@ -2,7 +2,7 @@ fn f() { let x = 10; let mut y = 11; - if true { alt x { _ => { y = x; } } } else { } + if true { match x { _ => { y = x; } } } else { } } fn main() { diff --git a/src/test/run-pass/unique-alt-discrim.rs b/src/test/run-pass/unique-alt-discrim.rs index 2f155ef00e7..6dc3b616182 100644 --- a/src/test/run-pass/unique-alt-discrim.rs +++ b/src/test/run-pass/unique-alt-discrim.rs @@ -1,7 +1,7 @@ // Issue #961 fn altsimple() { - alt ~true { + match ~true { _ => { } } } diff --git a/src/test/run-pass/unique-in-tag.rs b/src/test/run-pass/unique-in-tag.rs index aaba73c72d0..8fe2671684f 100644 --- a/src/test/run-pass/unique-in-tag.rs +++ b/src/test/run-pass/unique-in-tag.rs @@ -2,7 +2,7 @@ fn test1() { enum bar { u(~int), w(int), } let x = u(~10); - assert alt x { + assert match x { u(a) => { log(error, a); *a diff --git a/src/test/run-pass/unique-pat-2.rs b/src/test/run-pass/unique-pat-2.rs index 241ff4b1d3a..c383b490578 100644 --- a/src/test/run-pass/unique-pat-2.rs +++ b/src/test/run-pass/unique-pat-2.rs @@ -3,7 +3,7 @@ type foo = {a: int, b: uint}; enum bar { u(~foo), w(int), } fn main() { - assert (alt u(~{a: 10, b: 40u}) { + assert (match u(~{a: 10, b: 40u}) { u(~{a: a, b: b}) => { a + (b as int) } _ => { 66 } } == 50); diff --git a/src/test/run-pass/unique-pat-3.rs b/src/test/run-pass/unique-pat-3.rs index edc5be4d159..29553fadc00 100644 --- a/src/test/run-pass/unique-pat-3.rs +++ b/src/test/run-pass/unique-pat-3.rs @@ -2,7 +2,7 @@ enum bar { u(~int), w(int), } fn main() { - assert alt u(~10) { + assert match u(~10) { u(a) => { log(error, a); *a diff --git a/src/test/run-pass/unique-pat.rs b/src/test/run-pass/unique-pat.rs index 81c1e6ccbd6..5f38a46ec86 100644 --- a/src/test/run-pass/unique-pat.rs +++ b/src/test/run-pass/unique-pat.rs @@ -1,5 +1,5 @@ fn simple() { - alt ~true { + match ~true { ~true => { } _ => { fail; } } diff --git a/src/test/run-pass/unreachable-code.rs b/src/test/run-pass/unreachable-code.rs index e48056d68c0..81c4586d76c 100644 --- a/src/test/run-pass/unreachable-code.rs +++ b/src/test/run-pass/unreachable-code.rs @@ -22,7 +22,7 @@ fn log_again() { loop { log(error, again); } } fn ret_ret() -> int { return (return 2) + 3; } fn ret_guard() { - alt 2 { + match 2 { x if (return) => { x; } _ => {} } diff --git a/src/test/run-pass/use-uninit-alt.rs b/src/test/run-pass/use-uninit-alt.rs index 21b1c1d66da..477416c7efd 100644 --- a/src/test/run-pass/use-uninit-alt.rs +++ b/src/test/run-pass/use-uninit-alt.rs @@ -2,7 +2,7 @@ fn foo<T>(o: myoption<T>) -> int { let mut x: int = 5; - alt o { none::<T> => { } some::<T>(t) => { x += 1; } } + match o { none::<T> => { } some::<T>(t) => { x += 1; } } return x; } diff --git a/src/test/run-pass/use-uninit-alt2.rs b/src/test/run-pass/use-uninit-alt2.rs index b06d2035644..63705a759cd 100644 --- a/src/test/run-pass/use-uninit-alt2.rs +++ b/src/test/run-pass/use-uninit-alt2.rs @@ -2,7 +2,7 @@ fn foo<T>(o: myoption<T>) -> int { let mut x: int; - alt o { none::<T> => { fail; } some::<T>(t) => { x = 5; } } + match o { none::<T> => { fail; } some::<T>(t) => { x = 5; } } return x; } diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 5e7fe0b0524..cbd16d00a8f 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -19,7 +19,7 @@ fn zombiejesus() { loop { while (return) { if (return) { - alt (return) { + match (return) { 1 => { if (return) { return @@ -59,7 +59,7 @@ fn canttouchthis() -> uint { fn angrydome() { loop { if break { } } let mut i = 0; - loop { i += 1; if i == 1 { alt check again { 1 => { } } } break; } + loop { i += 1; if i == 1 { match check again { 1 => { } } } break; } } fn evil_lincoln() { let evil <- debug!{"lincoln"}; } |
