diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-03 19:59:04 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-05 22:08:09 -0700 |
| commit | 025d86624de982cdab7e6b13600fec1499c02b56 (patch) | |
| tree | 96ba196f8a420c52e6034acd14f323d3d2239e29 /src/test | |
| parent | c9d27693796fe4ced8568e11aa465750f743097b (diff) | |
| download | rust-025d86624de982cdab7e6b13600fec1499c02b56.tar.gz rust-025d86624de982cdab7e6b13600fec1499c02b56.zip | |
Switch alts to use arrows
Diffstat (limited to 'src/test')
146 files changed, 468 insertions, 462 deletions
diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index b32047755ee..3c7057320ec 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -77,8 +77,8 @@ fn str_set() { let mut found = 0; for int::range(0, 1000) |_i| { alt s.find(r.gen_str(10)) { - some(_) { found += 1; } - none { } + some(_) => { found += 1; } + none => { } } } } diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs index 1dc6c4ab064..dfc74f12cef 100644 --- a/src/test/bench/graph500-bfs.rs +++ b/src/test/bench/graph500-bfs.rs @@ -158,8 +158,8 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { fn is_gray(c: color) -> bool { alt c { - gray(_) { true } - _ { false } + gray(_) => { true } + _ => { false } } } @@ -171,7 +171,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { colors = do colors.mapi() |i, c| { let c : color = c; alt c { - white { + white => { let i = i as node_id; let neighbors = graph[i]; @@ -188,8 +188,8 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { color } - gray(parent) { black(parent) } - black(parent) { black(parent) } + gray(parent) => { black(parent) } + black(parent) => { black(parent) } } } } @@ -197,9 +197,9 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { // Convert the results. do vec::map(colors) |c| { alt c { - white { -1i64 } - black(parent) { parent } - _ { fail ~"Found remaining gray nodes in BFS" } + white => { -1i64 } + black(parent) => { parent } + _ => { fail ~"Found remaining gray nodes in BFS" } } } } @@ -228,8 +228,8 @@ fn pbfs(&&graph: arc::arc<graph>, key: node_id) -> bfs_result { #[inline(always)] fn is_gray(c: color) -> bool { alt c { - gray(_) { true } - _ { false } + gray(_) => { true } + _ => { false } } } @@ -250,7 +250,7 @@ fn pbfs(&&graph: arc::arc<graph>, key: node_id) -> bfs_result { let colors = arc::get(&colors); let graph = arc::get(&graph); alt c { - white { + white => { let i = i as node_id; let neighbors = graph[i]; @@ -266,8 +266,8 @@ fn pbfs(&&graph: arc::arc<graph>, key: node_id) -> bfs_result { }; color } - gray(parent) { black(parent) } - black(parent) { black(parent) } + gray(parent) => { black(parent) } + black(parent) => { black(parent) } } } }; @@ -277,9 +277,9 @@ fn pbfs(&&graph: arc::arc<graph>, key: node_id) -> bfs_result { // Convert the results. do par::map(colors) |c| { alt c { - white { -1i64 } - black(parent) { parent } - _ { fail ~"Found remaining gray nodes in BFS" } + 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 82f4c1bef28..e0ebda079f7 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -32,13 +32,13 @@ fn server(requests: port<request>, responses: pipes::chan<uint>) { let mut done = false; while !done { alt requests.try_recv() { - some(get_count) { responses.send(copy count); } - some(bytes(b)) { + some(get_count) => { responses.send(copy count); } + some(bytes(b)) => { //error!{"server: received %? bytes", b}; count += b; } - none { done = true; } - _ { } + none => { done = true; } + _ => { } } } responses.send(count); diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index a9b45ef776f..067bd710b3d 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -27,13 +27,13 @@ fn server(requests: port_set<request>, responses: pipes::chan<uint>) { let mut done = false; while !done { alt requests.try_recv() { - some(get_count) { responses.send(copy count); } - some(bytes(b)) { + some(get_count) => { responses.send(copy count); } + some(bytes(b)) => { //error!{"server: received %? bytes", b}; count += b; } - none { done = true; } - _ { } + none => { done = true; } + _ => { } } } responses.send(count); diff --git a/src/test/bench/msgsend-ring-pipes.rs b/src/test/bench/msgsend-ring-pipes.rs index 493d98c6a59..c494bfc485a 100644 --- a/src/test/bench/msgsend-ring-pipes.rs +++ b/src/test/bench/msgsend-ring-pipes.rs @@ -44,7 +44,7 @@ fn thread_ring(i: uint, num_chan = some(ring::client::num(option::unwrap(num_chan2), i * j)); let port = option::unwrap(num_port2); alt recv(port) { - ring::num(_n, p) { + 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 606f33936c1..5b2488efa2f 100644 --- a/src/test/bench/msgsend.rs +++ b/src/test/bench/msgsend.rs @@ -19,9 +19,9 @@ fn server(requests: comm::port<request>, responses: comm::chan<uint>) { let mut done = false; while !done { alt comm::recv(requests) { - get_count { comm::send(responses, copy count); } - bytes(b) { count += b; } - stop { done = true; } + get_count => { comm::send(responses, copy count); } + bytes(b) => { count += b; } + stop => { done = true; } } } comm::send(responses, count); diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index 8ccb2e61d41..be3a868beb2 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -6,8 +6,8 @@ enum tree/& { nil, node(&tree, &tree, int), } fn item_check(t: &tree) -> int { alt *t { - nil { return 0; } - node(left, right, item) { + 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 8882b5ae7c7..7adc176bcff 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -23,9 +23,9 @@ type creature_info = { name: uint, color: color }; fn show_color(cc: color) -> ~str { alt (cc) { - Red {~"red"} - Yellow {~"yellow"} - Blue {~"blue"} + Red => {~"red"} + Yellow => {~"yellow"} + Blue => {~"blue"} } } @@ -40,17 +40,17 @@ fn show_color_list(set: ~[color]) -> ~str { fn show_digit(nn: uint) -> ~str { alt (nn) { - 0 {~"zero"} - 1 {~"one"} - 2 {~"two"} - 3 {~"three"} - 4 {~"four"} - 5 {~"five"} - 6 {~"six"} - 7 {~"seven"} - 8 {~"eight"} - 9 {~"nine"} - _ {fail ~"expected digits from 0 to 9..."} + 0 => {~"zero"} + 1 => {~"one"} + 2 => {~"two"} + 3 => {~"three"} + 4 => {~"four"} + 5 => {~"five"} + 6 => {~"six"} + 7 => {~"seven"} + 8 => {~"eight"} + 9 => {~"nine"} + _ => {fail ~"expected digits from 0 to 9..."} } } @@ -72,15 +72,15 @@ fn show_number(nn: uint) -> ~str { fn transform(aa: color, bb: color) -> color { alt (aa, bb) { - (Red, Red ) { Red } - (Red, Yellow) { Blue } - (Red, Blue ) { Yellow } - (Yellow, Red ) { Blue } - (Yellow, Yellow) { Yellow } - (Yellow, Blue ) { Red } - (Blue, Red ) { Yellow } - (Blue, Yellow) { Red } - (Blue, Blue ) { Blue } + (Red, Red ) => { Red } + (Red, Yellow) => { Blue } + (Red, Blue ) => { Yellow } + (Yellow, Red ) => { Blue } + (Yellow, Yellow) => { Yellow } + (Yellow, Blue ) => { Red } + (Blue, Red ) => { Yellow } + (Blue, Yellow) => { Red } + (Blue, Blue ) => { Blue } } } @@ -102,7 +102,7 @@ fn creature( // log and change, or print and quit alt resp { - option::some(other_creature) { + option::some(other_creature) => { color = transform(color, other_creature.color); // track some statistics @@ -111,7 +111,7 @@ fn creature( evil_clones_met += 1; } } - option::none { + option::none => { // log creatures met and evil clones of self let report = fmt!{"%u", creatures_met} + ~" " + show_number(evil_clones_met); diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index cebd36a1569..ca014b61455 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -60,8 +60,8 @@ 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))) { - option::none { return 0u; } - option::some(num) { return num; } + option::none => { return 0u; } + option::some(num) => { return num; } } } @@ -69,8 +69,8 @@ fn find(mm: hashmap<~[u8], uint>, key: ~str) -> uint { fn update_freq(mm: hashmap<~[u8], uint>, key: &[u8]) { let key = vec::slice(key, 0, key.len()); alt mm.find(key) { - option::none { mm.insert(key, 1u ); } - option::some(val) { mm.insert(key, 1u + val); } + option::none => { mm.insert(key, 1u ); } + option::some(val) => { mm.insert(key, 1u + val); } } } @@ -111,14 +111,14 @@ fn make_sequence_processor(sz: uint, from_parent: pipes::port<~[u8]>, } let buffer = alt sz { - 1u { sort_and_fmt(freqs, total) } - 2u { sort_and_fmt(freqs, total) } - 3u { fmt!{"%u\t%s", find(freqs, ~"GGT"), ~"GGT"} } - 4u { fmt!{"%u\t%s", find(freqs, ~"GGTA"), ~"GGTA"} } - 6u { fmt!{"%u\t%s", find(freqs, ~"GGTATT"), ~"GGTATT"} } - 12u { fmt!{"%u\t%s", find(freqs, ~"GGTATTTTAATT"), ~"GGTATTTTAATT"} } - 18u { fmt!{"%u\t%s", find(freqs, ~"GGTATTTTAATTTATAGT"), ~"GGTATTTTAATTTATAGT"} } - _ { ~"" } + 1u => { sort_and_fmt(freqs, total) } + 2u => { sort_and_fmt(freqs, total) } + 3u => { fmt!{"%u\t%s", find(freqs, ~"GGT"), ~"GGT"} } + 4u => { fmt!{"%u\t%s", find(freqs, ~"GGTA"), ~"GGTA"} } + 6u => { fmt!{"%u\t%s", find(freqs, ~"GGTATT"), ~"GGTATT"} } + 12u => { fmt!{"%u\t%s", find(freqs, ~"GGTATTTTAATT"), ~"GGTATTTTAATT"} } + 18u => { fmt!{"%u\t%s", find(freqs, ~"GGTATTTTAATTTATAGT"), ~"GGTATTTTAATTTATAGT"} } + _ => { ~"" } }; //comm::send(to_parent, fmt!{"yay{%u}", sz}); @@ -175,18 +175,18 @@ fn main(args: ~[~str]) { alt (line[0], proc_mode) { // start processing if this is the one - ('>' as u8, false) { + ('>' as u8, false) => { alt str::find_str_from(line, ~"THREE", 1u) { - option::some(_) { proc_mode = true; } - option::none { } + option::some(_) => { proc_mode = true; } + option::none => { } } } // break our processing - ('>' as u8, true) { break; } + ('>' as u8, true) => { break; } // process the sequence for k-mers - (_, true) { + (_, true) => { let line_bytes = str::bytes(line); for sizes.eachi |ii, _sz| { @@ -196,7 +196,7 @@ fn main(args: ~[~str]) { } // whatever - _ { } + _ => { } } } diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 6f026cd6258..5ffa7cc4f26 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -58,8 +58,8 @@ 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))) { - option::none { return 0u; } - option::some(num) { return num; } + option::none => { return 0u; } + option::some(num) => { return num; } } } @@ -67,8 +67,8 @@ fn find(mm: hashmap<~[u8], uint>, key: ~str) -> uint { fn update_freq(mm: hashmap<~[u8], uint>, key: &[u8]) { let key = vec::slice(key, 0, key.len()); alt mm.find(key) { - option::none { mm.insert(key, 1u ); } - option::some(val) { mm.insert(key, 1u + val); } + option::none => { mm.insert(key, 1u ); } + option::some(val) => { mm.insert(key, 1u + val); } } } @@ -109,14 +109,14 @@ fn make_sequence_processor(sz: uint, from_parent: comm::port<~[u8]>, } let buffer = alt sz { - 1u { sort_and_fmt(freqs, total) } - 2u { sort_and_fmt(freqs, total) } - 3u { fmt!{"%u\t%s", find(freqs, ~"GGT"), ~"GGT"} } - 4u { fmt!{"%u\t%s", find(freqs, ~"GGTA"), ~"GGTA"} } - 6u { fmt!{"%u\t%s", find(freqs, ~"GGTATT"), ~"GGTATT"} } - 12u { fmt!{"%u\t%s", find(freqs, ~"GGTATTTTAATT"), ~"GGTATTTTAATT"} } - 18u { fmt!{"%u\t%s", find(freqs, ~"GGTATTTTAATTTATAGT"), ~"GGTATTTTAATTTATAGT"} } - _ { ~"" } + 1u => { sort_and_fmt(freqs, total) } + 2u => { sort_and_fmt(freqs, total) } + 3u => { fmt!{"%u\t%s", find(freqs, ~"GGT"), ~"GGT"} } + 4u => { fmt!{"%u\t%s", find(freqs, ~"GGTA"), ~"GGTA"} } + 6u => { fmt!{"%u\t%s", find(freqs, ~"GGTATT"), ~"GGTATT"} } + 12u => { fmt!{"%u\t%s", find(freqs, ~"GGTATTTTAATT"), ~"GGTATTTTAATT"} } + 18u => { fmt!{"%u\t%s", find(freqs, ~"GGTATTTTAATTTATAGT"), ~"GGTATTTTAATTTATAGT"} } + _ => { ~"" } }; //comm::send(to_parent, fmt!{"yay{%u}", sz}); @@ -162,18 +162,18 @@ fn main(args: ~[~str]) { alt (line[0], proc_mode) { // start processing if this is the one - ('>' as u8, false) { + ('>' as u8, false) => { alt str::find_str_from(line, ~"THREE", 1u) { - option::some(_) { proc_mode = true; } - option::none { } + option::some(_) => proc_mode = true, + option::none => () } } // break our processing - ('>' as u8, true) { break; } + ('>' as u8, true) => { break; } // process the sequence for k-mers - (_, true) { + (_, true) => { let line_bytes = str::bytes(line); for sizes.eachi |ii, _sz| { @@ -183,7 +183,7 @@ fn main(args: ~[~str]) { } // whatever - _ { } + _ => { } } } diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index c752dc4050d..f00396f9b14 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -104,13 +104,13 @@ fn writer(path: ~str, writech: comm::chan<comm::chan<line>>, size: uint) let ch = comm::chan(p); comm::send(writech, ch); let cout: io::writer = alt path { - ~"" { + ~"" => { {dn: 0} as io::writer } - ~"-" { + ~"-" => { io::stdout() } - _ { + _ => { result::get( io::file_writer(path, ~[io::create, io::truncate])) diff --git a/src/test/bench/shootout-threadring.rs b/src/test/bench/shootout-threadring.rs index 36df950a2b7..e99d2946e81 100644 --- a/src/test/bench/shootout-threadring.rs +++ b/src/test/bench/shootout-threadring.rs @@ -22,11 +22,11 @@ fn start(+token: int) { fn roundtrip(id: int, p: comm::port<int>, ch: comm::chan<int>) { while (true) { alt comm::recv(p) { - 1 { + 1 => { io::println(fmt!{"%d\n", id}); return; } - token { + token => { debug!{"%d %d", id, token}; comm::send(ch, token - 1); if token <= n_threads { diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index e24b7bf5fa4..2a8750b64bd 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -54,7 +54,7 @@ fn recurse_or_fail(depth: int, st: option<st>) { let depth = depth - 1; let st = alt st { - none { + none => { st_({ box: @nil, unique: ~nil, @@ -65,7 +65,7 @@ fn recurse_or_fail(depth: int, st: option<st>) { res: r(@nil) }) } - some(st) { + some(st) => { let fn_box = st.fn_box; let fn_unique = st.fn_unique; diff --git a/src/test/bench/task-perf-one-million.rs b/src/test/bench/task-perf-one-million.rs index 8dd6f957ffa..85008b0daf9 100644 --- a/src/test/bench/task-perf-one-million.rs +++ b/src/test/bench/task-perf-one-million.rs @@ -20,7 +20,7 @@ fn calc(children: uint, parent_ch: comm::chan<msg>) { for iter::repeat (children) { alt check comm::recv(port) { - ready(child_ch) { + ready(child_ch) => { vec::push(child_chs, child_ch); } } @@ -29,7 +29,7 @@ fn calc(children: uint, parent_ch: comm::chan<msg>) { comm::send(parent_ch, ready(chan)); alt check comm::recv(port) { - start { + start => { do vec::iter (child_chs) |child_ch| { comm::send(child_ch, start); } @@ -38,7 +38,7 @@ fn calc(children: uint, parent_ch: comm::chan<msg>) { for iter::repeat (children) { alt check comm::recv(port) { - done(child_sum) { sum += child_sum; } + done(child_sum) => { sum += child_sum; } } } @@ -61,12 +61,12 @@ fn main(args: ~[~str]) { calc(children, chan); }; alt check comm::recv(port) { - ready(chan) { + ready(chan) => { comm::send(chan, start); } } let sum = alt check comm::recv(port) { - done(sum) { sum } + 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 c939da509bc..c31ccde2ca6 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -80,8 +80,8 @@ impl of word_reader for io::reader { fn file_word_reader(filename: ~str) -> word_reader { alt io::file_reader(filename) { - result::ok(f) { f as word_reader } - result::err(e) { fail fmt!{"%?", e} } + result::ok(f) => { f as word_reader } + result::err(e) => { fail fmt!{"%?", e} } } } @@ -89,8 +89,8 @@ fn map(f: fn~() -> word_reader, emit: map_reduce::putter<~str, int>) { let f = f(); loop { alt f.read_word() { - some(w) { emit(w, 1); } - none { break; } + 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 { alt get() { some(_) => { count += 1; } none => { break; } } } io::println(fmt!{"%s\t%?", word, count}); } @@ -182,12 +182,12 @@ mod map_reduce { do map(input) |key, val| { let mut c = none; alt intermediates.find(key) { - some(_c) { c = some(_c); } - none { + some(_c) => { c = some(_c); } + none => { do ctrl.swap |ctrl| { let ctrl = ctrl_proto::client::find_reducer(ctrl, key); alt pipes::recv(ctrl) { - ctrl_proto::reducer(c_, ctrl) { + ctrl_proto::reducer(c_, ctrl) => { c = some(c_); move_out!{ctrl} } @@ -225,16 +225,16 @@ mod map_reduce { -> option<V> { while !is_done || ref_count > 0 { alt recv(p) { - emit_val(v) { + emit_val(v) => { // error!{"received %d", v}; return some(v); } - done { + done => { // error!{"all done"}; is_done = true; } - addref { ref_count += 1; } - release { ref_count -= 1; } + addref => { ref_count += 1; } + release => { ref_count -= 1; } } } return none; @@ -260,21 +260,21 @@ mod map_reduce { while num_mappers > 0 { let (_ready, message, ctrls) = pipes::select(ctrl); alt option::unwrap(message) { - ctrl_proto::mapper_done { + ctrl_proto::mapper_done => { // error!{"received mapper terminated."}; num_mappers -= 1; ctrl = ctrls; } - ctrl_proto::find_reducer(k, cc) { + ctrl_proto::find_reducer(k, cc) => { let c; // log(error, "finding reducer for " + k); alt reducers.find(k) { - some(_c) { + some(_c) => { // log(error, // "reusing existing reducer for " + k); c = _c; } - none { + none => { // log(error, "creating new reducer for " + k); let p = port(); let ch = chan(p); diff --git a/src/test/compile-fail/alt-join.rs b/src/test/compile-fail/alt-join.rs index cd39d90b9bd..1557ff12090 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 { } } + alt 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 b8d4dab9539..6ba942decfc 100644 --- a/src/test/compile-fail/alt-pattern-field-mismatch-2.rs +++ b/src/test/compile-fail/alt-pattern-field-mismatch-2.rs @@ -7,9 +7,9 @@ fn main() { fn foo(c: color) { alt c { - rgb(_, _, _) { } - cmyk(_, _, _, _) { } - no_color(_) { } + rgb(_, _, _) => { } + cmyk(_, _, _, _) => { } + no_color(_) => { } //~^ ERROR this pattern has 1 field, but the corresponding variant has no fields } } diff --git a/src/test/compile-fail/alt-pattern-field-mismatch.rs b/src/test/compile-fail/alt-pattern-field-mismatch.rs index 2e24f6a5c89..71f44764e14 100644 --- a/src/test/compile-fail/alt-pattern-field-mismatch.rs +++ b/src/test/compile-fail/alt-pattern-field-mismatch.rs @@ -7,10 +7,10 @@ fn main() { fn foo(c: color) { alt c { - rgb(_, _) { } + rgb(_, _) => { } //~^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields - cmyk(_, _, _, _) { } - no_color { } + cmyk(_, _, _, _) => { } + no_color => { } } } } diff --git a/src/test/compile-fail/alt-range-fail-dominate.rs b/src/test/compile-fail/alt-range-fail-dominate.rs index b04e787d660..d1ba0f625b1 100644 --- a/src/test/compile-fail/alt-range-fail-dominate.rs +++ b/src/test/compile-fail/alt-range-fail-dominate.rs @@ -6,27 +6,27 @@ fn main() { alt check 5u { - 1u to 10u { } - 5u to 6u { } + 1u to 10u => { } + 5u to 6u => { } }; alt check 5u { - 3u to 6u { } - 4u to 6u { } + 3u to 6u => { } + 4u to 6u => { } }; alt check 5u { - 4u to 6u { } - 4u to 6u { } + 4u to 6u => { } + 4u to 6u => { } }; alt check 'c' { - 'A' to 'z' {} - 'a' to 'z' {} + 'A' to 'z' => {} + 'a' to 'z' => {} }; alt check 1.0 { - 0.01 to 6.5 {} - 0.02 {} + 0.01 to 6.5 => {} + 0.02 => {} }; } \ No newline at end of file diff --git a/src/test/compile-fail/alt-range-fail.rs b/src/test/compile-fail/alt-range-fail.rs index b9c1c6f0a1e..afda6d7015e 100644 --- a/src/test/compile-fail/alt-range-fail.rs +++ b/src/test/compile-fail/alt-range-fail.rs @@ -4,16 +4,16 @@ fn main() { alt 5u { - 6u to 1u { } - _ { } + 6u to 1u => { } + _ => { } }; alt "wow" { - "bar" to "foo" { } + "bar" to "foo" => { } }; alt 5u { - 'c' to 100u { } - _ { } + 'c' to 100u => { } + _ => { } }; } diff --git a/src/test/compile-fail/alt-tag-nullary.rs b/src/test/compile-fail/alt-tag-nullary.rs index 878b872978e..4f34c675cef 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; alt x { B => { } } } diff --git a/src/test/compile-fail/alt-tag-unary.rs b/src/test/compile-fail/alt-tag-unary.rs index b3aec729053..f0546574912 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); alt x { B(y) => { } } } diff --git a/src/test/compile-fail/bad-record-pat-2.rs b/src/test/compile-fail/bad-record-pat-2.rs index 5647fef472b..4c8d72444c1 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() { alt {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 1b12d274ce8..48155a0b529 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() { alt {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 e578816c0e3..0414bb5e867 100644 --- a/src/test/compile-fail/bogus-tag.rs +++ b/src/test/compile-fail/bogus-tag.rs @@ -7,8 +7,8 @@ enum color { rgb(int, int, int), rgba(int, int, int, int), } fn main() { let red: color = rgb(255, 0, 0); alt red { - rgb(r, g, b) { debug!{"rgb"}; } - hsl(h, s, l) { debug!{"hsl"}; } + rgb(r, g, b) => { debug!{"rgb"}; } + hsl(h, s, l) => { debug!{"hsl"}; } } } diff --git a/src/test/compile-fail/borrowck-issue-2657-1.rs b/src/test/compile-fail/borrowck-issue-2657-1.rs index 520ae1bf646..2d396bd591c 100644 --- a/src/test/compile-fail/borrowck-issue-2657-1.rs +++ b/src/test/compile-fail/borrowck-issue-2657-1.rs @@ -1,9 +1,9 @@ fn main() { let x = some(~1); alt x { //~ NOTE loan of immutable local variable granted here - some(y) { + 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 07e4ca8229b..85d062dd98c 100644 --- a/src/test/compile-fail/borrowck-issue-2657-2.rs +++ b/src/test/compile-fail/borrowck-issue-2657-2.rs @@ -1,9 +1,9 @@ fn main() { let x = some(~1); alt x { - some(y) { + 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 a4aeb976e95..acb018dbb2d 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 @@ -6,7 +6,7 @@ fn main() { let x = ~node({mut a: ~empty}); // Create a cycle! alt check *x { //~ NOTE loan of immutable local variable granted here - node(y) { + 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 86ff452c356..103de904609 100644 --- a/src/test/compile-fail/borrowck-pat-enum-in-box.rs +++ b/src/test/compile-fail/borrowck-pat-enum-in-box.rs @@ -1,14 +1,14 @@ fn match_imm_box(v: &const @option<int>) -> int { alt *v { - @some(i) {i} - @none {0} + @some(i) => {i} + @none => {0} } } fn match_const_box(v: &const @const option<int>) -> int { alt *v { - @some(i) { i } // ok because this is pure - @none {0} + @some(i) => { i } // ok because this is pure + @none => {0} } } @@ -16,10 +16,10 @@ pure fn pure_process(_i: int) {} fn match_const_box_and_do_pure_things(v: &const @const option<int>) { alt *v { - @some(i) { + @some(i) => { pure_process(i) } - @none {} + @none => {} } } @@ -27,10 +27,10 @@ fn process(_i: int) {} fn match_const_box_and_do_bad_things(v: &const @const option<int>) { alt *v { - @some(i) { //~ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location + @some(i) => { //~ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location process(i) //~ NOTE impure due to access to impure function } - @none {} + @none => {} } } diff --git a/src/test/compile-fail/borrowck-pat-enum.rs b/src/test/compile-fail/borrowck-pat-enum.rs index 091467283c5..6dd37e647ac 100644 --- a/src/test/compile-fail/borrowck-pat-enum.rs +++ b/src/test/compile-fail/borrowck-pat-enum.rs @@ -1,23 +1,23 @@ fn match_ref(&&v: option<int>) -> int { alt v { - some(i) { + some(i) => { i } - none {0} + none => {0} } } fn match_ref_unused(&&v: option<int>) { alt v { - some(_) {} - none {} + some(_) => {} + none => {} } } fn match_const_reg(v: &const option<int>) -> int { alt *v { - some(i) {i} // OK because this is pure - none {0} + some(i) => {i} // OK because this is pure + none => {0} } } @@ -26,23 +26,23 @@ fn impure(_i: int) { fn match_const_reg_unused(v: &const option<int>) { alt *v { - some(_) {impure(0)} // OK because nothing is captured - none {} + some(_) => {impure(0)} // OK because nothing is captured + none => {} } } fn match_const_reg_impure(v: &const option<int>) { alt *v { - some(i) {impure(i)} //~ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location + some(i) => {impure(i)} //~ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location //~^ NOTE impure due to access to impure function - none {} + none => {} } } fn match_imm_reg(v: &option<int>) { alt *v { - some(i) {impure(i)} // OK because immutable - none {} + 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 7ce3ff8f028..2d7f33e6620 100644 --- a/src/test/compile-fail/borrowck-pat-reassign-binding.rs +++ b/src/test/compile-fail/borrowck-pat-reassign-binding.rs @@ -3,8 +3,8 @@ fn main() { let mut x: option<int> = none; alt x { //~ NOTE loan of mutable local variable granted here - none {} - some(i) { + none => {} + some(i) => { // Not ok: i is an outstanding ptr into x. x = some(i+1); //~ ERROR assigning to mutable local variable prohibited due to outstanding loan } 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 1e1de3e39cf..12c2d0ef6e8 100644 --- a/src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs +++ b/src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs @@ -3,12 +3,12 @@ fn main() { let mut x = none; alt x { //~ NOTE loan of mutable local variable granted here - none { + none => { // It is ok to reassign x here, because there is in // fact no outstanding loan of x! x = some(0); } - some(i) { + some(i) => { x = some(1); //~ ERROR assigning to mutable local variable prohibited due to outstanding loan } } diff --git a/src/test/compile-fail/borrowck-unchecked-with-borrow.rs b/src/test/compile-fail/borrowck-unchecked-with-borrow.rs index c0a2466199f..34031aa70d6 100644 --- a/src/test/compile-fail/borrowck-unchecked-with-borrow.rs +++ b/src/test/compile-fail/borrowck-unchecked-with-borrow.rs @@ -3,25 +3,25 @@ fn impure(_i: int) {} // check that unchecked alone does not override borrowck: fn foo(v: &const option<int>) { alt *v { - some(i) { + some(i) => { //~^ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location unchecked { impure(i); //~ NOTE impure due to access to impure function } } - none { + none => { } } } fn bar(v: &const option<int>) { alt *v { - some(i) { + some(i) => { unsafe { impure(i); } } - none { + none => { } } } diff --git a/src/test/compile-fail/deref-non-pointer.rs b/src/test/compile-fail/deref-non-pointer.rs index 3e4b7b73b60..5468a46a6a7 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 { - _ { fail; } + _ => { 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 d6ab1e44211..4ac885e5b10 100644 --- a/src/test/compile-fail/issue-1193.rs +++ b/src/test/compile-fail/issue-1193.rs @@ -7,8 +7,8 @@ mod foo { fn bar(v: t) -> bool { alt v { - a { return true; } - b { return false; } + 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 957d84eaa84..f5639a887f0 100644 --- a/src/test/compile-fail/issue-2111.rs +++ b/src/test/compile-fail/issue-2111.rs @@ -1,8 +1,8 @@ fn foo(a: option<uint>, b: option<uint>) { alt (a,b) { //~ ERROR: non-exhaustive patterns: none not covered - (some(a), some(b)) if a == b { } + (some(a), some(b)) if a == b => { } (some(_), none) | - (none, some(_)) { } + (none, some(_)) => { } } } diff --git a/src/test/compile-fail/issue-2848.rs b/src/test/compile-fail/issue-2848.rs index 606c5fc8e00..376426bb82e 100644 --- a/src/test/compile-fail/issue-2848.rs +++ b/src/test/compile-fail/issue-2848.rs @@ -9,7 +9,7 @@ mod bar { fn main() { import bar::{alpha, charlie}; alt alpha { - alpha | beta {} //~ ERROR: inconsistent number of bindings - charlie {} + 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 5fed9f2d26c..6085fc9fe8f 100644 --- a/src/test/compile-fail/issue-2849.rs +++ b/src/test/compile-fail/issue-2849.rs @@ -2,6 +2,6 @@ enum foo { alpha, beta(int) } fn main() { alt alpha { - alpha | beta(i) {} //~ ERROR inconsistent number of bindings + 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 0728dca2e8b..f5aa30c1416 100644 --- a/src/test/compile-fail/issue-3038.rs +++ b/src/test/compile-fail/issue-3038.rs @@ -9,17 +9,17 @@ fn main() { let _z = alt g(1, 2) { - g(x, x) { log(debug, x + x); } + 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)) { i(l(x, _), m(_, x)) //~ ERROR Identifier x is bound more than once in the same pattern - { log(error, x + x); } + => { log(error, x + x); } }; let _z = alt (1, 2) { - (x, x) { x } //~ ERROR Identifier x is bound more than once in the same pattern + (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 8cb365afbf6..e1803b0248a 100644 --- a/src/test/compile-fail/liveness-missing-ret2.rs +++ b/src/test/compile-fail/liveness-missing-ret2.rs @@ -3,7 +3,7 @@ fn f() -> int { // Make sure typestate doesn't interpreturn this alt expression // as the function result - alt check true { true { } }; + alt check true { true => { } }; } fn main() { } diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs index 28c531b3b81..4f9e62e0502 100644 --- a/src/test/compile-fail/liveness-unused.rs +++ b/src/test/compile-fail/liveness-unused.rs @@ -28,9 +28,9 @@ fn f3b() { fn f4() { alt some(3) { - some(i) { + some(i) => { } - none {} + none => {} } } diff --git a/src/test/compile-fail/non-exhaustive-match-nested.rs b/src/test/compile-fail/non-exhaustive-match-nested.rs index 37490724a23..dea250a734c 100644 --- a/src/test/compile-fail/non-exhaustive-match-nested.rs +++ b/src/test/compile-fail/non-exhaustive-match-nested.rs @@ -6,8 +6,8 @@ enum u { c, d } fn main() { let x = a(c); alt x { - a(d) { fail ~"hello"; } - b { fail ~"goodbye"; } + 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 0d004df5c1a..e712406ba19 100644 --- a/src/test/compile-fail/non-exhaustive-match.rs +++ b/src/test/compile-fail/non-exhaustive-match.rs @@ -2,27 +2,27 @@ enum t { a, b, } fn main() { let x = a; - alt x { b { } } //~ ERROR non-exhaustive patterns + alt x { b => { } } //~ ERROR non-exhaustive patterns alt true { //~ ERROR non-exhaustive patterns - true {} + true => {} } alt @some(10) { //~ ERROR non-exhaustive patterns - @none {} + @none => {} } alt (2, 3, 4) { //~ ERROR non-exhaustive patterns - (_, _, 4) {} + (_, _, 4) => {} } alt (a, a) { //~ ERROR non-exhaustive patterns - (a, b) {} - (b, a) {} + (a, b) => {} + (b, a) => {} } alt a { //~ ERROR b not covered - a {} + a => {} } // This is exhaustive, though the algorithm got it wrong at one point alt (a, b) { - (a, _) {} - (_, a) {} - (b, 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 870b86d42c3..207bbd91cc5 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); alt c { a::<int>(_) => { } } } diff --git a/src/test/compile-fail/or-patter-mismatch.rs b/src/test/compile-fail/or-patter-mismatch.rs index 997121f20ca..37d194cbd50 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() { alt 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 3e9648e19c9..1dee20e0ef6 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 { alt 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 8be922cd93a..2622dadc040 100644 --- a/src/test/compile-fail/pattern-tyvar.rs +++ b/src/test/compile-fail/pattern-tyvar.rs @@ -9,10 +9,10 @@ enum bar { t1((), option<~[int]>), t2, } fn foo(t: bar) { alt t { - t1(_, some::<int>(x)) { + t1(_, some::<int>(x)) => { log(debug, x); } - _ { fail; } + _ => { fail; } } } diff --git a/src/test/compile-fail/regions-creating-enums.rs b/src/test/compile-fail/regions-creating-enums.rs index 02780c70ed8..0702618c68c 100644 --- a/src/test/compile-fail/regions-creating-enums.rs +++ b/src/test/compile-fail/regions-creating-enums.rs @@ -12,17 +12,17 @@ fn build() { fn compute(x: &ast) -> uint { alt *x { - num(x) { x } - add(x, y) { compute(x) + compute(y) } + num(x) => { x } + add(x, y) => { compute(x) + compute(y) } } } fn map_nums(x: &ast, f: fn(uint) -> uint) -> &ast { alt *x { - num(x) { + num(x) => { return &num(f(x)); //~ ERROR illegal borrow } - add(x, y) { + add(x, y) => { let m_x = map_nums(x, f); let m_y = map_nums(y, f); return &add(m_x, m_y); //~ ERROR illegal borrow diff --git a/src/test/compile-fail/unreachable-arm.rs b/src/test/compile-fail/unreachable-arm.rs index 89d31a41dcc..1865fe6aff9 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() { alt b(1u) { b(_) | a(@_, 1) => { } a(_, 1) => { } } } diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index 0f504bb8e89..14a8629ab72 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 { } } + alt check true { true => { } } (*regs).eax = 1; } @@ -20,14 +20,14 @@ fn test6() -> bool { { } (true || false) && true } fn test7() -> uint { let regs = @0; - alt check true { true { } } + alt check true { true => { } } (*regs < 2) as uint } fn test8() -> int { let val = @0; alt check true { - true { } + true => { } } if *val < 1 { 0 @@ -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; alt check true { true => { } } *regs += 1; } fn test10() -> int { let regs = @mut ~[0]; - alt check true { true { } } + alt check true { true => { } } (*regs)[0] } diff --git a/src/test/pretty/unary-op-disambig.rs b/src/test/pretty/unary-op-disambig.rs index e9fd2c2dc2c..1f9d68cc8a2 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 { alt check true { true => { f() } }; -1 } -fn alt_no_semi() -> int { (alt check true { true { 0 } }) - 1 } +fn alt_no_semi() -> int { (alt 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 88c6688b766..08320af9775 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 } }; + alt 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 09770179ebf..ab444a8273e 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 { alt 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 4a428f3cdb1..3a3c4c5a0a8 100644 --- a/src/test/run-fail/alt-wildcards.rs +++ b/src/test/run-fail/alt-wildcards.rs @@ -1,8 +1,8 @@ // error-pattern:squirrelcupcake fn cmp() -> int { alt check (option::some('a'), option::none::<char>) { - (option::some(_), _) { fail ~"squirrelcupcake"; } - (_, option::some(_)) { fail; } + (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 5a1d410bec1..f6d3779b9f0 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 = alt 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 230497135cd..3a70b690755 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 = alt true { false => { 0 } true => { fail } }; } diff --git a/src/test/run-fail/issue-2156.rs b/src/test/run-fail/issue-2156.rs index 1e8fea9d111..026af3a2f65 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 } } + alt rdr.read_char() { '=' => { } _ => { fail } } } } diff --git a/src/test/run-fail/unwind-alt.rs b/src/test/run-fail/unwind-alt.rs index 751dc722fc8..d5f013a42b6 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 = alt check false { true => { ~"happy" } }; assert res == ~"happy"; } fn main() { diff --git a/src/test/run-pass/alt-bot-2.rs b/src/test/run-pass/alt-bot-2.rs index 341fcdc38d5..cbf1519dc34 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 { alt 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 bf5f963e9cc..7162bf69aa5 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 } }; + alt 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 bef4af11be4..796a73a0204 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 { - ~{a, b} { assert *a == 10; (*x).a = ~30; assert *a == 30; } + ~{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 63cbdf6ca79..355e678d3a3 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 { - @{a, b} { assert *a == 10; (*x).a = @30; assert *a == 30; } + @{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 2ba2fedb386..2d4078ced04 100644 --- a/src/test/run-pass/alt-join.rs +++ b/src/test/run-pass/alt-join.rs @@ -9,7 +9,13 @@ fn foo<T>(y: option<T>) { entire if expression */ if true { - } else { alt y { none::<T> { x = 17; } _ { x = 42; } } rs += ~[x]; } + } else { + alt y { + none::<T> => x = 17, + _ => x = 42 + } + rs += ~[x]; + } return; } diff --git a/src/test/run-pass/alt-path.rs b/src/test/run-pass/alt-path.rs index aa3ccfcbafd..aa9e9f18481 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) { alt 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 b8ce7299271..92366e54b30 100644 --- a/src/test/run-pass/alt-pattern-drop.rs +++ b/src/test/run-pass/alt-pattern-drop.rs @@ -10,11 +10,11 @@ fn foo(s: @int) { let x: t = make_t(s); // ref up alt x { - make_t(y) { + make_t(y) => { log(debug, y); // ref up then down } - _ { debug!{"?"}; fail; } + _ => { debug!{"?"}; fail; } } log(debug, sys::refcount(s)); assert (sys::refcount(s) == count + 1u); diff --git a/src/test/run-pass/alt-pattern-lit.rs b/src/test/run-pass/alt-pattern-lit.rs index aba7336a23b..bc1f788abc0 100644 --- a/src/test/run-pass/alt-pattern-lit.rs +++ b/src/test/run-pass/alt-pattern-lit.rs @@ -2,8 +2,8 @@ fn altlit(f: int) -> int { alt check f { - 10 { debug!{"case 10"}; return 20; } - 11 { debug!{"case 11"}; return 22; } + 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 91340f94333..badad32ce28 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"}; } } + alt 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 e29cd72ac77..e4ca776bb61 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) { alt f { x => () } } fn main() { } diff --git a/src/test/run-pass/alt-phi.rs b/src/test/run-pass/alt-phi.rs index 5a99563e2af..358b8d64e6c 100644 --- a/src/test/run-pass/alt-phi.rs +++ b/src/test/run-pass/alt-phi.rs @@ -7,8 +7,8 @@ fn foo(it: fn(int)) { it(10); } fn main() { let mut x = true; alt a { - a { x = true; foo(|_i| { } ) } - b { x = false; } - c { x = false; } + 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 29bbc452d47..75ca1dd5e52 100644 --- a/src/test/run-pass/alt-range.rs +++ b/src/test/run-pass/alt-range.rs @@ -1,30 +1,30 @@ fn main() { alt 5u { - 1u to 5u {} - _ { fail ~"should match range"; } + 1u to 5u => {} + _ => fail ~"should match range", } alt 5u { - 6u to 7u { fail ~"shouldn't match range"; } - _ {} + 6u to 7u => fail ~"shouldn't match range", + _ => {} } alt check 5u { - 1u { fail ~"should match non-first range"; } - 2u to 6u {} + 1u => fail ~"should match non-first range", + 2u to 6u => {} } alt 'c' { - 'a' to 'z' {} - _ { fail ~"should suppport char ranges"; } + 'a' to 'z' => {} + _ => fail ~"should suppport char ranges" } alt -3 { - -7 to 5 {} - _ { fail ~"should match signed range"; } + -7 to 5 => {} + _ => fail ~"should match signed range" } alt 3.0 { - 1.0 to 5.0 {} - _ { fail ~"should match float range"; } + 1.0 to 5.0 => {} + _ => fail ~"should match float range" } alt -1.5 { - -3.6 to 3.6 {} - _ { fail ~"should match negative float range"; } + -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 708932b2e1a..4693635458d 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; } } + alt check ~"test" { ~"not-test" => fail, ~"test" => (), _ => fail } enum t { tag1(~str), tag2, } alt tag1(~"test") { - tag2 { fail; } - tag1(~"not-test") { fail; } - tag1(~"test") { } - _ { fail; } + tag2 => fail, + tag1(~"not-test") => fail, + tag1(~"test") => (), + _ => fail } - let x = alt check ~"a" { ~"a" { 1 } ~"b" { 2 } }; + let x = alt check ~"a" { ~"a" => 1, ~"b" => 2 }; assert (x == 1); - alt check ~"a" { ~"a" { } ~"b" { } } + alt check ~"a" { ~"a" => { } ~"b" => { } } } diff --git a/src/test/run-pass/alt-tag.rs b/src/test/run-pass/alt-tag.rs index f58eb29edb2..4b8cdce110e 100644 --- a/src/test/run-pass/alt-tag.rs +++ b/src/test/run-pass/alt-tag.rs @@ -11,9 +11,9 @@ enum color { fn process(c: color) -> int { let mut x: int; alt 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; } + 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; } } return x; } diff --git a/src/test/run-pass/alt-unique-bind.rs b/src/test/run-pass/alt-unique-bind.rs index 0f47c910529..b907afa1e8d 100644 --- a/src/test/run-pass/alt-unique-bind.rs +++ b/src/test/run-pass/alt-unique-bind.rs @@ -1,6 +1,6 @@ fn main() { alt ~100 { - ~x { + ~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 74a7e36a6e6..50c03e71be2 100644 --- a/src/test/run-pass/alt-with-ret-arm.rs +++ b/src/test/run-pass/alt-with-ret-arm.rs @@ -3,8 +3,8 @@ fn main() { // the right type for f, as we unified // bot and u32 here let f = alt uint::from_str(~"1234") { - none { return () } - some(num) { num as u32 } + none => return (), + some(num) => num as u32 }; assert f == 1234u32; log(error, f) diff --git a/src/test/run-pass/binary-minus-without-space.rs b/src/test/run-pass/binary-minus-without-space.rs index 79627d5501d..d2df3b2dab3 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 {} } + alt 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 cebafd03f00..685f68c61ad 100644 --- a/src/test/run-pass/block-arg.rs +++ b/src/test/run-pass/block-arg.rs @@ -25,13 +25,13 @@ fn main() { assert false; } alt do vec::all(v) |e| { float::is_negative(e) } { - true { fail ~"incorrect answer."; } - false { } + true => { fail ~"incorrect answer."; } + false => { } } alt 3 { - _ if do vec::any(v) |e| { float::is_negative(e) } { + _ if do vec::any(v) |e| { float::is_negative(e) } => { } - _ { + _ => { fail ~"wrong answer."; } } 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 73a7085d865..bbc2abf51af 100644 --- a/src/test/run-pass/borrowck-pat-reassign-no-binding.rs +++ b/src/test/run-pass/borrowck-pat-reassign-no-binding.rs @@ -1,11 +1,11 @@ fn main() { let mut x = none; alt x { - none { + none => { // It is ok to reassign x here, because there is in // fact no outstanding loan of x! x = some(0); } - some(_) { } + some(_) => { } } } 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 9b49e3cd044..87b4fd59e5f 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 @@ -3,12 +3,12 @@ fn main() { let x: @mut @option<~int> = @mut @none; alt x { - @@some(y) { + @@some(y) => { // here, the refcount of `*x` is bumped so // `y` remains valid even if `*x` is modified. *x = @none; } - @@none { + @@none => { // here, no bump of the ref count of `*x` is needed, but in // fact a bump occurs anyway because of how pattern marching // works. 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 0bbd2b2d90a..99b446ce315 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-discr.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-discr.rs @@ -3,7 +3,7 @@ fn main() { let mut x = @{f: ~3}; alt *x { - {f: b_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 cf738e02d2f..7a37432db74 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-pat.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-pat.rs @@ -3,7 +3,7 @@ fn main() { let mut x = @mut @{f: ~3}; alt x { - @@{f: b_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 285b3ad8e0f..f8bf02a7703 100644 --- a/src/test/run-pass/borrowck-preserve-box-sometimes-needed.rs +++ b/src/test/run-pass/borrowck-preserve-box-sometimes-needed.rs @@ -3,8 +3,8 @@ fn switcher(x: option<@int>) { let mut x = x; alt x { - some(@y) { copy y; x = none; } - none { } + 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 3b01c4aa076..fde259046a7 100644 --- a/src/test/run-pass/borrowck-univariant-enum.rs +++ b/src/test/run-pass/borrowck-univariant-enum.rs @@ -10,7 +10,7 @@ fn main() { let x = @mut 5; let y = @mut newtype(3); let z = alt *y { - newtype(b) { + 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 3eb95b70029..faf3ff73b01 100644 --- a/src/test/run-pass/box-pattern.rs +++ b/src/test/run-pass/box-pattern.rs @@ -3,7 +3,7 @@ enum bar { u(@foo), w(int), } fn main() { assert (alt u(@{a: 10, b: 40u}) { - u(@{a: a, b: b}) { a + (b as int) } - _ { 66 } + 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 326a7a7ae2d..175c5f9936a 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -49,8 +49,8 @@ class cat<T: copy> : map<int, T> { fn contains_key_ref(k: &int) -> bool { self.contains_key(*k) } fn get(+k:int) -> T { alt self.find(k) { - some(v) { v } - none { fail ~"epic fail"; } + some(v) => { v } + none => { fail ~"epic fail"; } } } fn [](&&k:int) -> T { self.get(k) } @@ -62,10 +62,10 @@ class cat<T: copy> : map<int, T> { fn remove(+k:int) -> option<T> { alt self.find(k) { - some(x) { + some(x) => { self.meows -= k; some(x) } - none { none } + none => { none } } } 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 3632e8833d1..3b9d41fc82a 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); alt tt { foo(z) => { } } } diff --git a/src/test/run-pass/expr-alt-box.rs b/src/test/run-pass/expr-alt-box.rs index 9953838b274..8930f113431 100644 --- a/src/test/run-pass/expr-alt-box.rs +++ b/src/test/run-pass/expr-alt-box.rs @@ -5,12 +5,12 @@ // Tests for alt as expressions resulting in boxed types fn test_box() { - let res = alt check true { true { @100 } }; + let res = alt check true { true => { @100 } }; assert (*res == 100); } fn test_str() { - let res = alt check true { true { ~"happy" } }; + let res = alt 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 3ff8af3cb97..a38464f6d0a 100644 --- a/src/test/run-pass/expr-alt-fail-all.rs +++ b/src/test/run-pass/expr-alt-fail-all.rs @@ -6,7 +6,7 @@ fn main() { let x = alt true { - true { 10 } - false { alt true { true { fail } false { fail } } } + true => { 10 } + false => { alt 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 52ffd09fba3..5635a660f42 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 = alt true { true => { true } false => { fail } }; assert (r == true); } fn test_box() { - let r = alt true { true { ~[10] } false { fail } }; + let r = alt 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 3254996d141..f3f9dee2ff4 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 = alt 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 d5fad94a464..e03c196c289 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 = alt 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 35a631062a8..5168fd5ca80 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 = alt 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 95b79e9b3b9..e1475373dc2 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 = alt 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 b4078a7d907..98536b1afe1 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 = alt 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 52ec91884f6..2bfef283f9d 100644 --- a/src/test/run-pass/expr-alt-struct.rs +++ b/src/test/run-pass/expr-alt-struct.rs @@ -5,13 +5,13 @@ // Tests for alt as expressions resulting in structural types fn test_rec() { - let rs = alt check true { true { {i: 100} } }; + let rs = alt 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 = alt 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 e3a55892955..58a88bee1d3 100644 --- a/src/test/run-pass/expr-alt-unique.rs +++ b/src/test/run-pass/expr-alt-unique.rs @@ -5,7 +5,7 @@ // Tests for alt as expressions resulting in boxed types fn test_box() { - let res = alt check true { true { ~100 } }; + let res = alt 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 7badeedf824..2e855ce36fa 100644 --- a/src/test/run-pass/expr-alt.rs +++ b/src/test/run-pass/expr-alt.rs @@ -5,14 +5,14 @@ // Tests for using alt as an expression fn test_basic() { - let mut rs: bool = alt true { true { true } false { false } }; + let mut rs: bool = alt true { true => { true } false => { false } }; assert (rs); - rs = alt false { true { false } false { true } }; + rs = alt false { true => { false } false => { true } }; assert (rs); } fn test_inferrence() { - let mut rs = alt true { true { true } false { false } }; + let mut rs = alt true { true => { true } false => { false } }; assert (rs); } @@ -20,9 +20,9 @@ fn test_alt_as_alt_head() { // Yeah, this is kind of confusing ... let rs = - alt alt false { true { true } false { false } } { - true { false } - false { true } + alt alt false { true => { true } false => { false } } { + true => { false } + false => { true } }; assert (rs); } @@ -30,8 +30,8 @@ fn test_alt_as_alt_head() { fn test_alt_as_block_result() { let rs = alt false { - true { false } - false { alt true { true { true } false { false } } } + true => { false } + false => { alt 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 0a50faf4401..1148d145ba0 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 = alt 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 3b32df0ec79..8d38e5d2941 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 { alt true { false => { 10 } true => { 20 } } } assert (f() == 20); } diff --git a/src/test/run-pass/generic-tag-alt.rs b/src/test/run-pass/generic-tag-alt.rs index 5857d1ae421..68013a41072 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; } } + alt 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 d8c039fa413..237c8c7f844 100644 --- a/src/test/run-pass/generic-tag-values.rs +++ b/src/test/run-pass/generic-tag-values.rs @@ -6,10 +6,10 @@ 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); } } + alt nop { some::<int>(n) => { log(debug, n); assert (n == 5); } } let nop2: noption<{x: int, y: int}> = some({x: 17, y: 42}); alt nop2 { - some(t) { + some(t) => { log(debug, t.x); log(debug, t.y); assert (t.x == 17); diff --git a/src/test/run-pass/guards.rs b/src/test/run-pass/guards.rs index 2dc646ee823..a34fa14860d 100644 --- a/src/test/run-pass/guards.rs +++ b/src/test/run-pass/guards.rs @@ -1,13 +1,13 @@ fn main() { let a = - alt 10 { x if x < 7 { 1 } x if x < 11 { 2 } 10 { 3 } _ { 4 } }; + alt 10 { x if x < 7 => { 1 } x if x < 11 => { 2 } 10 => { 3 } _ => { 4 } }; assert (a == 2); let b = alt {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 } + x if x.x < 5 && x.y < 5 => { 1 } + {x: x, y: y} if x == 10 && y == 20 => { 2 } + {x: x, y: y} => { 3 } }; assert (b == 2); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 80c942c69d1..e4fc8c1650f 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -46,8 +46,8 @@ mod map_reduce { val: ~str) { let mut c; alt im.find(key) { - some(_c) { c = _c } - none { + some(_c) => { c = _c } + none => { let p = port(); error!{"sending find_reducer"}; send(ctrl, find_reducer(str::bytes(key), chan(p))); @@ -79,12 +79,12 @@ mod map_reduce { while num_mappers > 0 { alt recv(ctrl) { - mapper_done { num_mappers -= 1; } - find_reducer(k, cc) { + mapper_done => { num_mappers -= 1; } + find_reducer(k, cc) => { let mut c; alt reducers.find(str::from_bytes(k)) { - some(_c) { c = _c; } - none { c = 0; } + some(_c) => { c = _c; } + none => { c = 0; } } send(cc, c); } 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 eadb3503bda..ae9c27d7880 100644 --- a/src/test/run-pass/inferred-suffix-in-pattern-range.rs +++ b/src/test/run-pass/inferred-suffix-in-pattern-range.rs @@ -1,22 +1,22 @@ fn main() { let x = 2; let x_message = alt x { - 0 to 1 { ~"not many" } - _ { ~"lots" } + 0 to 1 => { ~"not many" } + _ => { ~"lots" } }; assert x_message == ~"lots"; let y = 2i; let y_message = alt y { - 0 to 1 { ~"not many" } - _ { ~"lots" } + 0 to 1 => { ~"not many" } + _ => { ~"lots" } }; assert y_message == ~"lots"; let z = 1u64; let z_message = alt z { - 0 to 1 { ~"not many" } - _ { ~"lots" } + 0 to 1 => { ~"not many" } + _ => { ~"lots" } }; assert z_message == ~"not many"; } diff --git a/src/test/run-pass/issue-1701.rs b/src/test/run-pass/issue-1701.rs index f550c98d337..4c1f703733d 100644 --- a/src/test/run-pass/issue-1701.rs +++ b/src/test/run-pass/issue-1701.rs @@ -6,10 +6,10 @@ enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } fn noise(a: animal) -> option<~str> { alt a { - cat(*) { some(~"meow") } - dog(*) { some(~"woof") } - rabbit(*) { none } - tiger(*) { some(~"roar") } + cat(*) => { some(~"meow") } + dog(*) => { some(~"woof") } + rabbit(*) => { none } + tiger(*) => { some(~"roar") } } } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 5ffcab99a7b..8fb85a7d11e 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -59,19 +59,19 @@ mod pipes { (*p).payload <- some(payload); let old_state = swap_state_rel((*p).state, full); alt old_state { - empty { + empty => { // Yay, fastpath. // The receiver will eventually clean this up. unsafe { forget(p); } } - full { fail ~"duplicate send" } - blocked { + full => { fail ~"duplicate send" } + blocked => { // The receiver will eventually clean this up. unsafe { forget(p); } } - terminated { + terminated => { // The receiver will never receive this. Rely on drop_glue // to clean everything up. } @@ -85,13 +85,13 @@ mod pipes { let old_state = swap_state_acq((*p).state, blocked); alt old_state { - empty | blocked { task::yield(); } - full { + empty | blocked => { task::yield(); } + full => { let mut payload = none; payload <-> (*p).payload; return some(option::unwrap(payload)) } - terminated { + terminated => { assert old_state == terminated; return none; } @@ -102,15 +102,15 @@ mod pipes { fn sender_terminate<T: send>(p: *packet<T>) { let p = unsafe { uniquify(p) }; alt swap_state_rel((*p).state, terminated) { - empty | blocked { + empty | blocked => { // The receiver will eventually clean up. unsafe { forget(p) } } - full { + full => { // This is impossible fail ~"you dun goofed" } - terminated { + terminated => { // I have to clean up, use drop_glue } } @@ -119,15 +119,15 @@ mod pipes { fn receiver_terminate<T: send>(p: *packet<T>) { let p = unsafe { uniquify(p) }; alt swap_state_rel((*p).state, terminated) { - empty { + empty => { // the sender will clean up unsafe { forget(p) } } - blocked { + blocked => { // this shouldn't happen. fail ~"terminating a blocked packet" } - terminated | full { + terminated | full => { // I have to clean up, use drop_glue } } @@ -179,7 +179,7 @@ mod pingpong { fn liberate_ping(-p: ping) -> pipes::send_packet<pong> unsafe { let addr : *pipes::send_packet<pong> = alt p { - ping(x) { unsafe::reinterpret_cast(ptr::addr_of(x)) } + ping(x) => { unsafe::reinterpret_cast(ptr::addr_of(x)) } }; let liberated_value <- *addr; unsafe::forget(p); @@ -188,7 +188,7 @@ mod pingpong { fn liberate_pong(-p: pong) -> pipes::send_packet<ping> unsafe { let addr : *pipes::send_packet<ping> = alt p { - pong(x) { unsafe::reinterpret_cast(ptr::addr_of(x)) } + pong(x) => { unsafe::reinterpret_cast(ptr::addr_of(x)) } }; let liberated_value <- *addr; unsafe::forget(p); diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 811f5a52a14..dbaa37abacd 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -13,16 +13,16 @@ fn lookup(table: std::map::hashmap<~str, std::json::json>, key: ~str, default: ~ { alt table.find(key) { - option::some(std::json::string(s)) + option::some(std::json::string(s)) => { *s } - option::some(value) + option::some(value) => { error!{"%s was expected to be a string but is a %?", key, value}; default } - option::none + option::none => { default } @@ -33,14 +33,14 @@ fn add_interface(store: int, managed_ip: ~str, data: std::json::json) -> (~str, { alt data { - std::json::dict(interface) + std::json::dict(interface) => { let name = lookup(interface, ~"ifDescr", ~""); let label = fmt!{"%s-%s", managed_ip, name}; (label, bool_value(false)) } - _ + _ => { error!{"Expected dict for %s interfaces but found %?", managed_ip, data}; (~"gnos:missing-interface", bool_value(true)) @@ -52,13 +52,13 @@ fn add_interfaces(store: int, managed_ip: ~str, device: std::map::hashmap<~str, { alt device[~"interfaces"] { - std::json::list(interfaces) + std::json::list(interfaces) => { do vec::map(*interfaces) |interface| { add_interface(store, managed_ip, interface) } } - _ + _ => { error!{"Expected list for %s interfaces but found %?", managed_ip, device[~"interfaces"]}; ~[] diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 4072560a3cf..a7ae3a55000 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -18,29 +18,29 @@ enum square { impl of to_str::to_str for square { fn to_str() -> ~str { alt self { - bot { ~"R" } - wall { ~"#" } - rock { ~"*" } - lambda { ~"\\" } - closed_lift { ~"L" } - open_lift { ~"O" } - earth { ~"." } - empty { ~" " } + bot => { ~"R" } + wall => { ~"#" } + rock => { ~"*" } + lambda => { ~"\\" } + closed_lift => { ~"L" } + open_lift => { ~"O" } + earth => { ~"." } + empty => { ~" " } } } } fn square_from_char(c: char) -> square { alt c { - 'R' { bot } - '#' { wall } - '*' { rock } - '\\' { lambda } - 'L' { closed_lift } - 'O' { open_lift } - '.' { earth } - ' ' { empty } - _ { + 'R' => { bot } + '#' => { wall } + '*' => { rock } + '\\' => { lambda } + 'L' => { closed_lift } + 'O' => { open_lift } + '.' => { earth } + ' ' => { empty } + _ => { #error("invalid square: %?", c); fail } diff --git a/src/test/run-pass/issue-687.rs b/src/test/run-pass/issue-687.rs index 9ffa90069b8..a314bf4856b 100644 --- a/src/test/run-pass/issue-687.rs +++ b/src/test/run-pass/issue-687.rs @@ -49,8 +49,8 @@ fn main() { loop { let msg = recv(p); alt msg { - closed { debug!{"Got close message"}; break; } - received(data) { + closed => { debug!{"Got close message"}; break; } + received(data) => { debug!{"Got data. Length is:"}; log(debug, vec::len::<u8>(data)); } 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 1473c433e53..c7d48d95108 100644 --- a/src/test/run-pass/keyword-changes-2012-07-31.rs +++ b/src/test/run-pass/keyword-changes-2012-07-31.rs @@ -10,6 +10,6 @@ mod foo { fn bar() -> int { match 0 { - _ { 0 } + _ => { 0 } } } \ No newline at end of file diff --git a/src/test/run-pass/leaky_comm.rs b/src/test/run-pass/leaky_comm.rs index 58a655917ba..3a3bfa4f515 100644 --- a/src/test/run-pass/leaky_comm.rs +++ b/src/test/run-pass/leaky_comm.rs @@ -7,8 +7,8 @@ fn main() { let p = test_comm::port(); alt none::<int> { - none {} - some(_) { + none => {} + some(_) =>{ if test_comm::recv(p) == 0 { error!{"floop"}; } diff --git a/src/test/run-pass/macro-interpolation.rs b/src/test/run-pass/macro-interpolation.rs index 0f692533eb9..cbaa9182dc5 100644 --- a/src/test/run-pass/macro-interpolation.rs +++ b/src/test/run-pass/macro-interpolation.rs @@ -4,10 +4,10 @@ macro_rules! overly_complicated { { fn $fnname($arg: $ty) -> option<$ty> $body alt $fnname($val) { - some($pat) { + some($pat) => { $res } - _ { fail; } + _ => { fail; } } } diff --git a/src/test/run-pass/module-polymorphism4-files/cat.rs b/src/test/run-pass/module-polymorphism4-files/cat.rs index 1f186036e13..832cca5c4f1 100644 --- a/src/test/run-pass/module-polymorphism4-files/cat.rs +++ b/src/test/run-pass/module-polymorphism4-files/cat.rs @@ -8,7 +8,7 @@ enum cat { fn animal() -> ~str { ~"cat" } fn talk(c: cat) -> ~str { alt c { - howlycat { ~"howl" } - meowlycat { ~"meow" } + howlycat => { ~"howl" } + meowlycat => { ~"meow" } } } diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index 3b0f6c1bbdf..1e611804f9f 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -17,8 +17,8 @@ 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 { - some(a) { f(a) } - none { none } + some(a) => { f(a) } + none => { none } } } } diff --git a/src/test/run-pass/negative.rs b/src/test/run-pass/negative.rs index 78f0451c9cf..38661bb84b2 100644 --- a/src/test/run-pass/negative.rs +++ b/src/test/run-pass/negative.rs @@ -1,6 +1,6 @@ fn main() { alt -5 { - -5 {} - _ { fail } + -5 => {} + _ => { fail } } } \ No newline at end of file diff --git a/src/test/run-pass/nested-alts.rs b/src/test/run-pass/nested-alts.rs index 935b82ada56..ff0f0228a63 100644 --- a/src/test/run-pass/nested-alts.rs +++ b/src/test/run-pass/nested-alts.rs @@ -3,12 +3,12 @@ fn baz() -> ! { fail; } fn foo() { alt some::<int>(5) { - some::<int>(x) { + some::<int>(x) => { let mut bar; - alt none::<int> { none::<int> { bar = 5; } _ { baz(); } } + alt none::<int> { none::<int> => { bar = 5; } _ => { baz(); } } log(debug, bar); } - none::<int> { debug!{"hello"}; } + 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 f3ebc1f8a4f..51d7b7d4538 100644 --- a/src/test/run-pass/nested-exhaustive-alt.rs +++ b/src/test/run-pass/nested-exhaustive-alt.rs @@ -1,8 +1,8 @@ fn main() { alt @{foo: true, bar: some(10), baz: 20} { - @{foo: true, bar: some(_), _} {} - @{foo: false, bar: none, _} {} - @{foo: true, bar: none, _} {} - @{foo: false, bar: some(_), _} {} + @{foo: true, bar: some(_), _} => {} + @{foo: false, bar: none, _} => {} + @{foo: true, bar: none, _} => {} + @{foo: false, bar: some(_), _} => {} } } diff --git a/src/test/run-pass/nested-pattern.rs b/src/test/run-pass/nested-pattern.rs index e47a8cad54c..ae901d1f9f1 100644 --- a/src/test/run-pass/nested-pattern.rs +++ b/src/test/run-pass/nested-pattern.rs @@ -10,8 +10,8 @@ enum t { foo(int, uint), bar(int, option<int>), } fn nested(o: t) { alt o { - bar(i, some::<int>(_)) { error!{"wrong pattern matched"}; fail; } - _ { error!{"succeeded"}; } + 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 d58cb896a60..0b93154b566 100644 --- a/src/test/run-pass/nested-patterns.rs +++ b/src/test/run-pass/nested-patterns.rs @@ -1,7 +1,7 @@ fn main() { alt {a: 10, b: @20} { - x@{a, b: @20} { assert x.a == 10; assert a == 10; } - {b, _} { fail; } + x@{a, b: @20} => { assert x.a == 10; assert a == 10; } + {b, _} => { fail; } } let x@{b, _} = {a: 10, b: {mut c: 20}}; x.b.c = 30; diff --git a/src/test/run-pass/nil-pattern.rs b/src/test/run-pass/nil-pattern.rs index 927ff5be3e5..c1ef9c5970e 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 = (); alt x { () => { } } } diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs index 02926c0eff5..a338fd39101 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) } } + alt *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 87109cfb1d6..a856eb3e61b 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 } } + alt 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 aca2232ffc5..979bf5522e9 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; } } + alt 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 e06997c671d..5e115abb0dc 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"}; } } + alt 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 a2823561e62..ae753296a2f 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 @@ -5,13 +5,13 @@ fn foo(src: uint) { alt some(src) { - some(src_id) { + some(src_id) => { for uint::range(0u, 10u) |i| { let yyy = src_id; assert (yyy == 0u); } } - _ { } + _ => { } } } diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index af50c9c974e..81e33bbbebb 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -110,23 +110,23 @@ fn bank_client(+bank: bank::client::login) { let bank = client::login(bank, ~"theincredibleholk", ~"1234"); let bank = alt try_recv(bank) { - some(ok(connected)) { + some(ok(connected)) => { move_it!{connected} } - some(invalid(_)) { fail ~"login unsuccessful" } - none { fail ~"bank closed the connection" } + some(invalid(_)) => { fail ~"login unsuccessful" } + none => { fail ~"bank closed the connection" } }; let bank = client::deposit(bank, 100.00); let bank = client::withdrawal(bank, 50.00); alt try_recv(bank) { - some(money(m, _)) { + some(money(m, _)) => { io::println(~"Yay! I got money!"); } - some(insufficient_funds(_)) { + some(insufficient_funds(_)) => { fail ~"someone stole my money" } - none { + none => { fail ~"bank closed the connection" } } diff --git a/src/test/run-pass/pipe-detect-term.rs b/src/test/run-pass/pipe-detect-term.rs index 93b919154db..b68be9cb23c 100644 --- a/src/test/run-pass/pipe-detect-term.rs +++ b/src/test/run-pass/pipe-detect-term.rs @@ -20,8 +20,8 @@ fn main() { pipes::spawn_service(oneshot::init, |p| { alt try_recv(p) { - some(*) { fail } - none { } + some(*) => { fail } + none => { } } }); diff --git a/src/test/run-pass/pipe-select.rs b/src/test/run-pass/pipe-select.rs index 04cde9c742e..856bb3fe5cc 100644 --- a/src/test/run-pass/pipe-select.rs +++ b/src/test/run-pass/pipe-select.rs @@ -79,8 +79,8 @@ fn test_select2() { stream::client::send(ac, 42); alt pipes::select2(ap, bp) { - either::left(*) { } - either::right(*) { fail } + either::left(*) => { } + either::right(*) => { fail } } stream::client::send(bc, ~"abc"); @@ -93,8 +93,8 @@ fn test_select2() { stream::client::send(bc, ~"abc"); alt pipes::select2(ap, bp) { - either::left(*) { fail } - either::right(*) { } + either::left(*) => { fail } + either::right(*) => { } } stream::client::send(ac, 42); diff --git a/src/test/run-pass/record-pat.rs b/src/test/run-pass/record-pat.rs index 1adc8c5838b..9ccdf58c4f1 100644 --- a/src/test/run-pass/record-pat.rs +++ b/src/test/run-pass/record-pat.rs @@ -4,8 +4,8 @@ enum t3 { c(t2, uint), } fn m(in: t3) -> int { alt in { - c({x: a(m), _}, _) { return m; } - c({x: b(m), y: y}, z) { return ((m + z) as int) + y; } + 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 124c271032f..dccdc6ce384 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 @@ -8,7 +8,7 @@ fn main() { // naively borrowed &x for the lifetime // of the variable x, as we once did alt i { - 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 ef7a8ae1ed7..bd03a2ff6e7 100644 --- a/src/test/run-pass/regions-self-in-enums.rs +++ b/src/test/run-pass/regions-self-in-enums.rs @@ -7,7 +7,7 @@ fn main() { let y = int_wrapper_ctor(&x); let mut z : ∫ alt y { - int_wrapper_ctor(zz) { z = zz; } + 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 0194f4558cb..96b018e6a3b 100644 --- a/src/test/run-pass/shadow.rs +++ b/src/test/run-pass/shadow.rs @@ -5,14 +5,14 @@ fn foo(c: ~[int]) { alt none::<int> { - some::<int>(_) { + some::<int>(_) => { for c.each |i| { log(debug, a); let a = 17; b += ~[a]; } } - _ { } + _ => { } } } diff --git a/src/test/run-pass/simple-alt-generic-tag.rs b/src/test/run-pass/simple-alt-generic-tag.rs index 43ba568fb08..ef5bd284a0d 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"}; } } + alt 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 4e30d44304a..2bf60273c54 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); alt c { a::<int>(_) => { } } } diff --git a/src/test/run-pass/size-and-align.rs b/src/test/run-pass/size-and-align.rs index c4689f0951a..5c325e25f48 100644 --- a/src/test/run-pass/size-and-align.rs +++ b/src/test/run-pass/size-and-align.rs @@ -6,8 +6,8 @@ enum clam<T> { a(T, int), b, } fn uhoh<T>(v: ~[clam<T>]) { alt v[1] { - a::<T>(t, u) { debug!{"incorrect"}; log(debug, u); fail; } - b::<T> { debug!{"correct"}; } + a::<T>(t, u) => { debug!{"incorrect"}; log(debug, u); fail; } + b::<T> => { debug!{"correct"}; } } } diff --git a/src/test/run-pass/tag-variant-disr-val.rs b/src/test/run-pass/tag-variant-disr-val.rs index 45c2c2ef94d..2b43cb7061f 100644 --- a/src/test/run-pass/tag-variant-disr-val.rs +++ b/src/test/run-pass/tag-variant-disr-val.rs @@ -30,14 +30,14 @@ fn test_color(color: color, val: int, name: ~str) unsafe { fn get_color_alt(color: color) -> ~str { alt color { - red {~"red"} - green {~"green"} - blue {~"blue"} - black {~"black"} - white {~"white"} - imaginary {~"imaginary"} - purple {~"purple"} - orange {~"orange"} + red => {~"red"} + green => {~"green"} + blue => {~"blue"} + black => {~"black"} + white => {~"white"} + imaginary => {~"imaginary"} + purple => {~"purple"} + orange => {~"orange"} } } diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index 919c53d32b2..a56061a8ff5 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -14,8 +14,8 @@ trait to_str { impl <T: to_str> of to_str for option<T> { fn to_str() -> ~str { alt self { - none { ~"none" } - some(t) { ~"some(" + t.to_str() + ~")" } + 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 8c1c3ef7a70..a1825737a4e 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 { alt 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 ad9b6ed2ce8..2f155ef00e7 100644 --- a/src/test/run-pass/unique-alt-discrim.rs +++ b/src/test/run-pass/unique-alt-discrim.rs @@ -2,7 +2,7 @@ fn altsimple() { alt ~true { - _ { } + _ => { } } } fn main() { } \ No newline at end of file diff --git a/src/test/run-pass/unique-in-tag.rs b/src/test/run-pass/unique-in-tag.rs index d65143285bd..aaba73c72d0 100644 --- a/src/test/run-pass/unique-in-tag.rs +++ b/src/test/run-pass/unique-in-tag.rs @@ -3,11 +3,11 @@ fn test1() { let x = u(~10); assert alt x { - u(a) { + u(a) => { log(error, a); *a } - _ { 66 } + _ => { 66 } } == 10; } diff --git a/src/test/run-pass/unique-pat-2.rs b/src/test/run-pass/unique-pat-2.rs index 169ce721de7..241ff4b1d3a 100644 --- a/src/test/run-pass/unique-pat-2.rs +++ b/src/test/run-pass/unique-pat-2.rs @@ -4,7 +4,7 @@ enum bar { u(~foo), w(int), } fn main() { assert (alt u(~{a: 10, b: 40u}) { - u(~{a: a, b: b}) { a + (b as int) } - _ { 66 } + 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 034404f7a3f..edc5be4d159 100644 --- a/src/test/run-pass/unique-pat-3.rs +++ b/src/test/run-pass/unique-pat-3.rs @@ -3,10 +3,10 @@ enum bar { u(~int), w(int), } fn main() { assert alt u(~10) { - u(a) { + u(a) => { log(error, a); *a } - _ { 66 } + _ => { 66 } } == 10; } diff --git a/src/test/run-pass/unique-pat.rs b/src/test/run-pass/unique-pat.rs index 391c4c8405e..81c1e6ccbd6 100644 --- a/src/test/run-pass/unique-pat.rs +++ b/src/test/run-pass/unique-pat.rs @@ -1,7 +1,7 @@ fn simple() { alt ~true { - ~true { } - _ { fail; } + ~true => { } + _ => { fail; } } } diff --git a/src/test/run-pass/unreachable-code.rs b/src/test/run-pass/unreachable-code.rs index 2747ed2755e..e48056d68c0 100644 --- a/src/test/run-pass/unreachable-code.rs +++ b/src/test/run-pass/unreachable-code.rs @@ -23,8 +23,8 @@ fn ret_ret() -> int { return (return 2) + 3; } fn ret_guard() { alt 2 { - x if (return) { x; } - _ {} + 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 76e1c95ca58..21b1c1d66da 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; } } + alt 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 0479d3c9555..b06d2035644 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; } } + alt 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 5dd7d91640e..5e7fe0b0524 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -20,14 +20,14 @@ fn zombiejesus() { while (return) { if (return) { alt (return) { - 1 { + 1 => { if (return) { return } else { return } } - _ { return } + _ => { return } }; } else 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 { alt check again { 1 => { } } } break; } } fn evil_lincoln() { let evil <- debug!{"lincoln"}; } |
