]> git.lizzy.rs Git - rust.git/commitdiff
Convert alt to match. Stop parsing alt
authorBrian Anderson <banderson@mozilla.com>
Mon, 6 Aug 2012 19:34:08 +0000 (12:34 -0700)
committerBrian Anderson <banderson@mozilla.com>
Mon, 6 Aug 2012 22:36:30 +0000 (15:36 -0700)
359 files changed:
doc/rust.md
doc/tutorial.md
src/cargo/cargo.rs
src/compiletest/compiletest.rs
src/compiletest/errors.rs
src/compiletest/header.rs
src/compiletest/procsrv.rs
src/compiletest/runtest.rs
src/compiletest/util.rs
src/fuzzer/fuzzer.rs
src/libcore/bool.rs
src/libcore/char.rs
src/libcore/comm.rs
src/libcore/dlist.rs
src/libcore/dvec.rs
src/libcore/either.rs
src/libcore/extfmt.rs
src/libcore/float.rs
src/libcore/future.rs
src/libcore/int-template.rs
src/libcore/io.rs
src/libcore/iter-trait/option.rs
src/libcore/iter.rs
src/libcore/option.rs
src/libcore/os.rs
src/libcore/path.rs
src/libcore/pipes.rs
src/libcore/priv.rs
src/libcore/result.rs
src/libcore/run.rs
src/libcore/send_map.rs
src/libcore/str.rs
src/libcore/task.rs
src/libcore/uint-template.rs
src/libcore/unicode.rs
src/libcore/vec.rs
src/libstd/base64.rs
src/libstd/bitv.rs
src/libstd/c_vec.rs
src/libstd/deque.rs
src/libstd/ebml.rs
src/libstd/fun_treemap.rs
src/libstd/getopts.rs
src/libstd/json.rs
src/libstd/list.rs
src/libstd/map.rs
src/libstd/net_ip.rs
src/libstd/net_tcp.rs
src/libstd/rope.rs
src/libstd/serialization.rs
src/libstd/smallintmap.rs
src/libstd/tempfile.rs
src/libstd/term.rs
src/libstd/test.rs
src/libstd/time.rs
src/libstd/timer.rs
src/libstd/treemap.rs
src/libstd/uv_global_loop.rs
src/libstd/uv_iotask.rs
src/libstd/uv_ll.rs
src/libsyntax/ast.rs
src/libsyntax/ast_map.rs
src/libsyntax/ast_util.rs
src/libsyntax/attr.rs
src/libsyntax/codemap.rs
src/libsyntax/diagnostic.rs
src/libsyntax/ext/auto_serialize.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/env.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/fmt.rs
src/libsyntax/ext/pipes/check.rs
src/libsyntax/ext/pipes/parse_proto.rs
src/libsyntax/ext/pipes/pipec.rs
src/libsyntax/ext/pipes/proto.rs
src/libsyntax/ext/qquote.rs
src/libsyntax/ext/simplext.rs
src/libsyntax/ext/source_util.rs
src/libsyntax/ext/tt/earley_parser.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/transcribe.rs
src/libsyntax/fold.rs
src/libsyntax/parse.rs
src/libsyntax/parse/attr.rs
src/libsyntax/parse/classify.rs
src/libsyntax/parse/common.rs
src/libsyntax/parse/eval.rs
src/libsyntax/parse/lexer.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/prec.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pp.rs
src/libsyntax/print/pprust.rs
src/libsyntax/util/interner.rs
src/libsyntax/visit.rs
src/rustc/back/link.rs
src/rustc/back/rpath.rs
src/rustc/back/x86.rs
src/rustc/back/x86_64.rs
src/rustc/driver/driver.rs
src/rustc/driver/rustc.rs
src/rustc/driver/session.rs
src/rustc/front/config.rs
src/rustc/front/intrinsic_inject.rs
src/rustc/front/test.rs
src/rustc/lib/llvm.rs
src/rustc/metadata/creader.rs
src/rustc/metadata/csearch.rs
src/rustc/metadata/cstore.rs
src/rustc/metadata/decoder.rs
src/rustc/metadata/encoder.rs
src/rustc/metadata/filesearch.rs
src/rustc/metadata/loader.rs
src/rustc/metadata/tydecode.rs
src/rustc/metadata/tyencode.rs
src/rustc/middle/astencode.rs
src/rustc/middle/block_use.rs
src/rustc/middle/borrowck.rs
src/rustc/middle/borrowck/categorization.rs
src/rustc/middle/borrowck/check_loans.rs
src/rustc/middle/borrowck/gather_loans.rs
src/rustc/middle/borrowck/loan.rs
src/rustc/middle/borrowck/preserve.rs
src/rustc/middle/capture.rs
src/rustc/middle/check_alt.rs
src/rustc/middle/check_const.rs
src/rustc/middle/check_loop.rs
src/rustc/middle/const_eval.rs
src/rustc/middle/freevars.rs
src/rustc/middle/kind.rs
src/rustc/middle/lang_items.rs
src/rustc/middle/lint.rs
src/rustc/middle/liveness.rs
src/rustc/middle/pat_util.rs
src/rustc/middle/region.rs
src/rustc/middle/resolve3.rs
src/rustc/middle/trans/alt.rs
src/rustc/middle/trans/base.rs
src/rustc/middle/trans/build.rs
src/rustc/middle/trans/closure.rs
src/rustc/middle/trans/common.rs
src/rustc/middle/trans/consts.rs
src/rustc/middle/trans/debuginfo.rs
src/rustc/middle/trans/foreign.rs
src/rustc/middle/trans/impl.rs
src/rustc/middle/trans/reachable.rs
src/rustc/middle/trans/reflect.rs
src/rustc/middle/trans/shape.rs
src/rustc/middle/trans/tvec.rs
src/rustc/middle/trans/type_of.rs
src/rustc/middle/trans/type_use.rs
src/rustc/middle/trans/uniq.rs
src/rustc/middle/tstate/ann.rs
src/rustc/middle/tstate/annotate.rs
src/rustc/middle/tstate/auxiliary.rs
src/rustc/middle/tstate/collect_locals.rs
src/rustc/middle/tstate/pre_post_conditions.rs
src/rustc/middle/tstate/states.rs
src/rustc/middle/tstate/tritv.rs
src/rustc/middle/ty.rs
src/rustc/middle/typeck.rs
src/rustc/middle/typeck/astconv.rs
src/rustc/middle/typeck/check.rs
src/rustc/middle/typeck/check/alt.rs
src/rustc/middle/typeck/check/demand.rs
src/rustc/middle/typeck/check/method.rs
src/rustc/middle/typeck/check/regionck.rs
src/rustc/middle/typeck/check/regionmanip.rs
src/rustc/middle/typeck/check/vtable.rs
src/rustc/middle/typeck/check/writeback.rs
src/rustc/middle/typeck/coherence.rs
src/rustc/middle/typeck/collect.rs
src/rustc/middle/typeck/infer.rs
src/rustc/util/common.rs
src/rustc/util/ppaux.rs
src/rustdoc/astsrv.rs
src/rustdoc/attr_parser.rs
src/rustdoc/attr_pass.rs
src/rustdoc/config.rs
src/rustdoc/desc_to_brief_pass.rs
src/rustdoc/doc.rs
src/rustdoc/extract.rs
src/rustdoc/fold.rs
src/rustdoc/markdown_index_pass.rs
src/rustdoc/markdown_pass.rs
src/rustdoc/markdown_writer.rs
src/rustdoc/page_pass.rs
src/rustdoc/prune_hidden_pass.rs
src/rustdoc/rustdoc.rs
src/rustdoc/sectionalize_pass.rs
src/rustdoc/sort_item_type_pass.rs
src/rustdoc/tystr_pass.rs
src/test/auxiliary/issue2378a.rs
src/test/bench/core-std.rs
src/test/bench/graph500-bfs.rs
src/test/bench/msgsend-pipes-shared.rs
src/test/bench/msgsend-pipes.rs
src/test/bench/msgsend-ring-pipes.rs
src/test/bench/msgsend.rs
src/test/bench/pingpong.rs
src/test/bench/shootout-binarytrees.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-pfib.rs
src/test/bench/shootout-threadring.rs
src/test/bench/task-perf-alloc-unwind.rs
src/test/bench/task-perf-one-million.rs
src/test/bench/task-perf-word-count-generic.rs
src/test/compile-fail/alt-arrows-block-then-binop.rs
src/test/compile-fail/alt-join.rs
src/test/compile-fail/alt-pattern-field-mismatch-2.rs
src/test/compile-fail/alt-pattern-field-mismatch.rs
src/test/compile-fail/alt-range-fail-dominate.rs
src/test/compile-fail/alt-range-fail.rs
src/test/compile-fail/alt-tag-nullary.rs
src/test/compile-fail/alt-tag-unary.rs
src/test/compile-fail/bad-alt.rs
src/test/compile-fail/bad-record-pat-2.rs
src/test/compile-fail/bad-record-pat.rs
src/test/compile-fail/bogus-tag.rs
src/test/compile-fail/borrowck-binding-mutbl.rs
src/test/compile-fail/borrowck-issue-2657-1.rs
src/test/compile-fail/borrowck-issue-2657-2.rs
src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs
src/test/compile-fail/borrowck-pat-enum-in-box.rs
src/test/compile-fail/borrowck-pat-enum.rs
src/test/compile-fail/borrowck-pat-reassign-binding.rs
src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs
src/test/compile-fail/borrowck-unchecked-with-borrow.rs
src/test/compile-fail/deref-non-pointer.rs
src/test/compile-fail/issue-1193.rs
src/test/compile-fail/issue-2111.rs
src/test/compile-fail/issue-2354.rs
src/test/compile-fail/issue-2848.rs
src/test/compile-fail/issue-2849.rs
src/test/compile-fail/issue-3038.rs
src/test/compile-fail/liveness-missing-ret2.rs
src/test/compile-fail/liveness-unused.rs
src/test/compile-fail/non-exhaustive-match-nested.rs
src/test/compile-fail/non-exhaustive-match.rs
src/test/compile-fail/occurs-check-3.rs
src/test/compile-fail/or-patter-mismatch.rs
src/test/compile-fail/pattern-tyvar-2.rs
src/test/compile-fail/pattern-tyvar.rs
src/test/compile-fail/regions-creating-enums.rs
src/test/compile-fail/restricted-keyword1.rs
src/test/compile-fail/unreachable-arm.rs
src/test/pretty/alt-naked-expr-long.rs
src/test/pretty/alt-naked-expr-medium.rs
src/test/pretty/alt-naked-expr.rs
src/test/pretty/block-disambig.rs
src/test/pretty/unary-op-disambig.rs
src/test/run-fail/alt-bot-fail.rs
src/test/run-fail/alt-disc-bot.rs
src/test/run-fail/alt-wildcards.rs
src/test/run-fail/expr-alt-fail-fn.rs
src/test/run-fail/expr-alt-fail.rs
src/test/run-fail/fail-parens.rs
src/test/run-fail/issue-2156.rs
src/test/run-fail/unwind-alt.rs
src/test/run-pass/alt-arrows-blocky-commas.rs
src/test/run-pass/alt-bot-2.rs
src/test/run-pass/alt-bot.rs
src/test/run-pass/alt-implicit-copy-unique.rs
src/test/run-pass/alt-implicit-copy.rs
src/test/run-pass/alt-join.rs
src/test/run-pass/alt-naked-record-expr.rs
src/test/run-pass/alt-naked-record.rs
src/test/run-pass/alt-path.rs
src/test/run-pass/alt-pattern-drop.rs
src/test/run-pass/alt-pattern-lit.rs
src/test/run-pass/alt-pattern-no-type-params.rs
src/test/run-pass/alt-pattern-simple.rs
src/test/run-pass/alt-phi.rs
src/test/run-pass/alt-range.rs
src/test/run-pass/alt-str.rs
src/test/run-pass/alt-tag.rs
src/test/run-pass/alt-type-simple.rs
src/test/run-pass/alt-unique-bind.rs
src/test/run-pass/alt-with-ret-arm.rs
src/test/run-pass/binary-minus-without-space.rs
src/test/run-pass/block-arg.rs
src/test/run-pass/borrowck-pat-reassign-no-binding.rs
src/test/run-pass/borrowck-preserve-box-in-arm-not-taken.rs
src/test/run-pass/borrowck-preserve-box-in-discr.rs
src/test/run-pass/borrowck-preserve-box-in-pat.rs
src/test/run-pass/borrowck-preserve-box-sometimes-needed.rs
src/test/run-pass/borrowck-univariant-enum.rs
src/test/run-pass/box-pattern.rs
src/test/run-pass/class-impl-very-parameterized-trait.rs
src/test/run-pass/drop-on-empty-block-exit.rs
src/test/run-pass/expr-alt-box.rs
src/test/run-pass/expr-alt-fail-all.rs
src/test/run-pass/expr-alt-fail.rs
src/test/run-pass/expr-alt-generic-box1.rs
src/test/run-pass/expr-alt-generic-box2.rs
src/test/run-pass/expr-alt-generic-unique1.rs
src/test/run-pass/expr-alt-generic-unique2.rs
src/test/run-pass/expr-alt-generic.rs
src/test/run-pass/expr-alt-struct.rs
src/test/run-pass/expr-alt-unique.rs
src/test/run-pass/expr-alt.rs
src/test/run-pass/expr-empty-ret.rs
src/test/run-pass/expr-fn.rs
src/test/run-pass/fat-arrow-alt.rs
src/test/run-pass/generic-tag-alt.rs
src/test/run-pass/generic-tag-values.rs
src/test/run-pass/guards.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/inferred-suffix-in-pattern-range.rs
src/test/run-pass/issue-1701.rs
src/test/run-pass/issue-2101.rs
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2804.rs
src/test/run-pass/issue-2869.rs
src/test/run-pass/issue-2904.rs
src/test/run-pass/issue-3037.rs
src/test/run-pass/issue-687.rs
src/test/run-pass/keyword-changes-2012-07-31.rs
src/test/run-pass/leaky_comm.rs
src/test/run-pass/macro-interpolation.rs
src/test/run-pass/module-polymorphism4-files/cat.rs
src/test/run-pass/monad.rs
src/test/run-pass/negative.rs
src/test/run-pass/nested-alts.rs
src/test/run-pass/nested-exhaustive-alt.rs
src/test/run-pass/nested-pattern.rs
src/test/run-pass/nested-patterns.rs
src/test/run-pass/nil-pattern.rs
src/test/run-pass/non-boolean-pure-fns.rs
src/test/run-pass/nullary-or-pattern.rs
src/test/run-pass/or-pattern.rs
src/test/run-pass/paren-free.rs
src/test/run-pass/pattern-bound-var-in-for-each.rs
src/test/run-pass/pipe-bank-proto.rs
src/test/run-pass/pipe-detect-term.rs
src/test/run-pass/pipe-select.rs
src/test/run-pass/record-pat.rs
src/test/run-pass/regions-infer-borrow-scope-addr-of.rs
src/test/run-pass/regions-self-in-enums.rs
src/test/run-pass/shadow.rs
src/test/run-pass/simple-alt-generic-tag.rs
src/test/run-pass/simple-generic-alt.rs
src/test/run-pass/size-and-align.rs
src/test/run-pass/tag-align-dyn-variants.rs
src/test/run-pass/tag-variant-disr-val.rs
src/test/run-pass/trait-cast.rs
src/test/run-pass/typestate-cfg-nesting.rs
src/test/run-pass/unique-alt-discrim.rs
src/test/run-pass/unique-in-tag.rs
src/test/run-pass/unique-pat-2.rs
src/test/run-pass/unique-pat-3.rs
src/test/run-pass/unique-pat.rs
src/test/run-pass/unreachable-code.rs
src/test/run-pass/use-uninit-alt.rs
src/test/run-pass/use-uninit-alt2.rs
src/test/run-pass/weird-exprs.rs

index fb3d27e67e50d1d7582ac1478fd0c15c9ee8db9e..9342bcb0ca87a8d8a8bbb7eac0ffa205cf152b70 100644 (file)
@@ -209,7 +209,7 @@ import export use mod
 The keywords in [source files](#source-files) are the following strings:
 
 ~~~~~~~~ {.keyword}
-alt again assert
+again assert
 break
 check class const copy
 drop
@@ -217,7 +217,7 @@ else enum export extern
 fail false fn for
 if impl import
 let log loop
-mod mut
+match mod mut
 pure
 return
 true trait type
@@ -956,7 +956,7 @@ An example of a predicate that uses an unchecked block:
 # import std::list::*;
 
 fn pure_foldl<T, U: copy>(ls: list<T>, u: U, f: fn(&&T, &&U) -> U) -> U {
-    alt ls {
+    match ls {
       nil => u,
       cons(hd, tl) => f(hd, pure_foldl(*tl, f(hd, u), f))
     }
@@ -1156,7 +1156,7 @@ class file_descriptor {
       let mut name: option<~str>;
     }
     fn get_name() -> ~str {
-      alt self.name {
+      match self.name {
          none    => fail ~"File has no name!",
          some(n) => n
       }
@@ -2171,21 +2171,21 @@ evaluated. If all `if` and `else if` conditions evaluate to `false`
 then any `else` block is executed.
 
 
-### Alternative expressions
+### Match expressions
 
 ~~~~~~~~{.ebnf .gram}
-alt_expr : "alt" expr '{' alt_arm [ '|' alt_arm ] * '}' ;
+match_expr : "match" expr '{' match_arm [ '|' match_arm ] * '}' ;
 
-alt_arm : alt_pat '=>' expr_or_blockish ;
+match_arm : match_pat '=>' expr_or_blockish ;
 
-alt_pat : pat [ "to" pat ] ? [ "if" expr ] ;
+match_pat : pat [ "to" pat ] ? [ "if" expr ] ;
 ~~~~~~~~
 
 
-An `alt` expression branches on a *pattern*. The exact form of matching that
+A `match` expression branches on a *pattern*. The exact form of matching that
 occurs depends on the pattern. Patterns consist of some combination of
 literals, destructured enum constructors, records and tuples, variable binding
-specifications, wildcards (`*`), and placeholders (`_`). An `alt` expression has a *head
+specifications, wildcards (`*`), and placeholders (`_`). A `match` expression has a *head
 expression*, which is the value to compare to the patterns. The type of the
 patterns must equal the type of the head expression.
 
@@ -2198,7 +2198,7 @@ enum list<X> { nil, cons(X, @list<X>) }
 
 let x: list<int> = cons(10, @cons(11, @nil));
 
-alt x {
+match x {
     cons(_, @nil) => fail ~"singleton list",
     cons(*)       => return,
     nil           => fail ~"empty list"
@@ -2210,13 +2210,13 @@ tail value of `@nil`. The second pattern matches `any` list constructed with `co
 ignoring the values of its arguments. The difference between `_` and `*` is that the pattern `C(_)` is only type-correct if
 `C` has exactly one argument, while the pattern `C(*)` is type-correct for any enum variant `C`, regardless of how many arguments `C` has.
 
-To execute an `alt` expression, first the head expression is evaluated, then
+To execute an `match` expression, first the head expression is evaluated, then
 its value is sequentially compared to the patterns in the arms until a match
 is found. The first arm with a matching pattern is chosen as the branch target
-of the `alt`, any variables bound by the pattern are assigned to local
+of the `match`, any variables bound by the pattern are assigned to local
 variables in the arm's block, and control enters the block.
 
-An example of an `alt` expression:
+An example of an `match` expression:
 
 
 ~~~~
@@ -2227,7 +2227,7 @@ enum list<X> { nil, cons(X, @list<X>) }
 
 let x: list<int> = cons(10, @cons(11, @nil));
 
-alt x {
+match x {
     cons(a, @cons(b, _)) => {
         process_pair(a,b);
     }
@@ -2264,7 +2264,7 @@ fn main() {
         }
     };
 
-    alt r {
+    match r {
       {options: {choose: true, _}, _} => {
         choose_player(r)
       }
@@ -2278,20 +2278,20 @@ fn main() {
 }
 ~~~~
 
-Multiple alternative patterns may be joined with the `|` operator.  A
+Multiple match patterns may be joined with the `|` operator.  A
 range of values may be specified with `to`. For example:
 
 ~~~~
 # let x = 2;
 
-let message = alt x {
+let message = match x {
   0 | 1  => ~"not many",
   2 to 9 => ~"a few",
   _      => ~"lots"
 };
 ~~~~
 
-Finally, alt patterns can accept *pattern guards* to further refine the
+Finally, match patterns can accept *pattern guards* to further refine the
 criteria for matching a case. Pattern guards appear after the pattern and
 consist of a bool-typed expression following the `if` keyword. A pattern
 guard may refer to the variables bound within the pattern they follow.
@@ -2301,7 +2301,7 @@ guard may refer to the variables bound within the pattern they follow.
 # fn process_digit(i: int) { }
 # fn process_other(i: int) { }
 
-let message = alt maybe_digit {
+let message = match maybe_digit {
   some(x) if x < 10 => process_digit(x),
   some(x) => process_other(x),
   none => fail
index 8ee70482ea955a53cc7decf450845bd52f584b70..ebdb2303dcc209433f16f8f744d84521ac76d2c4 100644 (file)
@@ -116,7 +116,7 @@ fn main() {
         let pick = || (~[rock, paper, scissors])[rng.gen_uint() % 3];
 
         // Pick two gestures and decide the result
-        alt (pick(), pick()) {
+        match (pick(), pick()) {
             (rock, scissors) | (paper, rock) | (scissors, paper) => copy player1,
             (scissors, rock) | (rock, paper) | (paper, scissors) => copy player2,
             _ => ~"tie"
@@ -707,14 +707,14 @@ have type `int`, because control doesn't reach the end of that arm
 
 ## Pattern matching
 
-Rust's `alt` construct is a generalized, cleaned-up version of C's
+Rust's `match` construct is a generalized, cleaned-up version of C's
 `switch` construct. You provide it with a value and a number of arms,
 each labelled with a pattern, and it will execute the arm that matches
 the value.
 
 ~~~~
 # let my_number = 1;
-alt my_number {
+match my_number {
   0       => io::println(~"zero"),
   1 | 2   => io::println(~"one or two"),
   3 to 10 => io::println(~"three to ten"),
@@ -732,14 +732,14 @@ valid patterns, and will match only their own value. The pipe operator
 of numeric literal patterns can be expressed with `to`. The underscore
 (`_`) is a wildcard pattern that matches everything.
 
-The patterns in an alt arm are followed by a fat arrow, `=>`, then an
+The patterns in an match arm are followed by a fat arrow, `=>`, then an
 expression to evaluate. Each case is separated by commas. It's often
 convenient to use a block expression for a case, in which case the
 commas are optional.
 
 ~~~
 # let my_number = 1;
-alt my_number {
+match my_number {
   0 => {
     io::println(~"zero")
   }
@@ -750,9 +750,9 @@ alt my_number {
 ~~~
 
 If the arm with the wildcard pattern was left off in the above
-example, the typechecker would reject it at compile time. `alt`
+example, the typechecker would reject it at compile time. `match`
 constructs must be exhaustive: they must have an arm covering every
-possible case. (You may use the `alt check` construct to write a
+possible case. (You may use the `match check` construct to write a
 non-exhaustive match, but it's highly undesirable to do so. You may
 reason that the missing cases will never occur, but the typechecker
 provides you with no assurance that your reasoning is correct.)
@@ -763,7 +763,7 @@ that `(float, float)` is a tuple of two floats:
 
 ~~~~
 fn angle(vec: (float, float)) -> float {
-    alt vec {
+    match vec {
       (0f, y) if y < 0f => 1.5 * float::consts::pi,
       (0f, y) => 0.5 * float::consts::pi,
       (x, y) => float::atan(y / x)
@@ -777,7 +777,7 @@ y)` matches any tuple whose first element is zero, and binds `y` to
 the second element. `(x, y)` matches any tuple, and binds both
 elements to a variable.
 
-Any `alt` arm can have a guard clause (written `if EXPR`), which is
+Any `match` arm can have a guard clause (written `if EXPR`), which is
 an expression of type `bool` that determines, after the pattern is
 found to match, whether the arm is taken or not. The variables bound
 by the pattern are available in this guard expression.
@@ -851,7 +851,7 @@ task failure:
 
 * Accessing an out-of-bounds element of a vector.
 
-* Having no clauses match when evaluating an `alt check` expression.
+* Having no clauses match when evaluating an `match check` expression.
 
 * An assertion failure.
 
@@ -1044,14 +1044,14 @@ not an actual new type.)
 
 ## Record patterns
 
-Records can be destructured in `alt` patterns. The basic syntax is
+Records can be destructured in `match` patterns. The basic syntax is
 `{fieldname: pattern, ...}`, but the pattern for a field can be
 omitted as a shorthand for simply binding the variable with the same
 name as the field.
 
 ~~~~
 # let mypoint = {x: 0f, y: 0f};
-alt mypoint {
+match mypoint {
     {x: 0f, y: y_name} => { /* Provide sub-patterns for fields */ }
     {x, y}             => { /* Simply bind the fields */ }
 }
@@ -1157,7 +1157,7 @@ patterns, as in this definition of `area`:
 # type point = {x: float, y: float};
 # enum shape { circle(point, float), rectangle(point, point) }
 fn area(sh: shape) -> float {
-    alt sh {
+    match sh {
         circle(_, size) => float::consts::pi * size * size,
         rectangle({x, y}, {x: x2, y: y2}) => (x2 - x) * (y2 - y)
     }
@@ -1170,7 +1170,7 @@ Another example, matching nullary enum variants:
 # type point = {x: float, y: float};
 # enum direction { north, east, south, west }
 fn point_from_direction(dir: direction) -> point {
-    alt dir {
+    match dir {
         north => {x:  0f, y:  1f},
         east  => {x:  1f, y:  0f},
         south => {x:  0f, y: -1f},
@@ -1188,7 +1188,7 @@ nil, `()`, as the empty tuple if you like).
 
 ~~~~
 let mytup: (int, int, float) = (10, 20, 30.0);
-alt mytup {
+match mytup {
   (a, b, c) => log(info, a + b + (c as int))
 }
 ~~~~
@@ -1922,7 +1922,7 @@ gets access to them.
 ## Other uses of safe references
 
 Safe references are not only used for argument passing. When you
-destructure on a value in an `alt` expression, or loop over a vector
+destructure on a value in a `match` expression, or loop over a vector
 with `for`, variables bound to the inside of the given data structure
 will use safe references, not copies. This means such references are
 very cheap, but you'll occasionally have to copy them to ensure
@@ -1930,7 +1930,7 @@ safety.
 
 ~~~~
 let mut my_rec = {a: 4, b: ~[1, 2, 3]};
-alt my_rec {
+match my_rec {
   {a, b} => {
     log(info, b); // This is okay
     my_rec = {a: a + 1, b: b + ~[a]};
index 33482679920d8b976b1a437e62cf6351ce61bbd6..2f162db325cd06f858021de744bb445ad7ad62ba 100644 (file)
@@ -128,7 +128,7 @@ fn is_hex_digit(ch: char) -> bool {
                 return false;
             }
 
-            alt i {
+            match i {
                 0u => {
                     if str::len(part) == 8u {
                         correct += 1u;
@@ -192,7 +192,7 @@ fn is_archive_url(u: ~str) -> bool {
     // FIXME (#2661): this requires the protocol bit - if we had proper
     // url parsing, we wouldn't need it
 
-    alt str::find_str(u, ~"://") {
+    match str::find_str(u, ~"://") {
         option::some(i) => has_archive_extension(u),
         _ => false
     }
@@ -223,9 +223,9 @@ fn load_link(mis: ~[@ast::meta_item]) -> (option<~str>,
     let mut vers = none;
     let mut uuid = none;
     for mis.each |a| {
-        alt a.node {
+        match a.node {
             ast::meta_name_value(v, {node: ast::lit_str(s), span: _}) => {
-                alt *v {
+                match *v {
                     ~"name" => name = some(*s),
                     ~"vers" => vers = some(*s),
                     ~"uuid" => uuid = some(*s),
@@ -250,9 +250,9 @@ fn load_crate(filename: ~str) -> option<crate> {
     let mut crate_type = none;
 
     for c.node.attrs.each |a| {
-        alt a.node.value.node {
+        match a.node.value.node {
             ast::meta_name_value(v, {node: ast::lit_str(s), span: _}) => {
-                alt *v {
+                match *v {
                     ~"desc" => desc = some(*v),
                     ~"sigs" => sigs = some(*v),
                     ~"crate_type" => crate_type = some(*v),
@@ -279,7 +279,7 @@ fn load_crate(filename: ~str) -> option<crate> {
     };
 
     fn goto_view_item(e: env, i: @ast::view_item) {
-        alt i.node {
+        match i.node {
             ast::view_item_use(ident, metas, id) => {
                 let name_items =
                     attr::find_meta_items_by_name(metas, ~"name");
@@ -293,11 +293,11 @@ fn goto_view_item(e: env, i: @ast::view_item) {
                 let mut attr_from = ~"";
 
               for m.each |item| {
-                    alt attr::get_meta_item_value_str(item) {
+                    match attr::get_meta_item_value_str(item) {
                         some(value) => {
                             let name = attr::get_meta_item_name(item);
 
-                            alt *name {
+                            match *name {
                                 ~"vers" => attr_vers = *value,
                                 ~"from" => attr_from = *value,
                                 _ => ()
@@ -315,7 +315,7 @@ fn goto_view_item(e: env, i: @ast::view_item) {
                     } else { *attr_name }
                 };
 
-                alt *attr_name {
+                match *attr_name {
                     ~"std" | ~"core" => (),
                     _ => vec::push(e.deps, query)
                 }
@@ -339,7 +339,7 @@ fn goto_item(_e: env, _i: @ast::item) {
 
     let deps = copy e.deps;
 
-    alt (name, vers, uuid) {
+    match (name, vers, uuid) {
         (some(name0), some(vers0), some(uuid0)) => {
             some({
                 name: name0,
@@ -390,21 +390,21 @@ fn parse_source(name: ~str, j: json::json) -> source {
         fail fmt!{"'%s' is an invalid source name", name};
     }
 
-    alt j {
+    match j {
         json::dict(j) => {
-            let mut url = alt j.find(~"url") {
+            let mut url = match j.find(~"url") {
                 some(json::string(u)) => *u,
                 _ => fail ~"needed 'url' field in source"
             };
-            let method = alt j.find(~"method") {
+            let method = match j.find(~"method") {
                 some(json::string(u)) => *u,
                 _ => assume_source_method(url)
             };
-            let key = alt j.find(~"key") {
+            let key = match j.find(~"key") {
                 some(json::string(u)) => some(*u),
                 _ => none
             };
-            let keyfp = alt j.find(~"keyfp") {
+            let keyfp = match j.find(~"keyfp") {
                 some(json::string(u)) => some(*u),
                 _ => none
             };
@@ -426,7 +426,7 @@ fn parse_source(name: ~str, j: json::json) -> source {
 fn try_parse_sources(filename: ~str, sources: map::hashmap<~str, source>) {
     if !os::path_exists(filename)  { return; }
     let c = io::read_whole_file_str(filename);
-    alt json::from_str(result::get(c)) {
+    match json::from_str(result::get(c)) {
         ok(json::dict(j)) => {
           for j.each |k, v| {
                 sources.insert(k, parse_source(k, v));
@@ -439,7 +439,7 @@ fn try_parse_sources(filename: ~str, sources: map::hashmap<~str, source>) {
 }
 
 fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
-    let name = alt p.find(~"name") {
+    let name = match p.find(~"name") {
         some(json::string(n)) => {
             if !valid_pkg_name(*n) {
                 warn(~"malformed source json: "
@@ -456,7 +456,7 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
         }
     };
 
-    let uuid = alt p.find(~"uuid") {
+    let uuid = match p.find(~"uuid") {
         some(json::string(n)) => {
             if !is_uuid(*n) {
                 warn(~"malformed source json: "
@@ -472,7 +472,7 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
         }
     };
 
-    let url = alt p.find(~"url") {
+    let url = match p.find(~"url") {
         some(json::string(n)) => *n,
         _ => {
             warn(~"malformed source json: " + src.name + ~" (missing url)");
@@ -480,7 +480,7 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
         }
     };
 
-    let method = alt p.find(~"method") {
+    let method = match p.find(~"method") {
         some(json::string(n)) => *n,
         _ => {
             warn(~"malformed source json: "
@@ -489,16 +489,16 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
         }
     };
 
-    let reference = alt p.find(~"ref") {
+    let reference = match p.find(~"ref") {
         some(json::string(n)) => some(*n),
         _ => none
     };
 
     let mut tags = ~[];
-    alt p.find(~"tags") {
+    match p.find(~"tags") {
         some(json::list(js)) => {
           for (*js).each |j| {
-                alt j {
+                match j {
                     json::string(j) => vec::grow(tags, 1u, *j),
                     _ => ()
                 }
@@ -507,7 +507,7 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
         _ => ()
     }
 
-    let description = alt p.find(~"description") {
+    let description = match p.find(~"description") {
         some(json::string(n)) => *n,
         _ => {
             warn(~"malformed source json: " + src.name
@@ -527,7 +527,7 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
         versions: ~[]
     };
 
-    alt vec::position(src.packages, |pkg| pkg.uuid == uuid) {
+    match vec::position(src.packages, |pkg| pkg.uuid == uuid) {
       some(idx) => {
         src.packages[idx] = newpkg;
         log(debug, ~"  updated package: " + src.name + ~"/" + name);
@@ -545,7 +545,7 @@ fn load_source_info(c: cargo, src: source) {
     let srcfile = path::connect(dir, ~"source.json");
     if !os::path_exists(srcfile) { return; }
     let srcstr = io::read_whole_file_str(srcfile);
-    alt json::from_str(result::get(srcstr)) {
+    match json::from_str(result::get(srcstr)) {
         ok(json::dict(s)) => {
             let o = parse_source(src.name, json::dict(s));
 
@@ -567,10 +567,10 @@ fn load_source_packages(c: cargo, src: source) {
     let pkgfile = path::connect(dir, ~"packages.json");
     if !os::path_exists(pkgfile) { return; }
     let pkgstr = io::read_whole_file_str(pkgfile);
-    alt json::from_str(result::get(pkgstr)) {
+    match json::from_str(result::get(pkgstr)) {
         ok(json::list(js)) => {
           for (*js).each |j| {
-                alt j {
+                match j {
                     json::dict(p) => {
                         load_one_source_package(src, p);
                     }
@@ -592,7 +592,7 @@ fn load_source_packages(c: cargo, src: source) {
 }
 
 fn build_cargo_options(argv: ~[~str]) -> options {
-    let matches = alt getopts::getopts(argv, opts()) {
+    let matches = match getopts::getopts(argv, opts()) {
         result::ok(m) => m,
         result::err(f) => {
             fail fmt!{"%s", getopts::fail_str(f)};
@@ -623,12 +623,12 @@ fn build_cargo_options(argv: ~[~str]) -> options {
 }
 
 fn configure(opts: options) -> cargo {
-    let home = alt get_cargo_root() {
+    let home = match get_cargo_root() {
         ok(home) => home,
         err(_err) => result::get(get_cargo_sysroot())
     };
 
-    let get_cargo_dir = alt opts.mode {
+    let get_cargo_dir = match opts.mode {
         system_mode => get_cargo_sysroot,
         user_mode => get_cargo_root,
         local_mode => get_cargo_root_nearest
@@ -716,7 +716,7 @@ fn run_in_buildpath(what: ~str, path: ~str, subdir: ~str, cf: ~str,
 }
 
 fn test_one_crate(_c: cargo, path: ~str, cf: ~str) {
-  let buildpath = alt run_in_buildpath(~"testing", path, ~"/test", cf,
+  let buildpath = match run_in_buildpath(~"testing", path, ~"/test", cf,
                                        ~[ ~"--test"]) {
       none => return,
       some(bp) => bp
@@ -725,7 +725,7 @@ fn test_one_crate(_c: cargo, path: ~str, cf: ~str) {
 }
 
 fn install_one_crate(c: cargo, path: ~str, cf: ~str) {
-    let buildpath = alt run_in_buildpath(~"installing", path,
+    let buildpath = match run_in_buildpath(~"installing", path,
                                          ~"/build", cf, ~[]) {
       none => return,
       some(bp) => bp
@@ -752,7 +752,7 @@ fn install_one_crate(c: cargo, path: ~str, cf: ~str) {
 
 
 fn rustc_sysroot() -> ~str {
-    alt os::self_exe_path() {
+    match os::self_exe_path() {
         some(path) => {
             let path = ~[path, ~"..", ~"bin", ~"rustc"];
             let rustc = path::normalize(path::connect_many(path));
@@ -779,7 +779,7 @@ fn install_source(c: cargo, path: ~str) {
     }
 
     for cratefiles.each |cf| {
-        alt load_crate(cf) {
+        match load_crate(cf) {
             none => again,
             some(crate) => {
               for crate.deps.each |query| {
@@ -788,7 +788,7 @@ fn install_source(c: cargo, path: ~str) {
                     // condition")
 
                     let wd_base = c.workdir + path::path_sep();
-                    let wd = alt tempfile::mkdtemp(wd_base, ~"") {
+                    let wd = match tempfile::mkdtemp(wd_base, ~"") {
                         some(wd) => wd,
                         none => fail fmt!{"needed temp dir: %s", wd_base}
                     };
@@ -838,7 +838,7 @@ fn install_file(c: cargo, wd: ~str, path: ~str) {
 
 fn install_package(c: cargo, src: ~str, wd: ~str, pkg: package) {
     let url = copy pkg.url;
-    let method = alt pkg.method {
+    let method = match pkg.method {
         ~"git" => ~"git",
         ~"file" => ~"file",
         _ => ~"curl"
@@ -846,7 +846,7 @@ fn install_package(c: cargo, src: ~str, wd: ~str, pkg: package) {
 
     info(fmt!{"installing %s/%s via %s...", src, pkg.name, method});
 
-    alt method {
+    match method {
         ~"git" => install_git(c, wd, url, copy pkg.reference),
         ~"file" => install_file(c, wd, url),
         ~"curl" => install_curl(c, wd, copy url),
@@ -913,7 +913,7 @@ fn install_named(c: cargo, wd: ~str, name: ~str) {
 }
 
 fn install_uuid_specific(c: cargo, wd: ~str, src: ~str, uuid: ~str) {
-    alt c.sources.find(src) {
+    match c.sources.find(src) {
       some(s) => {
         let packages = copy s.packages;
         if vec::any(packages, |p| {
@@ -929,7 +929,7 @@ fn install_uuid_specific(c: cargo, wd: ~str, src: ~str, uuid: ~str) {
 }
 
 fn install_named_specific(c: cargo, wd: ~str, src: ~str, name: ~str) {
-    alt c.sources.find(src) {
+    match c.sources.find(src) {
         some(s) => {
           let packages = copy s.packages;
           if vec::any(packages, |p| {
@@ -960,7 +960,7 @@ fn cmd_uninstall(c: cargo) {
     // name only)
     if is_uuid(target) {
         for os::list_dir(lib).each |file| {
-            alt str::find_str(file, ~"-" + target + ~"-") {
+            match str::find_str(file, ~"-" + target + ~"-") {
                 some(idx) => {
                     let full = path::normalize(path::connect(lib, file));
                     if os::remove_file(full) {
@@ -977,7 +977,7 @@ fn cmd_uninstall(c: cargo) {
         error(~"can't find package with uuid: " + target);
     } else {
         for os::list_dir(lib).each |file| {
-            alt str::find_str(file, ~"lib" + target + ~"-") {
+            match str::find_str(file, ~"lib" + target + ~"-") {
                 some(idx) => {
                     let full = path::normalize(path::connect(lib,
                                file));
@@ -992,7 +992,7 @@ fn cmd_uninstall(c: cargo) {
             }
         }
         for os::list_dir(bin).each |file| {
-            alt str::find_str(file, target) {
+            match str::find_str(file, target) {
                 some(idx) => {
                     let full = path::normalize(path::connect(bin, file));
                     if os::remove_file(full) {
@@ -1011,7 +1011,7 @@ fn cmd_uninstall(c: cargo) {
 }
 
 fn install_query(c: cargo, wd: ~str, target: ~str) {
-    alt c.dep_cache.find(target) {
+    match c.dep_cache.find(target) {
         some(inst) => {
             if inst {
                 return;
@@ -1038,7 +1038,7 @@ fn install_query(c: cargo, wd: ~str, target: ~str) {
     } else {
         let mut ps = copy target;
 
-        alt str::find_char(ps, '/') {
+        match str::find_char(ps, '/') {
             option::some(idx) => {
                 let source = str::slice(ps, 0u, idx);
                 ps = str::slice(ps, idx + 1u, str::len(ps));
@@ -1072,7 +1072,7 @@ fn install_query(c: cargo, wd: ~str, target: ~str) {
 
 fn cmd_install(c: cargo) unsafe {
     let wd_base = c.workdir + path::path_sep();
-    let wd = alt tempfile::mkdtemp(wd_base, ~"") {
+    let wd = match tempfile::mkdtemp(wd_base, ~"") {
         some(wd) => wd,
         none => fail fmt!{"needed temp dir: %s", wd_base}
     };
@@ -1129,7 +1129,7 @@ fn sync_one_file(c: cargo, dir: ~str, src: source) -> bool {
     os::copy_file(path::connect(url, ~"source.json.sig"), srcsigfile);
     os::copy_file(path::connect(url, ~"packages.json.sig"), sigfile);
 
-    alt copy src.key {
+    match copy src.key {
         some(u) => {
             let p = run::program_output(~"curl",
                                         ~[~"-f", ~"-s", ~"-o", keyfile, u]);
@@ -1141,7 +1141,7 @@ fn sync_one_file(c: cargo, dir: ~str, src: source) -> bool {
         }
         _ => ()
     }
-    alt (src.key, src.keyfp) {
+    match (src.key, src.keyfp) {
         (some(_), some(f)) => {
             let r = pgp::verify(c.root, pkgfile, sigfile, f);
 
@@ -1238,7 +1238,7 @@ fn msg(name: ~str, insecure: bool) {
 
     let has_src_file = os::path_exists(srcfile);
 
-    alt copy src.key {
+    match copy src.key {
         some(u) => {
             let p = run::program_output(~"curl",
                                         ~[~"-f", ~"-s", ~"-o", keyfile, u]);
@@ -1251,7 +1251,7 @@ fn msg(name: ~str, insecure: bool) {
         }
         _ => ()
     }
-    alt (src.key, src.keyfp) {
+    match (src.key, src.keyfp) {
         (some(_), some(f)) => {
             let r = pgp::verify(c.root, pkgfile, sigfile, f);
 
@@ -1318,7 +1318,7 @@ fn sync_one_curl(c: cargo, dir: ~str, src: source) -> bool {
         }
     }
 
-    alt copy src.key {
+    match copy src.key {
         some(u) => {
             let p = run::program_output(~"curl",
                                         ~[~"-f", ~"-s", ~"-o", keyfile, u]);
@@ -1330,7 +1330,7 @@ fn sync_one_curl(c: cargo, dir: ~str, src: source) -> bool {
         }
         _ => ()
     }
-    alt (src.key, src.keyfp) {
+    match (src.key, src.keyfp) {
         (some(_), some(f)) => {
             if smart {
                 url = src.url + ~"/packages.json.sig";
@@ -1403,7 +1403,7 @@ fn sync_one(c: cargo, src: source) {
 
     need_dir(dir);
 
-    let result = alt src.method {
+    let result = match src.method {
         ~"git" => sync_one_git(c, dir, src),
         ~"file" => sync_one_file(c, dir, src),
         _ => sync_one_curl(c, dir, src)
@@ -1490,7 +1490,7 @@ fn cmd_list(c: cargo) {
             if !valid_pkg_name(name) {
                 error(fmt!{"'%s' is an invalid source name", name});
             } else {
-                alt c.sources.find(name) {
+                match c.sources.find(name) {
                     some(source) => {
                         print_source(source);
                     }
@@ -1562,7 +1562,7 @@ fn dump_sources(c: cargo) {
         copy_warn(out, path::connect(c.root, ~"sources.json.old"));
     }
 
-    alt io::buffered_file_writer(out) {
+    match io::buffered_file_writer(out) {
         result::ok(writer) => {
             let hash = map::str_hash();
             let root = json::dict(hash);
@@ -1574,13 +1574,13 @@ fn dump_sources(c: cargo) {
                 chash.insert(~"url", json::string(@v.url));
                 chash.insert(~"method", json::string(@v.method));
 
-                alt copy v.key {
+                match copy v.key {
                     some(key) => {
                         chash.insert(~"key", json::string(@key));
                     }
                     _ => ()
                 }
-                alt copy v.keyfp {
+                match copy v.keyfp {
                     some(keyfp) => {
                         chash.insert(~"keyfp", json::string(@keyfp));
                     }
@@ -1615,7 +1615,7 @@ fn cmd_sources(c: cargo) {
 
     let action = c.opts.free[2u];
 
-    alt action {
+    match action {
         ~"clear" => {
           for c.sources.each_key |k| {
                 c.sources.remove(k);
@@ -1637,7 +1637,7 @@ fn cmd_sources(c: cargo) {
                 return;
             }
 
-            alt c.sources.find(name) {
+            match c.sources.find(name) {
                 some(source) => {
                     error(fmt!{"source already exists: %s", name});
                 }
@@ -1667,7 +1667,7 @@ fn cmd_sources(c: cargo) {
                 return;
             }
 
-            alt c.sources.find(name) {
+            match c.sources.find(name) {
                 some(source) => {
                     c.sources.remove(name);
                     info(fmt!{"removed source: %s", name});
@@ -1691,7 +1691,7 @@ fn cmd_sources(c: cargo) {
                 return;
             }
 
-            alt c.sources.find(name) {
+            match c.sources.find(name) {
                 some(source) => {
                     let old = copy source.url;
                     let method = assume_source_method(url);
@@ -1722,11 +1722,11 @@ fn cmd_sources(c: cargo) {
                 return;
             }
 
-            alt c.sources.find(name) {
+            match c.sources.find(name) {
                 some(source) => {
                     let old = copy source.method;
 
-                    source.method = alt method {
+                    source.method = match method {
                         ~"git" => ~"git",
                         ~"file" => ~"file",
                         _ => ~"curl"
@@ -1760,7 +1760,7 @@ fn cmd_sources(c: cargo) {
                 return;
             }
 
-            alt c.sources.find(name) {
+            match c.sources.find(name) {
                 some(source) => {
                     c.sources.remove(name);
                     c.sources.insert(newn, source);
@@ -1874,7 +1874,7 @@ fn main(argv: ~[~str]) {
         return;
     }
     if o.help {
-        alt o.free[1] {
+        match o.free[1] {
             ~"init" => cmd_usage_init(),
             ~"install" => cmd_usage_install(),
             ~"uninstall" => cmd_usage_uninstall(),
@@ -1901,7 +1901,7 @@ fn main(argv: ~[~str]) {
         c = configure(o);
     }
 
-    alt o.free[1] {
+    match o.free[1] {
         ~"init" => cmd_init(c),
         ~"install" => cmd_install(c),
         ~"uninstall" => cmd_uninstall(c),
index 33b9655aeb2f0ef30adf6905858486c9d3591281..fd9a12aa1f7b66d2ed5c41106cbaeaa644a7093b 100644 (file)
@@ -37,7 +37,7 @@ fn parse_config(args: ~[~str]) -> config {
     assert (vec::is_not_empty(args));
     let args_ = vec::tail(args);
     let matches =
-        alt getopts::getopts(args_, opts) {
+        match getopts::getopts(args_, opts) {
           ok(m) => m,
           err(f) => fail getopts::fail_str(f)
         };
@@ -80,7 +80,7 @@ fn log_config(config: config) {
 }
 
 fn opt_str(maybestr: option<~str>) -> ~str {
-    alt maybestr { option::some(s) => s, option::none => ~"(none)" }
+    match maybestr { option::some(s) => s, option::none => ~"(none)" }
 }
 
 fn str_opt(maybestr: ~str) -> option<~str> {
@@ -88,7 +88,7 @@ fn str_opt(maybestr: ~str) -> option<~str> {
 }
 
 fn str_mode(s: ~str) -> mode {
-    alt s {
+    match s {
       ~"compile-fail" => mode_compile_fail,
       ~"run-fail" => mode_run_fail,
       ~"run-pass" => mode_run_pass,
@@ -98,7 +98,7 @@ fn str_mode(s: ~str) -> mode {
 }
 
 fn mode_str(mode: mode) -> ~str {
-    alt mode {
+    match mode {
       mode_compile_fail => ~"compile-fail",
       mode_run_fail => ~"run-fail",
       mode_run_pass => ~"run-pass",
@@ -115,13 +115,13 @@ fn run_tests(config: config) {
 
 fn test_opts(config: config) -> test::test_opts {
     {filter:
-         alt config.filter {
+         match config.filter {
            option::some(s) => option::some(s),
            option::none => option::none
          },
      run_ignored: config.run_ignored,
      logfile:
-         alt config.logfile {
+         match config.logfile {
            option::some(s) => option::some(s),
            option::none => option::none
          }
@@ -144,7 +144,7 @@ fn make_tests(config: config) -> ~[test::test_desc] {
 fn is_test(config: config, testfile: ~str) -> bool {
     // Pretty-printer does not work with .rc files yet
     let valid_extensions =
-        alt config.mode {
+        match config.mode {
           mode_pretty => ~[~".rs"],
           _ => ~[~".rc", ~".rs"]
         };
index 8a550e94c78a2f064e2752e1d6a37e8b898a2531..53599a9ad0e453b6350deb01b290338729f91868 100644 (file)
@@ -23,7 +23,7 @@ fn load_errors(testfile: ~str) -> ~[expected_error] {
 fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] unsafe {
     let error_tag = ~"//~";
     let mut idx;
-    alt str::find_str(line, error_tag) {
+    match str::find_str(line, error_tag) {
       option::none => return ~[],
       option::some(nn) => { idx = (nn as uint) + str::len(error_tag); }
     }
index 731e874ddcc77480d3ed9deb0f0a05c4f2d02ee2..bf58e809692592fe5b28331d9d41b0f7645a3b50 100644 (file)
@@ -30,7 +30,7 @@ fn load_props(testfile: ~str) -> test_props {
     let mut compile_flags = option::none;
     let mut pp_exact = option::none;
     for iter_header(testfile) |ln| {
-        alt parse_error_pattern(ln) {
+        match parse_error_pattern(ln) {
           option::some(ep) => vec::push(error_patterns, ep),
           option::none => ()
         };
@@ -107,7 +107,7 @@ fn parse_exec_env(line: ~str) -> option<(~str, ~str)> {
     do parse_name_value_directive(line, ~"exec-env").map |nv| {
         // nv is either FOO or FOO=BAR
         let strs = str::splitn_char(nv, '=', 1u);
-        alt strs.len() {
+        match strs.len() {
           1u => (strs[0], ~""),
           2u => (strs[0], strs[1]),
           n => fail fmt!{"Expected 1 or 2 strings, not %u", n}
@@ -116,7 +116,7 @@ fn parse_exec_env(line: ~str) -> option<(~str, ~str)> {
 }
 
 fn parse_pp_exact(line: ~str, testfile: ~str) -> option<~str> {
-    alt parse_name_value_directive(line, ~"pp-exact") {
+    match parse_name_value_directive(line, ~"pp-exact") {
       option::some(s) => option::some(s),
       option::none => {
         if parse_name_directive(line, ~"pp-exact") {
@@ -135,7 +135,7 @@ fn parse_name_directive(line: ~str, directive: ~str) -> bool {
 fn parse_name_value_directive(line: ~str,
                               directive: ~str) -> option<~str> unsafe {
     let keycolon = directive + ~":";
-    alt str::find_str(line, keycolon) {
+    match str::find_str(line, keycolon) {
         option::some(colon) => {
             let value = str::slice(line, colon + str::len(keycolon),
                                    str::len(line));
index a8418a545a29fb9035bc76c6cd73c857f3bfecb6..ba4249999a471750a66d70ee7bb4ab1d371fb7fd 100644 (file)
@@ -76,7 +76,7 @@ fn run(lib_path: ~str,
     let mut outs = ~"";
     let mut count = 2;
     while count > 0 {
-        alt p.recv() {
+        match p.recv() {
           (1, s) => {
             outs = s;
           }
index 79b7e6f08d461cc9709132bad37f019916de6ca1..7a2d3456ed685abfeaf8d6376d121b893f1929a9 100644 (file)
@@ -18,7 +18,7 @@ fn run(config: config, testfile: ~str) {
     }
     debug!{"running %s", testfile};
     let props = load_props(testfile);
-    alt config.mode {
+    match config.mode {
       mode_compile_fail => run_cfail_test(config, props, testfile),
       mode_run_fail => run_rfail_test(config, props, testfile),
       mode_run_pass => run_rpass_test(config, props, testfile),
@@ -90,7 +90,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: ~str) {
     } else { logv(config, ~"testing for converging pretty-printing"); }
 
     let rounds =
-        alt props.pp_exact { option::some(_) => 1, option::none => 2 };
+        match props.pp_exact { option::some(_) => 1, option::none => 2 };
 
     let mut srcs = ~[result::get(io::read_whole_file_str(testfile))];
 
@@ -109,7 +109,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: ~str) {
     }
 
     let mut expected =
-        alt props.pp_exact {
+        match props.pp_exact {
           option::some(file) => {
             let filepath = path::connect(path::dirname(testfile), file);
             result::get(io::read_whole_file_str(filepath))
@@ -383,7 +383,7 @@ fn make_run_args(config: config, _props: test_props, testfile: ~str) ->
             // If we've got another tool to run under (valgrind),
             // then split apart its command
             let runtool =
-                alt config.runtool {
+                match config.runtool {
                   option::some(s) => option::some(s),
                   option::none => option::none
                 };
@@ -402,7 +402,7 @@ fn flt(&&s: ~str) -> option<~str> {
         vec::filter_map(v, flt)
     }
 
-    alt argstr {
+    match argstr {
       option::some(s) => rm_whitespace(str::split_char(s, ' ')),
       option::none => ~[]
     }
index 027d247ebb8f8b019e36688ef49fb8cbbe246e7d..0c7a0235bee92c22127387d548d1abf59b74214a 100644 (file)
@@ -7,7 +7,7 @@ fn make_new_path(path: ~str) -> ~str {
 
     // Windows just uses PATH as the library search path, so we have to
     // maintain the current value while adding our own
-    alt getenv(lib_path_env_var()) {
+    match getenv(lib_path_env_var()) {
       option::some(curr) => {
         fmt!{"%s%s%s", path, path_div(), curr}
       }
index 1cc0c08eb5c9b00e3803bd5b7b6dd94100025584..230ef3d981f6a4246930428b7f51916dfb694513 100644 (file)
@@ -62,9 +62,9 @@ fn dsl(l: ast::lit_) -> ast::lit {
 }
 
 pure fn safe_to_use_expr(e: ast::expr, tm: test_mode) -> bool {
-    alt tm {
+    match tm {
       tm_converge => {
-        alt e.node {
+        match e.node {
           // If the fuzzer moves a block-ending-in-semicolon into callee
           // position, the pretty-printer can't preserve this even by
           // parenthesizing!!  See email to marijn.
@@ -139,7 +139,7 @@ fn steal(crate: ast::crate, tm: test_mode) -> stolen_stuff {
 
 
 fn safe_to_replace_expr(e: ast::expr_, _tm: test_mode) -> bool {
-    alt e {
+    match e {
       // https://github.com/mozilla/rust/issues/652
       ast::expr_if(*) => { false }
       ast::expr_block(_) => { false }
@@ -152,7 +152,7 @@ fn safe_to_replace_expr(e: ast::expr_, _tm: test_mode) -> bool {
 }
 
 fn safe_to_replace_ty(t: ast::ty_, _tm: test_mode) -> bool {
-    alt t {
+    match t {
       ast::ty_infer => { false } // always implicit, always top level
       ast::ty_bot => { false }   // in source, can only appear
                               // as the out type of a function
@@ -272,7 +272,7 @@ fn check_variants_T<T: copy>(
                         io::str_reader(~""), a,
                         pprust::no_ann(),
                         false));
-                alt cx.mode {
+                match cx.mode {
                   tm_converge => {
                     check_roundtrip_convergence(str3, 1u);
                   }
@@ -314,12 +314,12 @@ fn check_whole_compiler(code: ~str, suggested_filename_prefix: ~str,
 
     let compile_result = check_compiling(filename);
 
-    let run_result = alt (compile_result, allow_running) {
+    let run_result = match (compile_result, allow_running) {
       (passed, true) => { check_running(suggested_filename_prefix) }
       (h, _) => { h }
     };
 
-    alt run_result {
+    match run_result {
       passed | cleanly_rejected(_) | known_bug(_) => {
         removeIfExists(suggested_filename_prefix);
         removeIfExists(suggested_filename_prefix + ~".rs");
@@ -364,7 +364,7 @@ fn check_running(exe_filename: ~str) -> happiness {
     } else if contains(comb, ~"malloc") {
         failed(~"Mentioned malloc")
     } else {
-        alt p.status {
+        match p.status {
             0         => { passed }
             100       => { cleanly_rejected(~"running: explicit fail") }
             101 | 247 => { cleanly_rejected(~"running: timed out") }
@@ -441,7 +441,7 @@ fn parse_and_print(code: @~str) -> ~str {
 fn has_raw_pointers(c: ast::crate) -> bool {
     let has_rp = @mut false;
     fn visit_ty(flag: @mut bool, t: @ast::ty) {
-        alt t.node {
+        match t.node {
           ast::ty_ptr(_) => { *flag = true; }
           _ => { }
         }
index 91b268bc70371a2c2bab1803aa912ea2794275f1..f8eb96996d0760b663068e07e75bce2505951200 100644 (file)
@@ -39,7 +39,7 @@
 
 /// Parse logic value from `s`
 pure fn from_str(s: ~str) -> option<bool> {
-    alt check s {
+    match check s {
       ~"true" => some(true),
       ~"false" => some(false),
       _ => none
index 97a484b491f7ccf3cbc8b774a81f40370ab47472..98aeddcf27322bfe00cc774b6d5b2a6a879d7c6f 100644 (file)
  * refer to a digit in the given radix.
  */
 pure fn to_digit(c: char, radix: uint) -> option<uint> {
-    let val = alt c {
+    let val = match c {
       '0' to '9' => c as uint - ('0' as uint),
       'a' to 'z' => c as uint + 10u - ('a' as uint),
       'A' to 'Z' => c as uint + 10u - ('A' as uint),
@@ -158,7 +158,7 @@ fn escape_unicode(c: char) -> ~str {
  *   - Any other chars are given hex unicode escapes; see `escape_unicode`.
  */
 fn escape_default(c: char) -> ~str {
-    alt c {
+    match c {
       '\t' => ~"\\t",
       '\r' => ~"\\r",
       '\n' => ~"\\n",
index 86bcfad89ddae59d902e9ec5e66aac9521b8bbb6..794bdc90885891c0182f8d237d58d3b045957ffd 100644 (file)
@@ -409,7 +409,7 @@ fn test_select2_stress() {
     let mut as = 0;
     let mut bs = 0;
     for iter::repeat(msgs * times * 2u) {
-        alt check select2(po_a, po_b) {
+        match check select2(po_a, po_b) {
           either::left(~"a") => as += 1,
           either::right(~"b") => bs += 1
         }
index 7b9d4432e5447604249f9d7df7451038d59f12fd..9d410c03d6ae9d4e7fa15e97e5cb16b5503848ea 100644 (file)
@@ -26,8 +26,8 @@ enum dlist<T> = @{
 
 impl private_methods<T> for dlist_node<T> {
     pure fn assert_links() {
-        alt self.next {
-            some(neighbour) => alt neighbour.prev {
+        match self.next {
+            some(neighbour) => match neighbour.prev {
               some(me) => if !box::ptr_eq(*self, *me) {
                   fail ~"Asymmetric next-link in dlist node."
               }
@@ -35,8 +35,8 @@ impl private_methods<T> for dlist_node<T> {
             }
             none => ()
         }
-        alt self.prev {
-            some(neighbour) => alt neighbour.next {
+        match self.prev {
+            some(neighbour) => match neighbour.next {
               some(me) => if !box::ptr_eq(*me, *self) {
                   fail ~"Asymmetric prev-link in dlist node."
               }
@@ -55,7 +55,7 @@ impl extensions<T> for dlist_node<T> {
     }
     /// Get the next node in the list, failing if there isn't one.
     pure fn next_node() -> dlist_node<T> {
-        alt self.next_link() {
+        match self.next_link() {
             some(nobe) => nobe,
             none       => fail ~"This dlist node has no next neighbour."
         }
@@ -67,7 +67,7 @@ impl extensions<T> for dlist_node<T> {
     }
     /// Get the previous node in the list, failing if there isn't one.
     pure fn prev_node() -> dlist_node<T> {
-        alt self.prev_link() {
+        match self.prev_link() {
             some(nobe) => nobe,
             none       => fail ~"This dlist node has no previous neighbour."
         }
@@ -138,11 +138,11 @@ fn make_mine(nobe: dlist_node<T>) {
     // the head and/or tail pointers appropriately.
     #[inline(always)]
     fn link(+before: dlist_link<T>, +after: dlist_link<T>) {
-        alt before {
+        match before {
             some(neighbour) => neighbour.next = after,
             none            => self.hd        = after
         }
-        alt after {
+        match after {
             some(neighbour) => neighbour.prev = before,
             none            => self.tl        = before
         }
@@ -286,14 +286,14 @@ fn pop_tail_n() -> option<dlist_node<T>> {
 
     /// Get the node at the list's head, failing if empty. O(1).
     pure fn head_n() -> dlist_node<T> {
-        alt self.hd {
+        match self.hd {
             some(nobe) => nobe,
             none       => fail ~"Attempted to get the head of an empty dlist."
         }
     }
     /// Get the node at the list's tail, failing if empty. O(1).
     pure fn tail_n() -> dlist_node<T> {
-        alt self.tl {
+        match self.tl {
             some(nobe) => nobe,
             none       => fail ~"Attempted to get the tail of an empty dlist."
         }
index 4f1e02d674d1e343407fb47bafb79273bae28f11..a05df4e608ae212037f4baeaf923995bf5ae8887 100644 (file)
@@ -222,7 +222,7 @@ fn push_slice(ts: &[const A], from_idx: uint, to_idx: uint) {
      */
     fn append_iter<A, I:iter::base_iter<A>>(ts: I) {
         do self.swap |v| {
-           let mut v = alt ts.size_hint() {
+           let mut v = match ts.size_hint() {
              none { v }
              some(h) {
                let len = v.len() + h;
index d07b126bb5d646e3c071cccd4a0a4a65f3e342e4..06999513889326d42354b35cefb6970062eb311c 100644 (file)
@@ -18,7 +18,7 @@ fn either<T, U, V>(f_left: fn(T) -> V,
      * result is returned.
      */
 
-    alt value {
+    match value {
       left(l) => f_left(l),
       right(r) => f_right(r)
     }
@@ -29,7 +29,7 @@ fn lefts<T: copy, U>(eithers: ~[either<T, U>]) -> ~[T] {
 
     let mut result: ~[T] = ~[];
     for vec::each(eithers) |elt| {
-        alt elt {
+        match elt {
           left(l) => vec::push(result, l),
           _ => { /* fallthrough */ }
         }
@@ -42,7 +42,7 @@ fn rights<T, U: copy>(eithers: ~[either<T, U>]) -> ~[U] {
 
     let mut result: ~[U] = ~[];
     for vec::each(eithers) |elt| {
-        alt elt {
+        match elt {
           right(r) => vec::push(result, r),
           _ => { /* fallthrough */ }
         }
@@ -62,7 +62,7 @@ fn partition<T: copy, U: copy>(eithers: ~[either<T, U>])
     let mut lefts: ~[T] = ~[];
     let mut rights: ~[U] = ~[];
     for vec::each(eithers) |elt| {
-        alt elt {
+        match elt {
           left(l) => vec::push(lefts, l),
           right(r) => vec::push(rights, r)
         }
@@ -73,7 +73,7 @@ fn partition<T: copy, U: copy>(eithers: ~[either<T, U>])
 pure fn flip<T: copy, U: copy>(eith: either<T, U>) -> either<U, T> {
     //! Flips between left and right of a given either
 
-    alt eith {
+    match eith {
       right(r) => left(r),
       left(l) => right(l)
     }
@@ -88,7 +88,7 @@ fn partition<T: copy, U: copy>(eithers: ~[either<T, U>])
      * an ok result, and the "left" choice a fail
      */
 
-    alt eith {
+    match eith {
       right(r) => result::ok(r),
       left(l) => result::err(l)
     }
@@ -97,13 +97,13 @@ fn partition<T: copy, U: copy>(eithers: ~[either<T, U>])
 pure fn is_left<T, U>(eith: either<T, U>) -> bool {
     //! Checks whether the given value is a left
 
-    alt eith { left(_) => true, _ => false }
+    match eith { left(_) => true, _ => false }
 }
 
 pure fn is_right<T, U>(eith: either<T, U>) -> bool {
     //! Checks whether the given value is a right
 
-    alt eith { right(_) => true, _ => false }
+    match eith { right(_) => true, _ => false }
 }
 
 #[test]
index 251bc2d18e19d69f7fa8f35278e66e053c269710..fba8968103c392d39f0aed54090d80e8d55cc761 100644 (file)
@@ -122,7 +122,7 @@ fn peek_num(s: ~str, i: uint, lim: uint) ->
         let c = s[i];
         if !('0' as u8 <= c && c <= '9' as u8) { return option::none; }
         let n = (c - ('0' as u8)) as uint;
-        return alt peek_num(s, i + 1u, lim) {
+        return match peek_num(s, i + 1u, lim) {
               none => some({num: n, next: i + 1u}),
               some(next) => {
                 let m = next.num;
@@ -150,7 +150,7 @@ fn parse_parameter(s: ~str, i: uint, lim: uint) ->
        {param: option<int>, next: uint} {
         if i >= lim { return {param: none, next: i}; }
         let num = peek_num(s, i, lim);
-        return alt num {
+        return match num {
               none => {param: none, next: i},
               some(t) => {
                 let n = t.num;
@@ -195,13 +195,13 @@ fn parse_count(s: ~str, i: uint, lim: uint)
             } else if s[i] == '*' as u8 {
                 let param = parse_parameter(s, i + 1u, lim);
                 let j = param.next;
-                alt param.param {
+                match param.param {
                   none => {count: count_is_next_param, next: j},
                   some(n) => {count: count_is_param(n), next: j}
                 }
             } else {
                 let num = peek_num(s, i, lim);
-                alt num {
+                match num {
                   none => {count: count_implied, next: i},
                   some(num) => {
                     count: count_is(num.num as int),
@@ -220,7 +220,7 @@ fn parse_precision(s: ~str, i: uint, lim: uint) ->
 
                 // If there were no digits specified, i.e. the precision
                 // was ".", then the precision is 0
-                alt count.count {
+                match count.count {
                   count_implied => {count: count_is(0), next: count.next},
                   _ => count
                 }
@@ -294,7 +294,7 @@ enum ty { ty_default, ty_bits, ty_hex_upper, ty_hex_lower, ty_octal, }
     pure fn conv_uint(cv: conv, u: uint) -> ~str {
         let prec = get_int_precision(cv);
         let mut rs =
-            alt cv.ty {
+            match cv.ty {
               ty_default => uint_to_str_prec(u, 10u, prec),
               ty_hex_lower => uint_to_str_prec(u, 16u, prec),
               ty_hex_upper => str::to_upper(uint_to_str_prec(u, 16u, prec)),
@@ -316,7 +316,7 @@ enum ty { ty_default, ty_bits, ty_hex_upper, ty_hex_lower, ty_octal, }
     pure fn conv_str(cv: conv, s: &str) -> ~str {
         // For strings, precision is the maximum characters
         // displayed
-        let mut unpadded = alt cv.precision {
+        let mut unpadded = match cv.precision {
           count_implied => s.to_unique(),
           count_is(max) => if max as uint < str::char_len(s) {
             str::substr(s, 0u, max as uint)
@@ -327,7 +327,7 @@ enum ty { ty_default, ty_bits, ty_hex_upper, ty_hex_lower, ty_octal, }
         return unchecked { pad(cv, unpadded, pad_nozero) };
     }
     pure fn conv_float(cv: conv, f: float) -> ~str {
-        let (to_str, digits) = alt cv.precision {
+        let (to_str, digits) = match cv.precision {
               count_is(c) => (float::to_str_exact, c as uint),
               count_implied => (float::to_str, 6u)
         };
@@ -371,14 +371,14 @@ enum ty { ty_default, ty_bits, ty_hex_upper, ty_hex_lower, ty_octal, }
             };
     }
     pure fn get_int_precision(cv: conv) -> uint {
-        return alt cv.precision {
+        return match cv.precision {
               count_is(c) => c as uint,
               count_implied => 1u
             };
     }
     enum pad_mode { pad_signed, pad_unsigned, pad_nozero, pad_float }
     fn pad(cv: conv, &s: ~str, mode: pad_mode) -> ~str {
-        let uwidth : uint = alt cv.width {
+        let uwidth : uint = match cv.width {
           count_implied => return s,
           count_is(width) => {
               // FIXME: width should probably be uint (see Issue #1996)
@@ -393,14 +393,14 @@ fn pad(cv: conv, &s: ~str, mode: pad_mode) -> ~str {
             let padstr = str::from_chars(vec::from_elem(diff, padchar));
             return s + padstr;
         }
-        let {might_zero_pad, signed} = alt mode {
+        let {might_zero_pad, signed} = match mode {
           pad_nozero => {might_zero_pad:false, signed:false},
           pad_signed => {might_zero_pad:true,  signed:true },
           pad_float => {might_zero_pad:true,  signed:true},
           pad_unsigned => {might_zero_pad:true,  signed:false}
         };
         pure fn have_precision(cv: conv) -> bool {
-            return alt cv.precision { count_implied => false, _ => true };
+            return match cv.precision { count_implied => false, _ => true };
         }
         let zero_padding = {
             if might_zero_pad && have_flag(cv.flags, flag_left_zero_pad) &&
index 02133205be9178289096da996d992d77c8c93a4c..4269ef41f4db696f419382fa406dc6693d8638da 100644 (file)
@@ -256,14 +256,14 @@ fn from_str(num: ~str) -> option<float> {
    let mut c     = 'z';            //Latest char.
 
    //The string must start with one of the following characters.
-   alt str::char_at(num, 0u) {
+   match str::char_at(num, 0u) {
       '-' | '+' | '0' to '9' | '.' => (),
       _ => return none
    }
 
    //Determine if first char is '-'/'+'. Set [pos] and [neg] accordingly.
    let mut neg = false;               //Sign of the result
-   alt str::char_at(num, 0u) {
+   match str::char_at(num, 0u) {
       '-' => {
           neg = true;
           pos = 1u;
@@ -279,7 +279,7 @@ fn from_str(num: ~str) -> option<float> {
        let char_range = str::char_range_at(num, pos);
        c   = char_range.ch;
        pos = char_range.next;
-       alt c {
+       match c {
          '0' to '9' => {
            total = total * 10f;
            total += ((c as int) - ('0' as int)) as float;
@@ -295,7 +295,7 @@ fn from_str(num: ~str) -> option<float> {
          let char_range = str::char_range_at(num, pos);
          c = char_range.ch;
          pos = char_range.next;
-         alt c {
+         match c {
             '0' | '1' | '2' | '3' | '4' | '5' | '6'| '7' | '8' | '9'  => {
                  decimal /= 10f;
                  total += (((c as int) - ('0' as int)) as float)*decimal;
@@ -312,7 +312,7 @@ fn from_str(num: ~str) -> option<float> {
       if(pos < len) {
           let char_range = str::char_range_at(num, pos);
           c   = char_range.ch;
-          alt c  {
+          match c  {
              '+' => {
                 pos = char_range.next;
              }
@@ -325,7 +325,7 @@ fn from_str(num: ~str) -> option<float> {
           while(pos < len) {
              let char_range = str::char_range_at(num, pos);
              c = char_range.ch;
-             alt c {
+             match c {
                  '0' | '1' | '2' | '3' | '4' | '5' | '6'| '7' | '8' | '9' => {
                      exponent *= 10u;
                      exponent += ((c as uint) - ('0' as uint));
@@ -447,7 +447,7 @@ fn test_from_str() {
    assert from_str(~"inf") == some(infinity);
    assert from_str(~"-inf") == some(neg_infinity);
    // note: NaN != NaN, hence this slightly complex test
-   alt from_str(~"NaN") {
+   match from_str(~"NaN") {
        some(f) => assert is_NaN(f),
        none => fail
    }
index 1f6b259c46702e012f998287f30e5f2a36aebdac..8b7b51eef58dc7b378e0e50353d82a934b17ca1d 100644 (file)
@@ -77,7 +77,7 @@ fn from_port<A:send>(-port: future_pipe::client::waiting<A>) -> future<A> {
         let mut port_ = none;
         port_ <-> *port;
         let port = option::unwrap(port_);
-        alt recv(port) {
+        match recv(port) {
           future_pipe::completed(data) => move_it!{data}
         }
     }
@@ -119,7 +119,7 @@ fn get<A:copy>(future: future<A>) -> A {
 fn with<A,B>(future: future<A>, blk: fn(A) -> B) -> B {
     //! Work with the value without copying it
 
-    let v = alt copy future.v {
+    let v = match copy future.v {
       either::left(v) => v,
       either::right(f) => {
         let v = @f();
index 02ef14c5366771f96c42a50e5297866254459371..897f4030a47fa88785f31b2ccc2a0b295efb3f4a 100644 (file)
@@ -144,7 +144,7 @@ fn parse_buf(buf: ~[u8], radix: uint) -> option<T> {
     }
     let mut n = 0 as T;
     loop {
-        alt char::to_digit(buf[i] as char, radix) {
+        match char::to_digit(buf[i] as char, radix) {
           some(d) => n += (d as T) * power,
           none => return none
         }
index cf2c51625d86829c73bf681d999a9fb684e892ee..2946700f83265facd2ff781121c1afe5980546a5 100644 (file)
@@ -196,7 +196,7 @@ fn each_line(it: fn(~str) -> bool) {
 // Reader implementations
 
 fn convert_whence(whence: seek_style) -> i32 {
-    return alt whence {
+    return match whence {
       seek_set => 0i32,
       seek_cur => 1i32,
       seek_end => 2i32
@@ -440,7 +440,7 @@ fn wb() -> c_int { O_WRONLY as c_int }
 
     let mut fflags: c_int = wb();
     for vec::each(flags) |f| {
-        alt f {
+        match f {
           append => fflags |= O_APPEND as c_int,
           create => fflags |= O_CREAT as c_int,
           truncate => fflags |= O_TRUNC as c_int,
@@ -460,7 +460,7 @@ fn wb() -> c_int { O_WRONLY as c_int }
 
 fn u64_to_le_bytes<T>(n: u64, size: uint, f: fn(v: &[u8]) -> T) -> T {
     assert size <= 8u;
-    alt size {
+    match size {
       1u => f(&[n as u8]),
       2u => f(&[n as u8,
               (n >> 8) as u8]),
@@ -491,7 +491,7 @@ fn u64_to_le_bytes<T>(n: u64, size: uint, f: fn(v: &[u8]) -> T) -> T {
 
 fn u64_to_be_bytes<T>(n: u64, size: uint, f: fn(v: &[u8]) -> T) -> T {
     assert size <= 8u;
-    alt size {
+    match size {
       1u => f(&[n as u8]),
       2u => f(&[(n >> 8) as u8,
               n as u8]),
@@ -717,7 +717,7 @@ fn seek_in_buf(offset: int, pos: uint, len: uint, whence: seek_style) ->
    uint {
     let mut bpos = pos as int;
     let blen = len as int;
-    alt whence {
+    match whence {
       seek_set => bpos = offset,
       seek_cur => bpos += offset,
       seek_end => bpos = blen + offset
@@ -767,7 +767,7 @@ enum level {
         let arg: arg<t>;
         new(-arg: arg<t>) { self.arg <- arg; }
         drop {
-          alt self.arg.opt_level {
+          match self.arg.opt_level {
             option::none => (),
             option::some(level) => {
               // fail hard if not succesful
@@ -891,7 +891,7 @@ fn test_readchar_empty() {
 
     #[test]
     fn file_reader_not_exist() {
-        alt io::file_reader(~"not a file") {
+        match io::file_reader(~"not a file") {
           result::err(e) => {
             assert e == ~"error opening not a file";
           }
@@ -901,7 +901,7 @@ fn file_reader_not_exist() {
 
     #[test]
     fn file_writer_bad_name() {
-        alt io::file_writer(~"?/?", ~[]) {
+        match io::file_writer(~"?/?", ~[]) {
           result::err(e) => {
             assert str::starts_with(e, ~"error opening ?/?");
           }
@@ -911,7 +911,7 @@ fn file_writer_bad_name() {
 
     #[test]
     fn buffered_file_writer_bad_name() {
-        alt io::buffered_file_writer(~"?/?") {
+        match io::buffered_file_writer(~"?/?") {
           result::err(e) => {
             assert e == ~"error opening ?/?";
           }
index a150afa36e1bc477615acf2f7810f593bdf2bab6..2bcb7bba56ef9a3bdb0dcc6868d8e7df3758df07 100644 (file)
@@ -1,14 +1,14 @@
 type IMPL_T<A> = option<A>;
 
 pure fn EACH<A>(self: IMPL_T<A>, f: fn(A) -> bool) {
-    alt self {
+    match self {
       none => (),
       some(a) => { f(a); }
     }
 }
 
 fn SIZE_HINT<A>(self: IMPL_T<A>) -> option<uint> {
-    alt self {
+    match self {
       none => some(0u),
       some(_) => some(1u)
     }
index 541c19aa3a527153624e1729ad45ac7b7e782fcc..2cb3369dbc7c99ccf36242e26a7823d0865ddef4 100644 (file)
@@ -134,8 +134,8 @@ fn repeat(times: uint, blk: fn() -> bool) {
 }
 
 fn min<A:copy,IA:base_iter<A>>(self: IA) -> A {
-    alt do foldl::<A,option<A>,IA>(self, none) |a, b| {
-        alt a {
+    match do foldl::<A,option<A>,IA>(self, none) |a, b| {
+        match a {
           some(a_) if a_ < b => {
             // FIXME (#2005): Not sure if this is successfully optimized to
             // a move
@@ -150,8 +150,8 @@ fn min<A:copy,IA:base_iter<A>>(self: IA) -> A {
 }
 
 fn max<A:copy,IA:base_iter<A>>(self: IA) -> A {
-    alt do foldl::<A,option<A>,IA>(self, none) |a, b| {
-        alt a {
+    match do foldl::<A,option<A>,IA>(self, none) |a, b| {
+        match a {
           some(a_) if a_ > b => {
             // FIXME (#2005): Not sure if this is successfully optimized to
             // a move.
index b2ae670ec0552609ea5b11d1c627a1cd6d9e37c4..d64b89c2f04a19f0c2731bdafb2ac097007fb298 100644 (file)
@@ -23,7 +23,7 @@ enum option<T> {
      * Fails if the value equals `none`
      */
 
-    alt opt {
+    match opt {
       some(x) => return x,
       none => fail ~"option::get none"
     }
@@ -37,13 +37,13 @@ enum option<T> {
 
     Fails if the value equals `none`
     "];
-    alt opt { some(x) => x, none => fail reason }
+    match opt { some(x) => x, none => fail reason }
 }
 
 pure fn map<T, U>(opt: option<T>, f: fn(T) -> U) -> option<U> {
     //! Maps a `some` value from one type to another
 
-    alt opt { some(x) => some(f(x)), none => none }
+    match opt { some(x) => some(f(x)), none => none }
 }
 
 pure fn map_consume<T, U>(-opt: option<T>, f: fn(-T) -> U) -> option<U> {
@@ -60,7 +60,7 @@ enum option<T> {
      * function that returns an option.
      */
 
-    alt opt { some(x) => f(x), none => none }
+    match opt { some(x) => f(x), none => none }
 }
 
 #[inline(always)]
@@ -76,7 +76,7 @@ enum option<T> {
 pure fn is_none<T>(opt: option<T>) -> bool {
     //! Returns true if the option equals `none`
 
-    alt opt { none => true, some(_) => false }
+    match opt { none => true, some(_) => false }
 }
 
 pure fn is_some<T>(opt: option<T>) -> bool {
@@ -88,19 +88,19 @@ enum option<T> {
 pure fn get_default<T: copy>(opt: option<T>, def: T) -> T {
     //! Returns the contained value or a default
 
-    alt opt { some(x) => x, none => def }
+    match opt { some(x) => x, none => def }
 }
 
 pure fn map_default<T, U>(opt: option<T>, +def: U, f: fn(T) -> U) -> U {
     //! Applies a function to the contained value or returns a default
 
-    alt opt { none => def, some(t) => f(t) }
+    match opt { none => def, some(t) => f(t) }
 }
 
 pure fn iter<T>(opt: option<T>, f: fn(T)) {
     //! Performs an operation on the contained value or does nothing
 
-    alt opt { none => (), some(t) => f(t) }
+    match opt { none => (), some(t) => f(t) }
 }
 
 #[inline(always)]
@@ -113,7 +113,7 @@ enum option<T> {
      */
 
     unsafe {
-        let addr = alt opt {
+        let addr = match opt {
           some(x) => ptr::addr_of(x),
           none => fail ~"option::unwrap none"
         };
index fba4e7acac5d464891b34277cc301ff2cda3d548..07bbff42b94209b31b7627529d3ae55b031e2ce7 100644 (file)
@@ -178,7 +178,7 @@ fn global_env_task(msg_po: comm::port<msg>) {
         unsafe {
             do priv::weaken_task |weak_po| {
                 loop {
-                    alt comm::select2(msg_po, weak_po) {
+                    match comm::select2(msg_po, weak_po) {
                       either::left(msg_getenv(n, resp_ch)) => {
                         comm::send(resp_ch, impl::getenv(n))
                       }
@@ -282,7 +282,7 @@ fn fsync_fd(fd: c_int, _level: io::fsync::level) -> c_int {
 #[cfg(target_os = "linux")]
 fn fsync_fd(fd: c_int, level: io::fsync::level) -> c_int {
     import libc::funcs::posix01::unistd::*;
-    alt level {
+    match level {
       io::fsync::fsync
       | io::fsync::fullfsync => return fsync(fd),
       io::fsync::fdatasync => return fdatasync(fd)
@@ -294,7 +294,7 @@ fn fsync_fd(fd: c_int, level: io::fsync::level) -> c_int {
     import libc::consts::os::extra::*;
     import libc::funcs::posix88::fcntl::*;
     import libc::funcs::posix01::unistd::*;
-    alt level {
+    match level {
       io::fsync::fsync => return fsync(fd),
       _ => {
         // According to man fnctl, the ok retval is only specified to be !=-1
@@ -440,7 +440,7 @@ fn load_self() -> option<path> {
  * Otherwise, homedir returns option::none.
  */
 fn homedir() -> option<path> {
-    return alt getenv(~"HOME") {
+    return match getenv(~"HOME") {
         some(p) => if !str::is_empty(p) {
           some(p)
         } else {
index dc541b14a4bbf3042e7213d699c4935b580c69f1..1f239605131d05cb632bfc0a3c2ce85bec3b5c43 100644 (file)
@@ -61,7 +61,7 @@ fn path_is_absolute(p: ~str) -> bool {
 fn path_sep() -> ~str { return str::from_char(consts::path_sep); }
 
 fn split_dirname_basename (pp: path) -> {dirname: ~str, basename: ~str} {
-    alt str::rfind(pp, |ch|
+    match str::rfind(pp, |ch|
         ch == consts::path_sep || ch == consts::alt_path_sep
     ) {
       some(i) => {
index ce72a6edca92bc0ca2b5a99c4c8b6a279506c1af..33ee3cc52fb858410e235c79a759e81d80a4c728 100644 (file)
@@ -136,7 +136,7 @@ unsafe fn mark_blocked(this: *rust_task) -> state {
     unsafe fn unblock() {
         let old_task = swap_task(self.blocked_task, ptr::null());
         if !old_task.is_null() { rustrt::rust_task_deref(old_task) }
-        alt swap_state_acq(self.state, empty) {
+        match swap_state_acq(self.state, empty) {
           empty | blocked => (),
           terminated => self.state = terminated,
           full => self.state = full
@@ -345,7 +345,7 @@ fn send<T: send, Tbuffer: send>(-p: send_packet_buffered<T, Tbuffer>,
     assert p.payload == none;
     p.payload <- some(payload);
     let old_state = swap_state_rel(p.header.state, full);
-    alt old_state {
+    match old_state {
       empty => {
         // Yay, fastpath.
 
@@ -403,7 +403,7 @@ fn try_recv<T: send, Tbuffer: send>(-p: recv_packet_buffered<T, Tbuffer>)
         rustrt::task_clear_event_reject(this);
         let old_state = swap_state_acq(p.header.state,
                                        blocked);
-        alt old_state {
+        match old_state {
           empty => {
             debug!{"no data available on %?, going to sleep.", p_};
             if count == 0 {
@@ -451,7 +451,7 @@ fn try_recv<T: send, Tbuffer: send>(-p: recv_packet_buffered<T, Tbuffer>)
 
 /// Returns true if messages are available.
 pure fn peek<T: send, Tb: send>(p: recv_packet_buffered<T, Tb>) -> bool {
-    alt unsafe {(*p.header()).state} {
+    match unsafe {(*p.header()).state} {
       empty => false,
       blocked => fail ~"peeking on blocked packet",
       full | terminated => true
@@ -467,7 +467,7 @@ impl peek<T: send, Tb: send> for recv_packet_buffered<T, Tb> {
 #[doc(hidden)]
 fn sender_terminate<T: send>(p: *packet<T>) {
     let p = unsafe { &*p };
-    alt swap_state_rel(p.header.state, terminated) {
+    match swap_state_rel(p.header.state, terminated) {
       empty => {
         assert p.header.blocked_task.is_null();
         // The receiver will eventually clean up.
@@ -500,7 +500,7 @@ fn sender_terminate<T: send>(p: *packet<T>) {
 fn receiver_terminate<T: send>(p: *packet<T>) {
     let p = unsafe { &*p };
     assert p.header.blocked_task.is_null();
-    alt swap_state_rel(p.header.state, terminated) {
+    match swap_state_rel(p.header.state, terminated) {
       empty => {
         // the sender will clean up
         //unsafe { forget(p) }
@@ -534,7 +534,7 @@ fn wait_many(pkts: &[*packet_header]) -> uint {
     for pkts.eachi |i, p| unsafe {
         let p = unsafe { &*p };
         let old = p.mark_blocked(this);
-        alt old {
+        match old {
           full | terminated => {
             data_avail = true;
             ready_packet = i;
@@ -551,7 +551,7 @@ fn wait_many(pkts: &[*packet_header]) -> uint {
         let event = wait_event(this) as *packet_header;
         let pos = vec::position(pkts, |p| p == event);
 
-        alt pos {
+        match pos {
           some(i) => {
             ready_packet = i;
             data_avail = true;
@@ -611,7 +611,7 @@ fn select2<A: send, Ab: send, B: send, Bb: send>(
     let i = wait_many([a.header(), b.header()]/_);
 
     unsafe {
-        alt i {
+        match i {
           0 => left((try_recv(a), b)),
           1 => right((a, try_recv(b))),
           _ => fail ~"select2 return an invalid packet"
@@ -631,7 +631,7 @@ fn selecti<T: selectable>(endpoints: &[T]) -> uint {
 
 /// Returns 0 or 1 depending on which endpoint is ready to receive
 fn select2i<A: selectable, B: selectable>(a: A, b: B) -> either<(), ()> {
-    alt wait_many([a.header(), b.header()]/_) {
+    match wait_many([a.header(), b.header()]/_) {
       0 => left(()),
       1 => right(()),
       _ => fail ~"wait returned unexpected index"
@@ -704,7 +704,7 @@ fn unwrap() -> *packet<T> {
     }
 
     pure fn header() -> *packet_header {
-        alt self.p {
+        match self.p {
           some(packet) => unsafe {
             let packet = &*packet;
             let header = ptr::addr_of(packet.header);
@@ -765,7 +765,7 @@ fn unwrap() -> *packet<T> {
     }
 
     pure fn header() -> *packet_header {
-        alt self.p {
+        match self.p {
           some(packet) => unsafe {
             let packet = &*packet;
             let header = ptr::addr_of(packet.header);
@@ -924,7 +924,7 @@ fn recv() -> T {
     fn try_recv() -> option<T> {
         let mut endp = none;
         endp <-> self.endp;
-        alt move pipes::try_recv(unwrap(endp)) {
+        match move pipes::try_recv(unwrap(endp)) {
           some(streamp::data(x, endp)) => {
             self.endp = some(move_it!{endp});
             some(move_it!{x})
@@ -936,7 +936,7 @@ fn try_recv() -> option<T> {
     pure fn peek() -> bool unchecked {
         let mut endp = none;
         endp <-> self.endp;
-        let peek = alt endp {
+        let peek = match endp {
           some(endp) => pipes::peek(endp),
           none => fail ~"peeking empty stream"
         };
@@ -969,7 +969,7 @@ fn try_recv() -> option<T> {
         ports <-> self.ports;
         while result == none && ports.len() > 0 {
             let i = wait_many(ports.map(|p| p.header()));
-            alt move ports[i].try_recv() {
+            match move ports[i].try_recv() {
                 some(copy m) => {
                     result = some(move m);
                 }
@@ -1007,7 +1007,7 @@ fn recv() -> T {
 
 impl<T: send> of selectable for port<T> {
     pure fn header() -> *packet_header unchecked {
-        alt self.endp {
+        match self.endp {
           some(endp) => endp.header(),
           none => fail ~"peeking empty stream"
         }
@@ -1045,8 +1045,8 @@ impl<T: send, U: send, Left: selectable recv<T>, Right: selectable recv<U>>
     of select2<T, U> for (Left, Right) {
 
     fn select() -> either<T, U> {
-        alt self {
-          (lp, rp) => alt select2i(lp, rp) {
+        match self {
+          (lp, rp) => match select2i(lp, rp) {
             left(()) => left (lp.recv()),
             right(()) => right(rp.recv())
           }
@@ -1054,8 +1054,8 @@ fn select() -> either<T, U> {
     }
 
     fn try_select() -> either<option<T>, option<U>> {
-        alt self {
-          (lp, rp) => alt select2i(lp, rp) {
+        match self {
+          (lp, rp) => match select2i(lp, rp) {
             left(()) => left (lp.try_recv()),
             right(()) => right(rp.try_recv())
           }
@@ -1072,7 +1072,7 @@ fn test_select2() {
 
         c1.send(~"abc");
 
-        alt (p1, p2).select() {
+        match (p1, p2).select() {
           right(_) => fail,
           _ => ()
         }
index 5d7123f1bba85bc3435975705a0b39feaf833750..ac286da79f63f24aaea3f0a1cf2ba517013e3f56 100644 (file)
@@ -49,7 +49,7 @@ enum msg {
 
             // Wait to hear if we are the official instance of
             // this global task
-            alt comm::recv::<msg>(setup_po) {
+            match comm::recv::<msg>(setup_po) {
               proceed => f(po),
               abort => ()
             }
index a74ac589b931e4f140f3ffb7c169d9a3f24a149d..417841f33230caadd1e1adce2b51a03acedf0a97 100644 (file)
@@ -18,7 +18,7 @@ enum result<T, U> {
  * If the result is an error
  */
 pure fn get<T: copy, U>(res: result<T, U>) -> T {
-    alt res {
+    match res {
       ok(t) => t,
       err(the_err) => unchecked {
         fail fmt!{"get called on error result: %?", the_err}
@@ -34,7 +34,7 @@ enum result<T, U> {
  * If the result is not an error
  */
 pure fn get_err<T, U: copy>(res: result<T, U>) -> U {
-    alt res {
+    match res {
       err(u) => u,
       ok(_) => fail ~"get_error called on ok result"
     }
@@ -42,7 +42,7 @@ enum result<T, U> {
 
 /// Returns true if the result is `ok`
 pure fn is_ok<T, U>(res: result<T, U>) -> bool {
-    alt res {
+    match res {
       ok(_) => true,
       err(_) => false
     }
@@ -60,7 +60,7 @@ enum result<T, U> {
  * result variants are converted to `either::left`.
  */
 pure fn to_either<T: copy, U: copy>(res: result<U, T>) -> either<T, U> {
-    alt res {
+    match res {
       ok(res) => either::right(res),
       err(fail_) => either::left(fail_)
     }
@@ -82,7 +82,7 @@ enum result<T, U> {
  */
 fn chain<T, U: copy, V: copy>(res: result<T, V>, op: fn(T) -> result<U, V>)
     -> result<U, V> {
-    alt res {
+    match res {
       ok(t) => op(t),
       err(e) => err(e)
     }
@@ -100,7 +100,7 @@ fn chain_err<T: copy, U: copy, V: copy>(
     res: result<T, V>,
     op: fn(V) -> result<T, U>)
     -> result<T, U> {
-    alt res {
+    match res {
       ok(t) => ok(t),
       err(v) => op(v)
     }
@@ -121,7 +121,7 @@ fn chain_err<T: copy, U: copy, V: copy>(
  *     }
  */
 fn iter<T, E>(res: result<T, E>, f: fn(T)) {
-    alt res {
+    match res {
       ok(t) => f(t),
       err(_) => ()
     }
@@ -136,7 +136,7 @@ fn iter<T, E>(res: result<T, E>, f: fn(T)) {
  * handling an error.
  */
 fn iter_err<T, E>(res: result<T, E>, f: fn(E)) {
-    alt res {
+    match res {
       ok(_) => (),
       err(e) => f(e)
     }
@@ -158,7 +158,7 @@ fn iter_err<T, E>(res: result<T, E>, f: fn(E)) {
  */
 fn map<T, E: copy, U: copy>(res: result<T, E>, op: fn(T) -> U)
   -> result<U, E> {
-    alt res {
+    match res {
       ok(t) => ok(op(t)),
       err(e) => err(e)
     }
@@ -174,7 +174,7 @@ fn map<T, E: copy, U: copy>(res: result<T, E>, op: fn(T) -> U)
  */
 fn map_err<T: copy, E, F: copy>(res: result<T, E>, op: fn(E) -> F)
   -> result<T, F> {
-    alt res {
+    match res {
       ok(t) => ok(t),
       err(e) => err(op(e))
     }
@@ -186,14 +186,14 @@ fn is_ok() -> bool { is_ok(self) }
     fn is_err() -> bool { is_err(self) }
 
     fn iter(f: fn(T)) {
-        alt self {
+        match self {
           ok(t) => f(t),
           err(_) => ()
         }
     }
 
     fn iter_err(f: fn(E)) {
-        alt self {
+        match self {
           ok(_) => (),
           err(e) => f(e)
         }
@@ -204,7 +204,7 @@ impl extensions<T:copy, E> for result<T, E> {
     fn get() -> T { get(self) }
 
     fn map_err<F:copy>(op: fn(E) -> F) -> result<T,F> {
-        alt self {
+        match self {
           ok(t) => ok(t),
           err(e) => err(op(e))
         }
@@ -215,7 +215,7 @@ impl extensions<T, E:copy> for result<T, E> {
     fn get_err() -> E { get_err(self) }
 
     fn map<U:copy>(op: fn(T) -> U) -> result<U,E> {
-        alt self {
+        match self {
           ok(t) => ok(op(t)),
           err(e) => err(e)
         }
@@ -255,7 +255,7 @@ fn map_vec<T,U:copy,V:copy>(
     let mut vs: ~[V] = ~[];
     vec::reserve(vs, vec::len(ts));
     for vec::each(ts) |t| {
-        alt op(t) {
+        match op(t) {
           ok(v) => vec::push(vs, v),
           err(u) => return err(u)
         }
@@ -266,9 +266,9 @@ fn map_vec<T,U:copy,V:copy>(
 fn map_opt<T,U:copy,V:copy>(
     o_t: option<T>, op: fn(T) -> result<V,U>) -> result<option<V>,U> {
 
-    alt o_t {
+    match o_t {
       none => ok(none),
-      some(t) => alt op(t) {
+      some(t) => match op(t) {
         ok(v) => ok(some(v)),
         err(e) => err(e)
       }
@@ -293,7 +293,7 @@ fn map_vec2<S,T,U:copy,V:copy>(ss: ~[S], ts: ~[T],
     vec::reserve(vs, n);
     let mut i = 0u;
     while i < n {
-        alt op(ss[i],ts[i]) {
+        match op(ss[i],ts[i]) {
           ok(v) => vec::push(vs, v),
           err(u) => return err(u)
         }
@@ -314,7 +314,7 @@ fn iter_vec2<S,T,U:copy>(ss: ~[S], ts: ~[T],
     let n = vec::len(ts);
     let mut i = 0u;
     while i < n {
-        alt op(ss[i],ts[i]) {
+        match op(ss[i],ts[i]) {
           ok(()) => (),
           err(u) => return err(u)
         }
@@ -326,7 +326,7 @@ fn iter_vec2<S,T,U:copy>(ss: ~[S], ts: ~[T],
 /// Unwraps a result, assuming it is an `ok(T)`
 fn unwrap<T, U>(-res: result<T, U>) -> T {
     unsafe {
-        let addr = alt res {
+        let addr = match res {
           ok(x) => ptr::addr_of(x),
           err(_) => fail ~"error result"
         };
index 60527e786bdb27fad5b58688b7033c89f5c00bd5..92e89d8a7c8e7758b6b2bf6bc674c7a0cf7216be 100644 (file)
@@ -96,7 +96,7 @@ fn with_envp<T>(env: option<~[(~str,~str)]>,
                 cb: fn(*c_void) -> T) -> T {
     // On posixy systems we can pass a char** for envp, which is
     // a null-terminated array of "k=v\n" strings.
-    alt env {
+    match env {
       some(es) if !vec::is_empty(es) => {
         let mut tmps = ~[];
         let mut ptrs = ~[];
@@ -123,7 +123,7 @@ fn with_envp<T>(env: option<~[(~str,~str)]>,
     // rather a concatenation of null-terminated k=v\0 sequences, with a final
     // \0 to terminate.
     unsafe {
-        alt env {
+        match env {
           some(es) if !vec::is_empty(es) => {
             let mut blk : ~[u8] = ~[];
             for vec::each(es) |e| {
@@ -143,7 +143,7 @@ fn with_envp<T>(env: option<~[(~str,~str)]>,
 
 fn with_dirp<T>(d: option<~str>,
                 cb: fn(*libc::c_char) -> T) -> T {
-    alt d {
+    match d {
       some(dir) => str::as_c_str(dir, cb),
       none => cb(ptr::null())
     }
@@ -309,7 +309,7 @@ fn program_output(prog: ~str, args: ~[~str]) ->
     let mut count = 2;
     while count > 0 {
         let stream = comm::recv(p);
-        alt check stream {
+        match check stream {
             (1, s) => {
                 outs = s;
             }
index a242587a21c38246a02517090134a1df098f4a81..04dc25a2c114ea761e59f1a4de10bce6d886d765 100644 (file)
@@ -115,7 +115,7 @@ impl private_methods<K,V> for &const linear_map<K,V> {
             k: &K) -> search_result {
 
             let _ = for self.bucket_sequence(hash) |i| {
-                alt buckets[i] {
+                match buckets[i] {
                   some(bkt) => if bkt.hash == hash && self.eqfn(k, &bkt.key) {
                     return found_entry(i);
                   }
@@ -155,7 +155,7 @@ fn insert_bucket(+bucket: option<bucket<K,V>>) {
         /// Assumes that there will be a bucket.
         /// True if there was no previous entry with that key
         fn insert_internal(hash: uint, +k: K, +v: V) -> bool {
-            alt self.bucket_for_key_with_hash(self.buckets, hash,
+            match self.bucket_for_key_with_hash(self.buckets, hash,
                                               unsafe{borrow(k)}) {
               table_full => {fail ~"Internal logic error";}
               found_hole(idx) => {
@@ -207,7 +207,7 @@ fn remove(k: &K) -> bool {
             // I found this explanation elucidating:
             // http://www.maths.lse.ac.uk/Courses/MA407/del-hash.pdf
 
-            let mut idx = alt self.bucket_for_key(self.buckets, k) {
+            let mut idx = match self.bucket_for_key(self.buckets, k) {
               table_full | found_hole(_) => {
                 return false;
               }
@@ -246,7 +246,7 @@ fn is_empty() -> bool {
         }
 
         fn contains_key(k: &K) -> bool {
-            alt self.bucket_for_key(self.buckets, k) {
+            match self.bucket_for_key(self.buckets, k) {
               found_entry(_) => {true}
               table_full | found_hole(_) => {false}
             }
@@ -255,9 +255,9 @@ fn contains_key(k: &K) -> bool {
 
     impl public_methods<K,V: copy> for &const linear_map<K,V> {
         fn find(k: &K) -> option<V> {
-            alt self.bucket_for_key(self.buckets, k) {
+            match self.bucket_for_key(self.buckets, k) {
               found_entry(idx) => {
-                alt check self.buckets[idx] {
+                match check self.buckets[idx] {
                   some(bkt) => {some(copy bkt.value)}
                 }
               }
index cec8ec52ee47fc4591f6bc19eb8e3b4c5f4462e3..4a13c1d93542a6356e69e22ad751f458882d878f 100644 (file)
@@ -341,7 +341,7 @@ fn shift_char(&s: ~str) -> char {
 
 /// Returns a string with leading whitespace removed
 pure fn trim_left(s: &str) -> ~str {
-    alt find(s, |c| !char::is_whitespace(c)) {
+    match find(s, |c| !char::is_whitespace(c)) {
       none => ~"",
       some(first) => unsafe { unsafe::slice_bytes(s, first, len(s)) }
     }
@@ -349,7 +349,7 @@ fn shift_char(&s: ~str) -> char {
 
 /// Returns a string with trailing whitespace removed
 pure fn trim_right(s: &str) -> ~str {
-    alt rfind(s, |c| !char::is_whitespace(c)) {
+    match rfind(s, |c| !char::is_whitespace(c)) {
       none => ~"",
       some(last) => {
         let {next, _} = char_range_at(s, last);
@@ -2776,7 +2776,7 @@ fn test_contains_char() {
     fn test_chars_iter() {
         let mut i = 0;
         do chars_iter(~"x\u03c0y") |ch| {
-            alt check i {
+            match check i {
               0 => assert ch == 'x',
               1 => assert ch == '\u03c0',
               2 => assert ch == 'y'
@@ -2792,7 +2792,7 @@ fn test_bytes_iter() {
         let mut i = 0;
 
         do bytes_iter(~"xyz") |bb| {
-            alt check i {
+            match check i {
               0 => assert bb == 'x' as u8,
               1 => assert bb == 'y' as u8,
               2 => assert bb == 'z' as u8
@@ -2810,7 +2810,7 @@ fn test_split_char_iter() {
         let mut ii = 0;
 
         do split_char_iter(data, ' ') |xx| {
-            alt ii {
+            match ii {
               0 => assert ~"\nMary" == xx,
               1 => assert ~"had"    == xx,
               2 => assert ~"a"      == xx,
@@ -2828,7 +2828,7 @@ fn test_splitn_char_iter() {
         let mut ii = 0;
 
         do splitn_char_iter(data, ' ', 2u) |xx| {
-            alt ii {
+            match ii {
               0 => assert ~"\nMary" == xx,
               1 => assert ~"had"    == xx,
               2 => assert ~"a little lamb\nLittle lamb\n" == xx,
@@ -2845,7 +2845,7 @@ fn test_words_iter() {
         let mut ii = 0;
 
         do words_iter(data) |ww| {
-            alt ii {
+            match ii {
               0 => assert ~"Mary"   == ww,
               1 => assert ~"had"    == ww,
               2 => assert ~"a"      == ww,
@@ -2865,7 +2865,7 @@ fn test_lines_iter () {
         let mut ii = 0;
 
         do lines_iter(lf) |x| {
-            alt ii {
+            match ii {
                 0 => assert ~"" == x,
                 1 => assert ~"Mary had a little lamb" == x,
                 2 => assert ~"Little lamb" == x,
index cf354f0f8094f032edb0451e7954866041fc46e2..422d62862eaa533528547acf65d00ac8eb27c390 100644 (file)
@@ -279,7 +279,7 @@ fn future_result(blk: fn(-future::future<task_result>)) -> task_builder {
         let ch = comm::chan(po);
 
         blk(do future::from_fn {
-            alt comm::recv(po) {
+            match comm::recv(po) {
               exit(_, result) => result
             }
         });
@@ -502,7 +502,7 @@ fn try<T:send>(+f: fn~() -> T) -> result<T,()> {
     do task().unlinked().future_result(|-r| { result = some(r); }).spawn {
         comm::send(ch, f());
     }
-    alt future::get(option::unwrap(result)) {
+    match future::get(option::unwrap(result)) {
       success => result::ok(comm::recv(po)),
       failure => result::err(())
     }
@@ -991,7 +991,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
     /*######################################################################*
      * Step 1. Get spawner's taskgroup info.
      *######################################################################*/
-    let spawner_group = alt unsafe { local_get(spawner, taskgroup_key()) } {
+    let spawner_group = match unsafe { local_get(spawner, taskgroup_key()) } {
         none => {
             // Main task, doing first spawn ever. Lazily initialise here.
             let mut members = new_taskset();
@@ -1028,7 +1028,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
             // assertion, but initialising it requires locking a mutex. Hence
             // it should be enabled only in debug builds.
             let new_generation =
-                alt *old_ancestors {
+                match *old_ancestors {
                     some(arc) => access_ancestors(arc, |a| a.generation+1),
                     none      => 0 // the actual value doesn't really matter.
                 };
@@ -1047,7 +1047,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
 
     fn share_ancestors(ancestors: &mut ancestor_list) -> ancestor_list {
         // Appease the borrow-checker. Really this wants to be written as:
-        // alt ancestors
+        // match ancestors
         //    some(ancestor_arc) { ancestor_list(some(ancestor_arc.clone())) }
         //    none               { ancestor_list(none) }
         let tmp = util::replace(&mut **ancestors, none);
@@ -1073,7 +1073,7 @@ fn spawn_raw(opts: task_opts, +f: fn~()) {
             // Agh. Get move-mode items into the closure. FIXME (#2829)
             let (child_tg, ancestors, f) = option::swap_unwrap(child_data);
             // Create child task.
-            let new_task = alt opts.sched {
+            let new_task = match opts.sched {
               none             => rustrt::new_task(),
               some(sched_opts) => new_task_in_new_sched(sched_opts)
             };
@@ -1162,7 +1162,7 @@ fn new_task_in_new_sched(opts: sched_opts) -> *rust_task {
             fail ~"foreign_stack_size scheduler option unimplemented";
         }
 
-        let num_threads = alt opts.mode {
+        let num_threads = match opts.mode {
           single_threaded => 1u,
           thread_per_core => {
             fail ~"thread_per_core scheduling mode unimplemented"
@@ -1273,7 +1273,7 @@ unsafe fn local_data_lookup<T: owned>(
 
     let key_value = key_to_key_value(key);
     let map_pos = (*map).position(|entry|
-        alt entry {
+        match entry {
             some((k,_,_)) => k == key_value,
             none => false
         }
@@ -1336,7 +1336,7 @@ unsafe fn local_set<T: owned>(
     // Construct new entry to store in the map.
     let new_entry = some((keyval, data_ptr, data_box));
     // Find a place to put it.
-    alt local_data_lookup(map, key) {
+    match local_data_lookup(map, key) {
         some((index, _old_data_ptr)) => {
             // Key already had a value set, _old_data_ptr, whose reference
             // will get dropped when the local_data box is overwritten.
@@ -1344,7 +1344,7 @@ unsafe fn local_set<T: owned>(
         }
         none => {
             // Find an empty slot. If not, grow the vector.
-            alt (*map).position(|x| x == none) {
+            match (*map).position(|x| x == none) {
                 some(empty_index) => (*map).set_elt(empty_index, new_entry),
                 none => (*map).push(new_entry)
             }
@@ -1694,7 +1694,7 @@ fn test_spawn_listiner_bidi() {
 
 #[test]
 fn test_try_success() {
-    alt do try {
+    match do try {
         ~"Success!"
     } {
         result::ok(~"Success!") => (),
@@ -1705,7 +1705,7 @@ fn test_try_success() {
 #[test]
 #[ignore(cfg(windows))]
 fn test_try_fail() {
-    alt do try {
+    match do try {
         fail
     } {
         result::err(()) => (),
@@ -2052,13 +2052,13 @@ fn my_key(+_x: @~str) { }
 fn test_tls_modify() unsafe {
     fn my_key(+_x: @~str) { }
     local_data_modify(my_key, |data| {
-        alt data {
+        match data {
             some(@val) => fail ~"unwelcome value: " + val,
             none       => some(@~"first data")
         }
     });
     local_data_modify(my_key, |data| {
-        alt data {
+        match data {
             some(@~"first data") => some(@~"next data"),
             some(@val)           => fail ~"wrong value: " + val,
             none                 => fail ~"missing value"
index d3b0e8cea2461ddd723a14f962b731c7745fa48d..a0feaf3ed9d20747954c282e7538a941bfe11800 100644 (file)
@@ -127,7 +127,7 @@ fn parse_buf(buf: ~[u8], radix: uint) -> option<T> {
     let mut power = 1u as T;
     let mut n = 0u as T;
     loop {
-        alt char::to_digit(buf[i] as char, radix) {
+        match char::to_digit(buf[i] as char, radix) {
           some(d) => n += d as T * power,
           none => return none
         }
@@ -146,7 +146,7 @@ fn from_str_radix(buf: ~str, radix: u64) -> option<u64> {
     let mut i = str::len(buf) - 1u;
     let mut power = 1u64, n = 0u64;
     loop {
-        alt char::to_digit(buf[i] as char, radix as uint) {
+        match char::to_digit(buf[i] as char, radix as uint) {
           some(d) => n += d as u64 * power,
           none => return none
         }
index 343bf7954e6781b4509e8e6b255df82bc0a440e4..c7f0c9bfa17914c63cb8001f0af44db5f3a61635 100644 (file)
@@ -1,6 +1,6 @@
 mod general_category {
     pure fn Cc(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x00' to '\x1f'
             | '\x7f' to '\x9f' => true,
             _ => false
@@ -8,7 +8,7 @@ mod general_category {
     }
 
     pure fn Cf(c: char) -> bool {
-        return alt c {
+        return match c {
               '\xad'
             | '\u0600' to '\u0603'
             | '\u06dd'
@@ -27,21 +27,21 @@ mod general_category {
     }
 
     pure fn Co(c: char) -> bool {
-        return alt c {
+        return match c {
           '\ue000' to '\uf8ff' => true,
           _ => false
         };
     }
 
     pure fn Cs(c: char) -> bool {
-        return alt c {
+        return match c {
               '\ud800' to '\udfff' => true,
             _ => false
         };
     }
 
     pure fn Ll(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x61' to '\x7a'
             | '\xaa'
             | '\xb5'
@@ -646,7 +646,7 @@ mod general_category {
     }
 
     pure fn Lm(c: char) -> bool {
-        return alt c {
+        return match c {
               '\u02b0' to '\u02c1'
             | '\u02c6' to '\u02d1'
             | '\u02e0' to '\u02e4'
@@ -702,7 +702,7 @@ mod general_category {
     }
 
     pure fn Lo(c: char) -> bool {
-        return alt c {
+        return match c {
               '\u01bb'
             | '\u01c0' to '\u01c3'
             | '\u0294'
@@ -888,7 +888,7 @@ mod general_category {
     }
 
     pure fn Lt(c: char) -> bool {
-        return alt c {
+        return match c {
               '\u01c5'
             | '\u01c8'
             | '\u01cb'
@@ -905,7 +905,7 @@ mod general_category {
     }
 
     pure fn Lu(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x41' to '\x5a'
             | '\xc0' to '\xd6'
             | '\xd8' to '\xde'
@@ -1497,7 +1497,7 @@ mod general_category {
     }
 
     pure fn Mc(c: char) -> bool {
-        return alt c {
+        return match c {
               '\u0903'
             | '\u093b'
             | '\u093e' to '\u0940'
@@ -1608,7 +1608,7 @@ mod general_category {
     }
 
     pure fn Me(c: char) -> bool {
-        return alt c {
+        return match c {
               '\u0488' to '\u0489'
             | '\u20dd' to '\u20e0'
             | '\u20e2' to '\u20e4'
@@ -1619,7 +1619,7 @@ mod general_category {
     }
 
     pure fn Mn(c: char) -> bool {
-        return alt c {
+        return match c {
               '\u0300' to '\u036f'
             | '\u0483' to '\u0487'
             | '\u0591' to '\u05bd'
@@ -1812,7 +1812,7 @@ mod general_category {
     }
 
     pure fn Nd(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x30' to '\x39'
             | '\u0660' to '\u0669'
             | '\u06f0' to '\u06f9'
@@ -1856,7 +1856,7 @@ mod general_category {
     }
 
     pure fn Nl(c: char) -> bool {
-        return alt c {
+        return match c {
               '\u16ee' to '\u16f0'
             | '\u2160' to '\u2182'
             | '\u2185' to '\u2188'
@@ -1875,7 +1875,7 @@ mod general_category {
     }
 
     pure fn No(c: char) -> bool {
-        return alt c {
+        return match c {
               '\xb2' to '\xb3'
             | '\xb9'
             | '\xbc' to '\xbe'
@@ -1923,7 +1923,7 @@ mod general_category {
     }
 
     pure fn Pc(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x5f'
             | '\u203f' to '\u2040'
             | '\u2054'
@@ -1936,7 +1936,7 @@ mod general_category {
     }
 
     pure fn Pd(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x2d'
             | '\u058a'
             | '\u05be'
@@ -1958,7 +1958,7 @@ mod general_category {
     }
 
     pure fn Pe(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x29'
             | '\x5d'
             | '\x7d'
@@ -2035,7 +2035,7 @@ mod general_category {
     }
 
     pure fn Pf(c: char) -> bool {
-        return alt c {
+        return match c {
               '\xbb'
             | '\u2019'
             | '\u201d'
@@ -2052,7 +2052,7 @@ mod general_category {
     }
 
     pure fn Pi(c: char) -> bool {
-        return alt c {
+        return match c {
               '\xab'
             | '\u2018'
             | '\u201b' to '\u201c'
@@ -2070,7 +2070,7 @@ mod general_category {
     }
 
     pure fn Po(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x21' to '\x23'
             | '\x25' to '\x27'
             | '\x2a'
@@ -2203,7 +2203,7 @@ mod general_category {
     }
 
     pure fn Ps(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x28'
             | '\x5b'
             | '\x7b'
@@ -2282,7 +2282,7 @@ mod general_category {
     }
 
     pure fn Sc(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x24'
             | '\xa2' to '\xa5'
             | '\u060b'
@@ -2305,7 +2305,7 @@ mod general_category {
     }
 
     pure fn Sk(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x5e'
             | '\x60'
             | '\xa8'
@@ -2339,7 +2339,7 @@ mod general_category {
     }
 
     pure fn Sm(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x2b'
             | '\x3c' to '\x3e'
             | '\x7c'
@@ -2410,7 +2410,7 @@ mod general_category {
     }
 
     pure fn So(c: char) -> bool {
-        return alt c {
+        return match c {
               '\xa6' to '\xa7'
             | '\xa9'
             | '\xae'
@@ -2529,21 +2529,21 @@ mod general_category {
     }
 
     pure fn Zl(c: char) -> bool {
-        return alt c {
+        return match c {
           '\u2028' => true,
           _ => false
         };
     }
 
     pure fn Zp(c: char) -> bool {
-        return alt c {
+        return match c {
           '\u2029' => true,
           _ => false
         };
     }
 
     pure fn Zs(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x20'
             | '\xa0'
             | '\u1680'
@@ -2561,7 +2561,7 @@ mod general_category {
 mod derived_property {
     /// Check if a character has the alphabetic unicode property
     pure fn Alphabetic(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x41' to '\x5a'
             | '\x61' to '\x7a'
             | '\xaa'
@@ -3299,7 +3299,7 @@ mod derived_property {
     }
 
     pure fn XID_Continue(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x30' to '\x39'
             | '\x41' to '\x5a'
             | '\x5f'
@@ -4170,7 +4170,7 @@ mod derived_property {
     }
 
     pure fn XID_Start(c: char) -> bool {
-        return alt c {
+        return match c {
               '\x41' to '\x5a'
             | '\x61' to '\x7a'
             | '\xaa'
index 93bdd53d90d732885eaae79f9b3a386f17557f25..fcfbb3ea13537bb24832543bfb438fe903e471ea 100644 (file)
@@ -356,7 +356,7 @@ fn split<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] {
     let mut start = 0u;
     let mut result = ~[];
     while start < ln {
-        alt position_between(v, start, ln, f) {
+        match position_between(v, start, ln, f) {
           none => break,
           some(i) => {
             push(result, slice(v, start, i));
@@ -380,7 +380,7 @@ fn splitn<T: copy>(v: &[T], n: uint, f: fn(T) -> bool) -> ~[~[T]] {
     let mut count = n;
     let mut result = ~[];
     while start < ln && count > 0u {
-        alt position_between(v, start, ln, f) {
+        match position_between(v, start, ln, f) {
           none => break,
           some(i) => {
             push(result, slice(v, start, i));
@@ -405,7 +405,7 @@ fn rsplit<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] {
     let mut end = ln;
     let mut result = ~[];
     while end > 0u {
-        alt rposition_between(v, 0u, end, f) {
+        match rposition_between(v, 0u, end, f) {
           none => break,
           some(i) => {
             push(result, slice(v, i + 1u, end));
@@ -429,7 +429,7 @@ fn rsplitn<T: copy>(v: &[T], n: uint, f: fn(T) -> bool) -> ~[~[T]] {
     let mut count = n;
     let mut result = ~[];
     while end > 0u && count > 0u {
-        alt rposition_between(v, 0u, end, f) {
+        match rposition_between(v, 0u, end, f) {
           none => break,
           some(i) => {
             push(result, slice(v, i + 1u, end));
@@ -713,7 +713,7 @@ fn map_consume<T, U>(+v: ~[T], f: fn(+T) -> U) -> ~[U] {
     -> ~[U] {
     let mut result = ~[];
     for each(v) |elem| {
-        alt f(elem) {
+        match f(elem) {
           none => {/* no-op */ }
           some(result_elem) => unsafe { push(result, result_elem); }
         }
index e76d3093c17cec5266f7b82e12a053de44bbc213..a51ac7658a626c2eb2303ecc9dd15544dffa5892 100644 (file)
@@ -30,7 +30,7 @@ fn to_base64() -> ~str {
             i += 3u;
         }
 
-        alt check len % 3u {
+        match check len % 3u {
           0u => (),
           1u => {
             let n = (self[i] as uint) << 16u;
@@ -96,7 +96,7 @@ fn from_base64() -> ~[u8] {
                 } else if ch == '/' {
                     n |= 0x3Fu;
                 } else if ch == '=' {
-                    alt len - i {
+                    match len - i {
                       1u => {
                         vec::push(r, ((n >> 16u) & 0xFFu) as u8);
                         vec::push(r, ((n >> 8u ) & 0xFFu) as u8);
index de51e2b7f51074cffa99b7d47ca8a8fe12f6230d..4b1fa4bfac9db04409b2e3b9e356aee4b5a145ac 100644 (file)
@@ -179,9 +179,9 @@ fn do_op(op: op, other: &bitv) -> bool {
             if self.nbits != other.nbits {
                 self.die();
             }
-            alt self.rep {
-              small(s) => alt other.rep {
-                small(s1) => alt op {
+            match self.rep {
+              small(s) => match other.rep {
+                small(s1) => match op {
                   union      => s.union(s1),
                   intersect  => s.intersect(s1),
                   assign     => s.become(s1),
@@ -189,9 +189,9 @@ union      => s.union(s1),
                 }
                 big(s1) => self.die()
               }
-              big(s) => alt other.rep {
+              big(s) => match other.rep {
                 small(_) => self.die(),
-                big(s1) => alt op {
+                big(s1) => match op {
                   union      => s.union(s1),
                   intersect  => s.intersect(s1),
                   assign     => s.become(s1),
@@ -232,7 +232,7 @@ fn assign(v: &bitv) -> bool { self.do_op(assign, v) }
     /// Makes a copy of a bitvector
     #[inline(always)]
     fn clone() -> ~bitv {
-        ~alt self.rep {
+        ~match self.rep {
           small(b) => {
             bitv{nbits: self.nbits, rep: small(~small_bitv{bits: b.bits})}
           }
@@ -249,7 +249,7 @@ fn clone() -> ~bitv {
     #[inline(always)]
     pure fn get(i: uint) -> bool {
        assert (i < self.nbits);
-       alt self.rep {
+       match self.rep {
          big(b)   => b.get(i),
          small(s) => s.get(i)
        }
@@ -263,7 +263,7 @@ fn clone() -> ~bitv {
     #[inline(always)]
     fn set(i: uint, x: bool) {
       assert (i < self.nbits);
-      alt self.rep {
+      match self.rep {
         big(b)   => b.set(i, x),
         small(s) => s.set(i, x)
       }
@@ -278,12 +278,12 @@ fn set(i: uint, x: bool) {
     #[inline(always)]
     fn equal(v1: bitv) -> bool {
       if self.nbits != v1.nbits { return false; }
-      alt self.rep {
-        small(b) => alt v1.rep {
+      match self.rep {
+        small(b) => match v1.rep {
           small(b1) => b.equals(b1),
           _ => false
         }
-        big(s) => alt v1.rep {
+        big(s) => match v1.rep {
           big(s1) => s.equals(s1),
           small(_) => return false
         }
@@ -293,7 +293,7 @@ fn equal(v1: bitv) -> bool {
     /// Set all bits to 0
     #[inline(always)]
     fn clear() {
-        alt self.rep {
+        match self.rep {
           small(b) => b.clear(),
           big(s) => for s.each_storage() |w| { w = 0u }
         }
@@ -302,7 +302,7 @@ fn clear() {
     /// Set all bits to 1
     #[inline(always)]
     fn set_all() {
-      alt self.rep {
+      match self.rep {
         small(b) => b.set_all(),
         big(s) => for s.each_storage() |w| { w = !0u } }
     }
@@ -310,7 +310,7 @@ fn set_all() {
     /// Invert all bits
     #[inline(always)]
     fn invert() {
-      alt self.rep {
+      match self.rep {
         small(b) => b.invert(),
         big(s) => for s.each_storage() |w| { w = !w } }
     }
@@ -329,7 +329,7 @@ fn difference(v: ~bitv) -> bool { self.do_op(difference, v) }
         /// Returns true if all bits are 1
     #[inline(always)]
     fn is_true() -> bool {
-      alt self.rep {
+      match self.rep {
         small(b) => b.is_true(),
         _ => {
           for self.each() |i| { if !i { return false; } }
@@ -350,7 +350,7 @@ fn each(f: fn(bool) -> bool) {
     /// Returns true if all bits are 0
 
     fn is_false() -> bool {
-      alt self.rep {
+      match self.rep {
         small(b) => b.is_false(),
         big(_) => {
           for self.each() |i| { if i { return false; } }
index e00ee13949b9bfe63fbc3c66d140b62d845c1a56..8b5a5e551134e2132b85f589b0d92c8ff3ebf80e 100644 (file)
@@ -46,7 +46,7 @@ enum c_vec<T> {
   let dtor: option<fn@()>;
   new(dtor: option<fn@()>) { self.dtor = dtor; }
   drop {
-    alt self.dtor {
+    match self.dtor {
       option::none => (),
       option::some(f) => f()
     }
index 5e98f3c705475c418dd53db203faa31b225f0b81..8293e4f215c6a2c632c6dd15d79cba6ba3959095 100644 (file)
@@ -41,7 +41,7 @@ fn grow<T: copy>(nelts: uint, lo: uint, -elts: ~[mut cell<T>]) ->
         return rv;
     }
     fn get<T: copy>(elts: dvec<cell<T>>, i: uint) -> T {
-        alt elts.get_elt(i) { some(t) => t, _ => fail }
+        match elts.get_elt(i) { some(t) => t, _ => fail }
     }
 
     type repr<T> = {mut nelts: uint,
@@ -238,32 +238,32 @@ fn test() {
         fn inteq(&&a: int, &&b: int) -> bool { return a == b; }
         fn intboxeq(&&a: @int, &&b: @int) -> bool { return a == b; }
         fn taggyeq(a: taggy, b: taggy) -> bool {
-            alt a {
-              one(a1) => alt b {
+            match a {
+              one(a1) => match b {
                 one(b1) => return a1 == b1,
                 _ => return false
               }
-              two(a1, a2) => alt b {
+              two(a1, a2) => match b {
                 two(b1, b2) => return a1 == b1 && a2 == b2,
                 _ => return false
               }
-              three(a1, a2, a3) => alt b {
+              three(a1, a2, a3) => match b {
                 three(b1, b2, b3) => return a1 == b1 && a2 == b2 && a3 == b3,
                 _ => return false
               }
             }
         }
         fn taggypareq<T>(a: taggypar<T>, b: taggypar<T>) -> bool {
-            alt a {
-              onepar::<T>(a1) => alt b {
+            match a {
+              onepar::<T>(a1) => match b {
                 onepar::<T>(b1) => return a1 == b1,
                 _ => return false
               }
-              twopar::<T>(a1, a2) => alt b {
+              twopar::<T>(a1, a2) => match b {
                 twopar::<T>(b1, b2) => return a1 == b1 && a2 == b2,
                 _ => return false
               }
-              threepar::<T>(a1, a2, a3) => alt b {
+              threepar::<T>(a1, a2, a3) => match b {
                 threepar::<T>(b1, b2, b3) => {
                     return a1 == b1 && a2 == b2 && a3 == b3
                 }
index 78ec45659ccfe99d596f916a4b39e5aa343ff9f1..f5396395b93cadf2a691909ce179a5dbba54f41f 100644 (file)
@@ -113,7 +113,7 @@ fn maybe_get_doc(d: doc, tg: uint) -> option<doc> {
 }
 
 fn get_doc(d: doc, tg: uint) -> doc {
-    alt maybe_get_doc(d, tg) {
+    match maybe_get_doc(d, tg) {
       some(d) => return d,
       none => {
         error!{"failed to find block with tag %u", tg};
@@ -189,7 +189,7 @@ enum writer {
 }
 
 fn write_sized_vuint(w: io::writer, n: uint, size: uint) {
-    alt size {
+    match size {
       1u => w.write(&[0x80u8 | (n as u8)]),
       2u => w.write(&[0x40u8 | ((n >> 8_u) as u8), n as u8]),
       3u => w.write(&[0x20u8 | ((n >> 16_u) as u8), (n >> 8_u) as u8,
@@ -593,7 +593,7 @@ fn serialize_1<S: serialization::serializer>(s: S, v: int) {
 
     fn serialize_0<S: serialization::serializer>(s: S, v: option<int>) {
         do s.emit_enum(~"core::option::t") {
-            alt v {
+            match v {
               none => s.emit_enum_variant(
                   ~"core::option::none", 0u, 0u, || { } ),
               some(v0) => {
@@ -612,7 +612,7 @@ fn deserialize_1<S: serialization::deserializer>(s: S) -> int {
     fn deserialize_0<S: serialization::deserializer>(s: S) -> option<int> {
         do s.read_enum(~"core::option::t") {
             do s.read_enum_variant |i| {
-                alt check i {
+                match check i {
                   0u => none,
                   1u => {
                     let v0 = do s.read_enum_variant_arg(0u) {
index e849d77ded6dcdffce26b9300655f05847e2e919..786af20940e53aac04041b4d5f11e7df4876a179 100644 (file)
@@ -30,7 +30,7 @@ fn init<K, V>() -> treemap<K, V> { @empty }
 
 /// Insert a value into the map
 fn insert<K: copy, V: copy>(m: treemap<K, V>, k: K, v: V) -> treemap<K, V> {
-    @alt m {
+    @match m {
        @empty => node(@k, @v, @empty, @empty),
        @node(@kk, vv, left, right) => {
          if k < kk {
@@ -44,7 +44,7 @@ fn insert<K: copy, V: copy>(m: treemap<K, V>, k: K, v: V) -> treemap<K, V> {
 
 /// Find a value based on the key
 fn find<K, V: copy>(m: treemap<K, V>, k: K) -> option<V> {
-    alt *m {
+    match *m {
       empty => none,
       node(@kk, @v, left, right) => {
         if k == kk {
@@ -56,7 +56,7 @@ fn find<K, V: copy>(m: treemap<K, V>, k: K) -> option<V> {
 
 /// Visit all pairs in the map in order.
 fn traverse<K, V: copy>(m: treemap<K, V>, f: fn(K, V)) {
-    alt *m {
+    match *m {
       empty => (),
       /*
         Previously, this had what looked like redundant
index c05c685daa8f5877587e5beb5d135b60cfe8a56a..04a0469107715faa8ee1c0d3d0572412907ace23 100644 (file)
@@ -43,7 +43,7 @@
  *             optflag("h"),
  *             optflag("help")
  *         ];
- *         let matches = alt getopts(vec::tail(args), opts) {
+ *         let matches = match getopts(vec::tail(args), opts) {
  *             result::ok(m) { m }
  *             result::err(f) { fail fail_str(f) }
  *         };
@@ -140,7 +140,7 @@ fn is_arg(arg: ~str) -> bool {
 }
 
 fn name_str(nm: name) -> ~str {
-    return alt nm {
+    return match nm {
       short(ch) => str::from_char(ch),
       long(s) => s
     };
@@ -164,7 +164,7 @@ enum fail_ {
 
 /// Convert a `fail_` enum into an error string
 fn fail_str(f: fail_) -> ~str {
-    return alt f {
+    return match f {
       argument_missing(nm) => ~"Argument to option '" + nm + ~"' missing.",
       unrecognized_option(nm) => ~"Unrecognized option: '" + nm + ~"'.",
       option_missing(nm) => ~"Required option '" + nm + ~"' missing.",
@@ -233,12 +233,14 @@ fn getopts(args: ~[~str], opts: ~[opt]) -> result unsafe {
                        correctly
                     */
 
-                    alt find_opt(opts, opt) {
+                    match find_opt(opts, opt) {
                       some(id) => last_valid_opt_id = option::some(id),
                       none => {
                         let arg_follows =
                             option::is_some(last_valid_opt_id) &&
-                            alt opts[option::get(last_valid_opt_id)].hasarg {
+                            match opts[option::get(last_valid_opt_id)]
+                              .hasarg {
+
                               yes | maybe => true,
                               no => false
                             };
@@ -257,11 +259,11 @@ fn getopts(args: ~[~str], opts: ~[opt]) -> result unsafe {
             let mut name_pos = 0u;
             for vec::each(names) |nm| {
                 name_pos += 1u;
-                let optid = alt find_opt(opts, nm) {
+                let optid = match find_opt(opts, nm) {
                   some(id) => id,
                   none => return err(unrecognized_option(name_str(nm)))
                 };
-                alt opts[optid].hasarg {
+                match opts[optid].hasarg {
                   no => {
                     if !option::is_none::<~str>(i_arg) {
                         return err(unexpected_argument(name_str(nm)));
@@ -309,7 +311,7 @@ fn getopts(args: ~[~str], opts: ~[opt]) -> result unsafe {
 }
 
 fn opt_vals(m: matches, nm: ~str) -> ~[optval] {
-    return alt find_opt(m.opts, mkname(nm)) {
+    return match find_opt(m.opts, mkname(nm)) {
       some(id) => m.vals[id],
       none => {
         error!{"No option '%s' defined", nm};
@@ -328,7 +330,7 @@ fn opt_present(m: matches, nm: ~str) -> bool {
 /// Returns true if any of several options were matched
 fn opts_present(m: matches, names: ~[~str]) -> bool {
     for vec::each(names) |nm| {
-        alt find_opt(m.opts, mkname(nm)) {
+        match find_opt(m.opts, mkname(nm)) {
           some(_) => return true,
           _ => ()
         }
@@ -344,7 +346,7 @@ fn opts_present(m: matches, names: ~[~str]) -> bool {
  * argument
  */
 fn opt_str(m: matches, nm: ~str) -> ~str {
-    return alt opt_val(m, nm) { val(s) => s, _ => fail };
+    return match opt_val(m, nm) { val(s) => s, _ => fail };
 }
 
 /**
@@ -355,7 +357,7 @@ fn opt_str(m: matches, nm: ~str) -> ~str {
  */
 fn opts_str(m: matches, names: ~[~str]) -> ~str {
     for vec::each(names) |nm| {
-        alt opt_val(m, nm) {
+        match opt_val(m, nm) {
           val(s) => return s,
           _ => ()
         }
@@ -373,7 +375,7 @@ fn opts_str(m: matches, names: ~[~str]) -> ~str {
 fn opt_strs(m: matches, nm: ~str) -> ~[~str] {
     let mut acc: ~[~str] = ~[];
     for vec::each(opt_vals(m, nm)) |v| {
-        alt v { val(s) => vec::push(acc, s), _ => () }
+        match v { val(s) => vec::push(acc, s), _ => () }
     }
     return acc;
 }
@@ -382,7 +384,7 @@ fn opt_strs(m: matches, nm: ~str) -> ~[~str] {
 fn opt_maybe_str(m: matches, nm: ~str) -> option<~str> {
     let vals = opt_vals(m, nm);
     if vec::len::<optval>(vals) == 0u { return none::<~str>; }
-    return alt vals[0] { val(s) => some::<~str>(s), _ => none::<~str> };
+    return match vals[0] { val(s) => some::<~str>(s), _ => none::<~str> };
 }
 
 
@@ -396,7 +398,7 @@ fn opt_maybe_str(m: matches, nm: ~str) -> option<~str> {
 fn opt_default(m: matches, nm: ~str, def: ~str) -> option<~str> {
     let vals = opt_vals(m, nm);
     if vec::len::<optval>(vals) == 0u { return none::<~str>; }
-    return alt vals[0] { val(s) => some::<~str>(s), _ => some::<~str>(def) }
+    return match vals[0] { val(s) => some::<~str>(s), _ => some::<~str>(def) }
 }
 
 #[cfg(test)]
@@ -413,7 +415,7 @@ enum fail_type {
     }
 
     fn check_fail_type(f: fail_, ft: fail_type) {
-        alt f {
+        match f {
           argument_missing(_) => assert ft == argument_missing_,
           unrecognized_option(_) => assert ft == unrecognized_option_,
           option_missing(_) => assert ft == option_missing_,
@@ -429,7 +431,7 @@ fn test_reqopt_long() {
         let args = ~[~"--test=20"];
         let opts = ~[reqopt(~"test")];
         let rs = getopts(args, opts);
-        alt check rs {
+        match check rs {
           ok(m) => {
             assert (opt_present(m, ~"test"));
             assert (opt_str(m, ~"test") == ~"20");
@@ -442,7 +444,7 @@ fn test_reqopt_long_missing() {
         let args = ~[~"blah"];
         let opts = ~[reqopt(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, option_missing_),
           _ => fail
         }
@@ -453,7 +455,7 @@ fn test_reqopt_long_no_arg() {
         let args = ~[~"--test"];
         let opts = ~[reqopt(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, argument_missing_),
           _ => fail
         }
@@ -464,7 +466,7 @@ fn test_reqopt_long_multi() {
         let args = ~[~"--test=20", ~"--test=30"];
         let opts = ~[reqopt(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, option_duplicated_),
           _ => fail
         }
@@ -475,7 +477,7 @@ fn test_reqopt_short() {
         let args = ~[~"-t", ~"20"];
         let opts = ~[reqopt(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => {
             assert (opt_present(m, ~"t"));
             assert (opt_str(m, ~"t") == ~"20");
@@ -489,7 +491,7 @@ fn test_reqopt_short_missing() {
         let args = ~[~"blah"];
         let opts = ~[reqopt(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, option_missing_),
           _ => fail
         }
@@ -500,7 +502,7 @@ fn test_reqopt_short_no_arg() {
         let args = ~[~"-t"];
         let opts = ~[reqopt(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, argument_missing_),
           _ => fail
         }
@@ -511,7 +513,7 @@ fn test_reqopt_short_multi() {
         let args = ~[~"-t", ~"20", ~"-t", ~"30"];
         let opts = ~[reqopt(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, option_duplicated_),
           _ => fail
         }
@@ -524,7 +526,7 @@ fn test_optopt_long() {
         let args = ~[~"--test=20"];
         let opts = ~[optopt(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => {
             assert (opt_present(m, ~"test"));
             assert (opt_str(m, ~"test") == ~"20");
@@ -538,7 +540,7 @@ fn test_optopt_long_missing() {
         let args = ~[~"blah"];
         let opts = ~[optopt(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => assert (!opt_present(m, ~"test")),
           _ => fail
         }
@@ -549,7 +551,7 @@ fn test_optopt_long_no_arg() {
         let args = ~[~"--test"];
         let opts = ~[optopt(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, argument_missing_),
           _ => fail
         }
@@ -560,7 +562,7 @@ fn test_optopt_long_multi() {
         let args = ~[~"--test=20", ~"--test=30"];
         let opts = ~[optopt(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, option_duplicated_),
           _ => fail
         }
@@ -571,7 +573,7 @@ fn test_optopt_short() {
         let args = ~[~"-t", ~"20"];
         let opts = ~[optopt(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => {
             assert (opt_present(m, ~"t"));
             assert (opt_str(m, ~"t") == ~"20");
@@ -585,7 +587,7 @@ fn test_optopt_short_missing() {
         let args = ~[~"blah"];
         let opts = ~[optopt(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => assert (!opt_present(m, ~"t")),
           _ => fail
         }
@@ -596,7 +598,7 @@ fn test_optopt_short_no_arg() {
         let args = ~[~"-t"];
         let opts = ~[optopt(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, argument_missing_),
           _ => fail
         }
@@ -607,7 +609,7 @@ fn test_optopt_short_multi() {
         let args = ~[~"-t", ~"20", ~"-t", ~"30"];
         let opts = ~[optopt(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, option_duplicated_),
           _ => fail
         }
@@ -620,7 +622,7 @@ fn test_optflag_long() {
         let args = ~[~"--test"];
         let opts = ~[optflag(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => assert (opt_present(m, ~"test")),
           _ => fail
         }
@@ -631,7 +633,7 @@ fn test_optflag_long_missing() {
         let args = ~[~"blah"];
         let opts = ~[optflag(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => assert (!opt_present(m, ~"test")),
           _ => fail
         }
@@ -642,7 +644,7 @@ fn test_optflag_long_arg() {
         let args = ~[~"--test=20"];
         let opts = ~[optflag(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => {
             log(error, fail_str(f));
             check_fail_type(f, unexpected_argument_);
@@ -656,7 +658,7 @@ fn test_optflag_long_multi() {
         let args = ~[~"--test", ~"--test"];
         let opts = ~[optflag(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, option_duplicated_),
           _ => fail
         }
@@ -667,7 +669,7 @@ fn test_optflag_short() {
         let args = ~[~"-t"];
         let opts = ~[optflag(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => assert (opt_present(m, ~"t")),
           _ => fail
         }
@@ -678,7 +680,7 @@ fn test_optflag_short_missing() {
         let args = ~[~"blah"];
         let opts = ~[optflag(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => assert (!opt_present(m, ~"t")),
           _ => fail
         }
@@ -689,7 +691,7 @@ fn test_optflag_short_arg() {
         let args = ~[~"-t", ~"20"];
         let opts = ~[optflag(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => {
             // The next variable after the flag is just a free argument
 
@@ -704,7 +706,7 @@ fn test_optflag_short_multi() {
         let args = ~[~"-t", ~"-t"];
         let opts = ~[optflag(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, option_duplicated_),
           _ => fail
         }
@@ -717,7 +719,7 @@ fn test_optmulti_long() {
         let args = ~[~"--test=20"];
         let opts = ~[optmulti(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => {
             assert (opt_present(m, ~"test"));
             assert (opt_str(m, ~"test") == ~"20");
@@ -731,7 +733,7 @@ fn test_optmulti_long_missing() {
         let args = ~[~"blah"];
         let opts = ~[optmulti(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => assert (!opt_present(m, ~"test")),
           _ => fail
         }
@@ -742,7 +744,7 @@ fn test_optmulti_long_no_arg() {
         let args = ~[~"--test"];
         let opts = ~[optmulti(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, argument_missing_),
           _ => fail
         }
@@ -753,7 +755,7 @@ fn test_optmulti_long_multi() {
         let args = ~[~"--test=20", ~"--test=30"];
         let opts = ~[optmulti(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => {
             assert (opt_present(m, ~"test"));
             assert (opt_str(m, ~"test") == ~"20");
@@ -769,7 +771,7 @@ fn test_optmulti_short() {
         let args = ~[~"-t", ~"20"];
         let opts = ~[optmulti(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => {
             assert (opt_present(m, ~"t"));
             assert (opt_str(m, ~"t") == ~"20");
@@ -783,7 +785,7 @@ fn test_optmulti_short_missing() {
         let args = ~[~"blah"];
         let opts = ~[optmulti(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => assert (!opt_present(m, ~"t")),
           _ => fail
         }
@@ -794,7 +796,7 @@ fn test_optmulti_short_no_arg() {
         let args = ~[~"-t"];
         let opts = ~[optmulti(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, argument_missing_),
           _ => fail
         }
@@ -805,7 +807,7 @@ fn test_optmulti_short_multi() {
         let args = ~[~"-t", ~"20", ~"-t", ~"30"];
         let opts = ~[optmulti(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => {
             assert (opt_present(m, ~"t"));
             assert (opt_str(m, ~"t") == ~"20");
@@ -821,7 +823,7 @@ fn test_unrecognized_option_long() {
         let args = ~[~"--untest"];
         let opts = ~[optmulti(~"t")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, unrecognized_option_),
           _ => fail
         }
@@ -832,7 +834,7 @@ fn test_unrecognized_option_short() {
         let args = ~[~"-t"];
         let opts = ~[optmulti(~"test")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           err(f) => check_fail_type(f, unrecognized_option_),
           _ => fail
         }
@@ -849,7 +851,7 @@ fn test_combined() {
              optflag(~"f"), optmulti(~"m"), optmulti(~"n"),
              optopt(~"notpresent")];
         let rs = getopts(args, opts);
-        alt rs {
+        match rs {
           ok(m) => {
             assert (m.free[0] == ~"prog");
             assert (m.free[1] == ~"free1");
@@ -872,7 +874,7 @@ fn test_combined() {
     fn test_multi() {
         let args = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"];
         let opts = ~[optopt(~"e"), optopt(~"encrypt")];
-        let matches = alt getopts(args, opts) {
+        let matches = match getopts(args, opts) {
           result::ok(m) => m,
           result::err(f) => fail
         };
@@ -893,7 +895,7 @@ fn test_multi() {
     fn test_nospace() {
         let args = ~[~"-Lfoo"];
         let opts = ~[optmulti(~"L")];
-        let matches = alt getopts(args, opts) {
+        let matches = match getopts(args, opts) {
           result::ok(m) => m,
           result::err(f) => fail
         };
index 82a0f7d80845b32b4d204e42254156bb5e36dc99..f3ca79be02b4ae1c952727b7a80499fd81fb6306 100644 (file)
@@ -45,7 +45,7 @@ enum json {
 
 /// Serializes a json value into a io::writer
 fn to_writer(wr: io::writer, j: json) {
-    alt j {
+    match j {
       num(n) => wr.write_str(float::to_str(n, 6u)),
       string(s) => wr.write_str(escape_str(*s)),
       boolean(b) => wr.write_str(if b { ~"true" } else { ~"false" }),
@@ -87,7 +87,7 @@ fn to_writer(wr: io::writer, j: json) {
 fn escape_str(s: ~str) -> ~str {
     let mut escaped = ~"\"";
     do str::chars_iter(s) |c| {
-        alt c {
+        match c {
           '"' => escaped += ~"\\\"",
           '\\' => escaped += ~"\\\\",
           '\x08' => escaped += ~"\\b",
@@ -144,7 +144,7 @@ fn error<T>(+msg: ~str) -> result<T, error> {
     }
 
     fn parse() -> result<json, error> {
-        alt self.parse_value() {
+        match self.parse_value() {
           ok(value) => {
             // Skip trailing whitespaces.
             self.parse_whitespace();
@@ -164,12 +164,12 @@ fn parse_value() -> result<json, error> {
 
         if self.eof() { return self.error(~"EOF while parsing value"); }
 
-        alt self.ch {
+        match self.ch {
           'n' => self.parse_ident(~"ull", null),
           't' => self.parse_ident(~"rue", boolean(true)),
           'f' => self.parse_ident(~"alse", boolean(false)),
           '0' to '9' | '-' => self.parse_number(),
-          '"' => alt self.parse_str() {
+          '"' => match self.parse_str() {
             ok(s) => ok(string(s)),
             err(e) => err(e)
           }
@@ -200,20 +200,20 @@ fn parse_number() -> result<json, error> {
             neg = -1f;
         }
 
-        let mut res = alt self.parse_integer() {
+        let mut res = match self.parse_integer() {
           ok(res) => res,
           err(e) => return err(e)
         };
 
         if self.ch == '.' {
-            alt self.parse_decimal(res) {
+            match self.parse_decimal(res) {
               ok(r) => res = r,
               err(e) => return err(e)
             }
         }
 
         if self.ch == 'e' || self.ch == 'E' {
-            alt self.parse_exponent(res) {
+            match self.parse_exponent(res) {
               ok(r) => res = r,
               err(e) => return err(e)
             }
@@ -225,19 +225,19 @@ fn parse_number() -> result<json, error> {
     fn parse_integer() -> result<float, error> {
         let mut res = 0f;
 
-        alt self.ch {
+        match self.ch {
           '0' => {
             self.bump();
 
             // There can be only one leading '0'.
-            alt self.ch {
+            match self.ch {
               '0' to '9' => return self.error(~"invalid number"),
               _ => ()
             }
           }
           '1' to '9' => {
             while !self.eof() {
-                alt self.ch {
+                match self.ch {
                   '0' to '9' => {
                     res *= 10f;
                     res += ((self.ch as int) - ('0' as int)) as float;
@@ -258,7 +258,7 @@ fn parse_decimal(res: float) -> result<float, error> {
         self.bump();
 
         // Make sure a digit follows the decimal place.
-        alt self.ch {
+        match self.ch {
           '0' to '9' => (),
           _ => return self.error(~"invalid number")
         }
@@ -266,7 +266,7 @@ fn parse_decimal(res: float) -> result<float, error> {
         let mut res = res;
         let mut dec = 1f;
         while !self.eof() {
-            alt self.ch {
+            match self.ch {
               '0' to '9' => {
                 dec /= 10f;
                 res += (((self.ch as int) - ('0' as int)) as float) * dec;
@@ -287,20 +287,20 @@ fn parse_exponent(res: float) -> result<float, error> {
         let mut exp = 0u;
         let mut neg_exp = false;
 
-        alt self.ch {
+        match self.ch {
           '+' => self.bump(),
           '-' => { self.bump(); neg_exp = true; }
           _ => ()
         }
 
         // Make sure a digit follows the exponent place.
-        alt self.ch {
+        match self.ch {
           '0' to '9' => (),
           _ => return self.error(~"invalid number")
         }
 
         while !self.eof() {
-            alt self.ch {
+            match self.ch {
               '0' to '9' => {
                 exp *= 10u;
                 exp += (self.ch as uint) - ('0' as uint);
@@ -329,7 +329,7 @@ fn parse_str() -> result<@~str, error> {
             self.bump();
 
             if (escape) {
-                alt self.ch {
+                match self.ch {
                   '"' => str::push_char(res, '"'),
                   '\\' => str::push_char(res, '\\'),
                   '/' => str::push_char(res, '/'),
@@ -343,7 +343,7 @@ fn parse_str() -> result<@~str, error> {
                       let mut i = 0u;
                       let mut n = 0u;
                       while i < 4u {
-                          alt self.next_char() {
+                          match self.next_char() {
                             '0' to '9' => {
                               n = n * 10u +
                                   (self.ch as uint) - ('0' as uint);
@@ -389,7 +389,7 @@ fn parse_list() -> result<json, error> {
         }
 
         loop {
-            alt self.parse_value() {
+            match self.parse_value() {
               ok(v) => vec::push(values, v),
               e => return e
             }
@@ -399,7 +399,7 @@ fn parse_list() -> result<json, error> {
                 return self.error(~"EOF while parsing list");
             }
 
-            alt self.ch {
+            match self.ch {
               ',' => self.bump(),
               ']' => { self.bump(); return ok(list(@values)); }
               _ => return self.error(~"expected `,` or `]`")
@@ -425,7 +425,7 @@ fn parse_object() -> result<json, error> {
                 return self.error(~"key must be a string");
             }
 
-            let key = alt self.parse_str() {
+            let key = match self.parse_str() {
               ok(key) => key,
               err(e) => return err(e)
             };
@@ -438,13 +438,13 @@ fn parse_object() -> result<json, error> {
             }
             self.bump();
 
-            alt self.parse_value() {
+            match self.parse_value() {
               ok(value) => { values.insert(copy *key, value); }
               e => return e
             }
             self.parse_whitespace();
 
-            alt self.ch {
+            match self.ch {
               ',' => self.bump(),
               '}' => { self.bump(); return ok(dict(values)); }
               _ => {
@@ -477,7 +477,7 @@ fn from_str(s: ~str) -> result<json, error> {
 
 /// Test if two json values are equal
 fn eq(value0: json, value1: json) -> bool {
-    alt (value0, value1) {
+    match (value0, value1) {
       (num(f0), num(f1)) => f0 == f1,
       (string(s0), string(s1)) => s0 == s1,
       (boolean(b0), boolean(b1)) => b0 == b1,
@@ -486,7 +486,7 @@ fn eq(value0: json, value1: json) -> bool {
           if d0.size() == d1.size() {
               let mut equal = true;
               for d0.each |k, v0| {
-                  alt d1.find(k) {
+                  match d1.find(k) {
                     some(v1) => if !eq(v0, v1) { equal = false },
                     none => equal = false
                   }
@@ -581,7 +581,7 @@ fn to_json() -> json { string(self) }
 
 impl <A: to_json, B: to_json> of to_json for (A, B) {
     fn to_json() -> json {
-        alt self {
+        match self {
           (a, b) => {
             list(@~[a.to_json(), b.to_json()])
           }
@@ -592,7 +592,7 @@ fn to_json() -> json {
 impl <A: to_json, B: to_json, C: to_json>
   of to_json for (A, B, C) {
     fn to_json() -> json {
-        alt self {
+        match self {
           (a, b, c) => {
             list(@~[a.to_json(), b.to_json(), c.to_json()])
           }
@@ -616,7 +616,7 @@ fn to_json() -> json {
 
 impl <A: to_json> of to_json for option<A> {
     fn to_json() -> json {
-        alt self {
+        match self {
           none => null,
           some(value) => value.to_json()
         }
index 3538929e7283edd0f009759085ff80a8024fd4ed..4b8b75d3d666aab43ae5195b30a0dd0b5d8ca952 100644 (file)
@@ -43,7 +43,7 @@ fn foldl<T: copy, U>(z: T, ls: @list<U>, f: fn(T, U) -> T) -> T {
 fn find<T: copy>(ls: @list<T>, f: fn(T) -> bool) -> option<T> {
     let mut ls = ls;
     loop {
-        ls = alt *ls {
+        ls = match *ls {
           cons(hd, tl) => {
             if f(hd) { return some(hd); }
             tl
@@ -63,7 +63,7 @@ fn has<T: copy>(ls: @list<T>, elt: T) -> bool {
 
 /// Returns true if the list is empty
 pure fn is_empty<T: copy>(ls: @list<T>) -> bool {
-    alt *ls {
+    match *ls {
         nil => true,
         _ => false
     }
@@ -83,7 +83,7 @@ fn len<T>(ls: @list<T>) -> uint {
 
 /// Returns all but the first element of a list
 pure fn tail<T: copy>(ls: @list<T>) -> @list<T> {
-    alt *ls {
+    match *ls {
         cons(_, tl) => return tl,
         nil => fail ~"list empty"
     }
@@ -91,12 +91,12 @@ fn len<T>(ls: @list<T>) -> uint {
 
 /// Returns the first element of a list
 pure fn head<T: copy>(ls: @list<T>) -> T {
-    alt check *ls { cons(hd, _) => hd }
+    match check *ls { cons(hd, _) => hd }
 }
 
 /// Appends one list to another
 pure fn append<T: copy>(l: @list<T>, m: @list<T>) -> @list<T> {
-    alt *l {
+    match *l {
       nil => return m,
       cons(x, xs) => {
         let rest = append(xs, m);
@@ -114,7 +114,7 @@ fn push<T: copy>(&l: list<T>, v: T) {
 fn iter<T>(l: @list<T>, f: fn(T)) {
     let mut cur = l;
     loop {
-        cur = alt *cur {
+        cur = match *cur {
           cons(hd, tl) => {
             f(hd);
             tl
@@ -128,7 +128,7 @@ fn iter<T>(l: @list<T>, f: fn(T)) {
 fn each<T>(l: @list<T>, f: fn(T) -> bool) {
     let mut cur = l;
     loop {
-        cur = alt *cur {
+        cur = match *cur {
           cons(hd, tl) => {
             if !f(hd) { return; }
             tl
index 2b99c4cb8aa4c3a10e720a27e5400e8d1f99df6b..695f40fc3877d3218b29e1dc5b7d11f2362db3f1 100644 (file)
@@ -133,7 +133,7 @@ fn search_rem(k: &K, h: uint, idx: uint,
             let mut e0 = e_root;
             let mut comp = 1u;   // for logging
             loop {
-                alt copy e0.next {
+                match copy e0.next {
                   none => {
                     debug!{"search_tbl: absent, comp %u, hash %u, idx %u",
                            comp, h, idx};
@@ -156,7 +156,7 @@ fn search_rem(k: &K, h: uint, idx: uint,
 
         fn search_tbl(k: &K, h: uint) -> search_result<K,V> {
             let idx = h % vec::len(self.chains);
-            alt copy self.chains[idx] {
+            match copy self.chains[idx] {
               none => {
                 debug!{"search_tbl: none, comp %u, hash %u, idx %u",
                        0u, h, idx};
@@ -193,7 +193,7 @@ fn each_entry(blk: fn(@entry<K,V>) -> bool) {
             while i < n {
                 let mut chain = self.chains[i];
                 loop {
-                    chain = alt chain {
+                    chain = match chain {
                       none => break,
                       some(entry) => {
                         let next = entry.next;
@@ -216,7 +216,7 @@ fn contains_key(+k: K) -> bool {
 
         fn contains_key_ref(k: &K) -> bool {
             let hash = self.hasher(k);
-            alt self.search_tbl(k, hash) {
+            match self.search_tbl(k, hash) {
               not_found => false,
               found_first(*) | found_after(*) => true
             }
@@ -224,7 +224,7 @@ fn contains_key_ref(k: &K) -> bool {
 
         fn insert(+k: K, +v: V) -> bool {
             let hash = self.hasher(&k);
-            alt self.search_tbl(&k, hash) {
+            match self.search_tbl(&k, hash) {
               not_found => {
                 self.count += 1u;
                 let idx = hash % vec::len(self.chains);
@@ -265,7 +265,7 @@ fn insert(+k: K, +v: V) -> bool {
         }
 
         fn find(+k: K) -> option<V> {
-            alt self.search_tbl(&k, self.hasher(&k)) {
+            match self.search_tbl(&k, self.hasher(&k)) {
               not_found => none,
               found_first(_, entry) => some(entry.value),
               found_after(_, entry) => some(entry.value)
@@ -281,7 +281,7 @@ fn get(+k: K) -> V {
         }
 
         fn remove(+k: K) -> option<V> {
-            alt self.search_tbl(&k, self.hasher(&k)) {
+            match self.search_tbl(&k, self.hasher(&k)) {
               not_found => none,
               found_first(idx, entry) => {
                 self.count -= 1u;
@@ -638,7 +638,7 @@ fn hash(u: &uint) -> uint {
         i = 0u;
         while i < num_to_insert {
             let v = hm.remove(i);
-            alt v {
+            match v {
               option::some(u) => assert (u == i * i),
               option::none => fail
             }
index 1cc8dd3bed929fd99c89439770e602daa7ceacb4..d0b08212952989a6892ebff64a40270511071887 100644 (file)
@@ -47,7 +47,7 @@ enum ip_addr {
  * * ip - a `std::net::ip::ip_addr`
  */
 fn format_addr(ip: ip_addr) -> ~str {
-    alt ip {
+    match ip {
       ipv4(addr) =>  unsafe {
         let result = uv_ip4_name(&addr);
         if result == ~"" {
@@ -103,7 +103,7 @@ fn get_addr(++node: ~str, iotask: iotask)
                     node_ptr,
                     ptr::null(),
                     ptr::null());
-                alt result {
+                match result {
                   0i32 => {
                     set_data_for_req(handle_ptr, handle_data_ptr);
                   }
@@ -134,7 +134,7 @@ mod v4 {
      * * an `ip_addr` of the `ipv4` variant
      */
     fn parse_addr(ip: ~str) -> ip_addr {
-        alt try_parse_addr(ip) {
+        match try_parse_addr(ip) {
           result::ok(addr) => copy(addr),
           result::err(err_data) => fail err_data.err_msg
         }
@@ -155,7 +155,7 @@ unsafe fn as_u32() -> u32 {
     }
     fn parse_to_ipv4_rep(ip: ~str) -> result::result<ipv4_rep, ~str> {
         let parts = vec::map(str::split_char(ip, '.'), |s| {
-            alt uint::from_str(s) {
+            match uint::from_str(s) {
               some(n) if n <= 255u => n,
               _ => 256u
             }
@@ -220,7 +220,7 @@ mod v6 {
      * * an `ip_addr` of the `ipv6` variant
      */
     fn parse_addr(ip: ~str) -> ip_addr {
-        alt try_parse_addr(ip) {
+        match try_parse_addr(ip) {
           result::ok(addr) => copy(addr),
           result::err(err_data) => fail err_data.err_msg
         }
@@ -326,7 +326,7 @@ fn test_ip_ipv6_parse_and_format_ip() {
     }
     #[test]
     fn test_ip_ipv4_bad_parse() {
-        alt v4::try_parse_addr(~"b4df00d") {
+        match v4::try_parse_addr(~"b4df00d") {
           result::err(err_info) => {
             log(debug, fmt!{"got error as expected %?", err_info});
             assert true;
@@ -339,7 +339,7 @@ fn test_ip_ipv4_bad_parse() {
     #[test]
     #[ignore(target_os="win32")]
     fn test_ip_ipv6_bad_parse() {
-        alt v6::try_parse_addr(~"::,~2234k;") {
+        match v6::try_parse_addr(~"::,~2234k;") {
           result::err(err_info) => {
             log(debug, fmt!{"got error as expected %?", err_info});
             assert true;
@@ -364,7 +364,7 @@ fn test_ip_get_addr() {
         log(debug, fmt!{"test_get_addr: Number of results for %s: %?",
                         localhost_name, vec::len(results)});
         for vec::each(results) |r| {
-            let ipv_prefix = alt r {
+            let ipv_prefix = match r {
               ipv4(_) => ~"IPv4",
               ipv6(_) => ~"IPv6"
             };
index 2ce47a641c182a6d9f62267f2522888fe32e505a..4e25a42985a1689ba8ef738d5fc7aab9c0465f17 100644 (file)
@@ -151,16 +151,16 @@ fn connect(-input_ip: ip::ip_addr, port: uint,
         log(debug, ~"in interact cb for tcp client connect..");
         log(debug, fmt!{"stream_handle_ptr in interact %?",
             stream_handle_ptr});
-        alt uv::ll::tcp_init( loop_ptr, stream_handle_ptr) {
+        match uv::ll::tcp_init( loop_ptr, stream_handle_ptr) {
           0i32 => {
             log(debug, ~"tcp_init successful");
-            alt input_ip {
+            match input_ip {
               ipv4 => {
                 log(debug, ~"dealing w/ ipv4 connection..");
                 let connect_req_ptr =
                     ptr::addr_of((*socket_data_ptr).connect_req);
                 let addr_str = ip::format_addr(input_ip);
-                let connect_result = alt input_ip {
+                let connect_result = match input_ip {
                   ip::ipv4(addr) => {
                     // have to "recreate" the sockaddr_in/6
                     // since the ip_addr discards the port
@@ -185,7 +185,7 @@ fn connect(-input_ip: ip::ip_addr, port: uint,
                         tcp_connect_on_connect_cb)
                   }
                 };
-                alt connect_result {
+                match connect_result {
                   0i32 => {
                     log(debug, ~"tcp_connect successful");
                     // reusable data that we'll have for the
@@ -223,7 +223,7 @@ fn connect(-input_ip: ip::ip_addr, port: uint,
           }
         }
     };
-    alt comm::recv(result_po) {
+    match comm::recv(result_po) {
       conn_success => {
         log(debug, ~"tcp::connect - received success on result_po");
         result::ok(tcp_socket(socket_data))
@@ -234,7 +234,7 @@ fn connect(-input_ip: ip::ip_addr, port: uint,
         // still have to free the malloc'd stream handle..
         rustrt::rust_uv_current_kernel_free(stream_handle_ptr
                                            as *libc::c_void);
-        let tcp_conn_err = alt err_data.err_name {
+        let tcp_conn_err = match err_data.err_name {
           ~"ECONNREFUSED" => connection_refused,
           _ => generic_connect_err(err_data.err_name, err_data.err_msg)
         };
@@ -445,7 +445,7 @@ fn read_future(sock: tcp_socket, timeout_msecs: uint)
  *             // do work here
  *         }
  *     };
- *     alt comm::recv(cont_po) {
+ *     match comm::recv(cont_po) {
  *       // shut down listen()
  *       some(err_data) { comm::send(kill_chan, some(err_data)) }
  *       // wait for next connection
@@ -469,7 +469,7 @@ fn read_future(sock: tcp_socket, timeout_msecs: uint)
 fn accept(new_conn: tcp_new_connection)
     -> result::result<tcp_socket, tcp_err_data> unsafe {
 
-    alt new_conn{
+    match new_conn{
       new_tcp_conn(server_handle_ptr) => {
         let server_data_ptr = uv::ll::get_data_for_uv_handle(
             server_handle_ptr) as *tcp_listen_fc_data;
@@ -501,10 +501,10 @@ fn accept(new_conn: tcp_new_connection)
         log(debug, ~"in interact cb for tcp::accept");
         let loop_ptr = uv::ll::get_loop_for_uv_handle(
             server_handle_ptr);
-        alt uv::ll::tcp_init(loop_ptr, client_stream_handle_ptr) {
+        match uv::ll::tcp_init(loop_ptr, client_stream_handle_ptr) {
           0i32 => {
             log(debug, ~"uv_tcp_init successful for client stream");
-            alt uv::ll::accept(
+            match uv::ll::accept(
                 server_handle_ptr as *libc::c_void,
                 client_stream_handle_ptr as *libc::c_void) {
               0i32 => {
@@ -528,7 +528,7 @@ fn accept(new_conn: tcp_new_connection)
           }
         }
         // UNSAFE LIBUV INTERACTION END
-        alt comm::recv(result_po) {
+        match comm::recv(result_po) {
           some(err_data) => result::err(err_data),
           none => result::ok(tcp_socket(client_socket_data))
         }
@@ -610,13 +610,13 @@ fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint,
         // nested within a comm::listen block)
         let loc_ip = copy(host_ip);
         do iotask::interact(iotask) |loop_ptr| {
-            alt uv::ll::tcp_init(loop_ptr, server_stream_ptr) {
+            match uv::ll::tcp_init(loop_ptr, server_stream_ptr) {
               0i32 => {
                 uv::ll::set_data_for_uv_handle(
                     server_stream_ptr,
                     server_data_ptr);
                 let addr_str = ip::format_addr(loc_ip);
-                let bind_result = alt loc_ip {
+                let bind_result = match loc_ip {
                   ip::ipv4(addr) => {
                     log(debug, fmt!{"addr: %?", addr});
                     let in_addr = uv::ll::ip4_addr(addr_str, port as int);
@@ -630,9 +630,9 @@ fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint,
                                      ptr::addr_of(in_addr))
                   }
                 };
-                alt bind_result {
+                match bind_result {
                   0i32 => {
-                    alt uv::ll::listen(server_stream_ptr,
+                    match uv::ll::listen(server_stream_ptr,
                                        backlog as libc::c_int,
                                        tcp_lfc_on_connection_cb) {
                       0i32 => comm::send(setup_ch, none),
@@ -659,7 +659,7 @@ fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint,
         };
         setup_ch.recv()
     };
-    alt setup_result {
+    match setup_result {
       some(err_data) => {
         do iotask::interact(iotask) |loop_ptr| {
             log(debug, fmt!{"tcp::listen post-kill recv hl interact %?",
@@ -668,7 +668,7 @@ fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint,
             uv::ll::close(server_stream_ptr, tcp_lfc_close_cb);
         };
         stream_closed_po.recv();
-        alt err_data.err_name {
+        match err_data.err_name {
           ~"EACCES" => {
             log(debug, ~"Got EACCES error");
             result::err(access_denied)
@@ -695,7 +695,7 @@ fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint,
             uv::ll::close(server_stream_ptr, tcp_lfc_close_cb);
         };
         stream_closed_po.recv();
-        alt kill_result {
+        match kill_result {
           // some failure post bind/listen
           some(err_data) => result::err(generic_listen_err(err_data.err_name,
                                                            err_data.err_msg)),
@@ -878,7 +878,7 @@ fn read_common_impl(socket_data: *tcp_socket_data, timeout_msecs: uint)
             some(comm::recv(result::get(rs_result)))
         };
         log(debug, ~"tcp::read after recv_timeout");
-        alt read_result {
+        match read_result {
           none => {
             log(debug, ~"tcp::read: timed out..");
             let err_data = {
@@ -905,7 +905,7 @@ fn read_stop_common_impl(socket_data: *tcp_socket_data) ->
     let stop_ch = comm::chan(stop_po);
     do iotask::interact((*socket_data).iotask) |loop_ptr| {
         log(debug, ~"in interact cb for tcp::read_stop");
-        alt uv::ll::read_stop(stream_handle_ptr as *uv::ll::uv_stream_t) {
+        match uv::ll::read_stop(stream_handle_ptr as *uv::ll::uv_stream_t) {
           0i32 => {
             log(debug, ~"successfully called uv_read_stop");
             comm::send(stop_ch, none);
@@ -917,7 +917,7 @@ fn read_stop_common_impl(socket_data: *tcp_socket_data) ->
           }
         }
     };
-    alt comm::recv(stop_po) {
+    match comm::recv(stop_po) {
       some(err_data) => result::err(err_data.to_tcp_err()),
       none => result::ok(())
     }
@@ -933,7 +933,7 @@ fn read_start_common_impl(socket_data: *tcp_socket_data)
     log(debug, ~"in tcp::read_start before interact loop");
     do iotask::interact((*socket_data).iotask) |loop_ptr| {
         log(debug, fmt!{"in tcp::read_start interact cb %?", loop_ptr});
-        alt uv::ll::read_start(stream_handle_ptr as *uv::ll::uv_stream_t,
+        match uv::ll::read_start(stream_handle_ptr as *uv::ll::uv_stream_t,
                                on_alloc_cb,
                                on_tcp_read_cb) {
           0i32 => {
@@ -947,7 +947,7 @@ fn read_start_common_impl(socket_data: *tcp_socket_data)
           }
         }
     };
-    alt comm::recv(start_po) {
+    match comm::recv(start_po) {
       some(err_data) => result::err(err_data.to_tcp_err()),
       none => result::ok((*socket_data).reader_po)
     }
@@ -973,7 +973,7 @@ fn write_common_impl(socket_data_ptr: *tcp_socket_data,
     let write_data_ptr = ptr::addr_of(write_data);
     do iotask::interact((*socket_data_ptr).iotask) |loop_ptr| {
         log(debug, fmt!{"in interact cb for tcp::write %?", loop_ptr});
-        alt uv::ll::write(write_req_ptr,
+        match uv::ll::write(write_req_ptr,
                           stream_handle_ptr,
                           write_buf_vec_ptr,
                           tcp_write_complete_cb) {
@@ -993,7 +993,7 @@ fn write_common_impl(socket_data_ptr: *tcp_socket_data,
     // and waiting here for the write to complete, we should transfer
     // ownership of everything to the I/O task and let it deal with the
     // aftermath, so we don't have to sit here blocking.
-    alt comm::recv(result_po) {
+    match comm::recv(result_po) {
       tcp_write_success => result::ok(()),
       tcp_write_error(err_data) => result::err(err_data.to_tcp_err())
     }
@@ -1024,7 +1024,7 @@ enum tcp_new_connection {
         as *tcp_listen_fc_data;
     let kill_ch = (*server_data_ptr).kill_ch;
     if (*server_data_ptr).active {
-        alt status {
+        match status {
           0i32 => (*server_data_ptr).on_connect_cb(handle),
           _ => {
             let loop_ptr = uv::ll::get_loop_for_uv_handle(handle);
@@ -1081,7 +1081,7 @@ fn to_tcp_err() -> tcp_err_data {
     let loop_ptr = uv::ll::get_loop_for_uv_handle(stream);
     let socket_data_ptr = uv::ll::get_data_for_uv_handle(stream)
         as *tcp_socket_data;
-    alt nread as int {
+    match nread as int {
       // incoming err.. probably eof
       -1 => {
         let err_data = uv::ll::get_last_err_data(loop_ptr).to_tcp_err();
@@ -1175,7 +1175,7 @@ fn to_tcp_err() -> tcp_err_data {
     log(debug, fmt!{"tcp_connect result_ch %?", result_ch});
     let tcp_stream_ptr =
         uv::ll::get_stream_handle_from_connect_req(connect_req_ptr);
-    alt status {
+    match status {
       0i32 => {
         log(debug, ~"successful tcp connection!");
         comm::send(result_ch, conn_success);
@@ -1336,7 +1336,7 @@ fn impl_gl_tcp_ipv4_client_error_connection_refused() {
                 client_ch,
                 hl_loop)
         };
-        alt actual_resp_result.get_err() {
+        match actual_resp_result.get_err() {
           connection_refused => (),
           _ => fail ~"unknown error.. expected connection_refused"
         }
@@ -1382,7 +1382,7 @@ fn impl_gl_tcp_ipv4_server_address_in_use() {
                 client_ch,
                 hl_loop)
         };
-        alt listen_err {
+        match listen_err {
           address_in_use => {
             assert true;
           }
@@ -1401,7 +1401,7 @@ fn impl_gl_tcp_ipv4_server_access_denied() {
                             server_ip,
                             server_port,
                             hl_loop);
-        alt listen_err {
+        match listen_err {
           access_denied => {
             assert true;
           }
@@ -1515,7 +1515,7 @@ fn run_tcp_test_server(server_ip: ~str, server_port: uint, resp: ~str,
                         log(debug, ~"SERVER: successfully accepted"+
                             ~"connection!");
                         let received_req_bytes = read(sock, 0u);
-                        alt received_req_bytes {
+                        match received_req_bytes {
                           result::ok(data) => {
                             log(debug, ~"SERVER: got REQ str::from_bytes..");
                             log(debug, fmt!{"SERVER: REQ data len: %?",
@@ -1544,7 +1544,7 @@ fn run_tcp_test_server(server_ip: ~str, server_port: uint, resp: ~str,
         });
         // err check on listen_result
         if result::is_err(listen_result) {
-            alt result::get_err(listen_result) {
+            match result::get_err(listen_result) {
               generic_listen_err(name, msg) => {
                 fail fmt!{"SERVER: exited abnormally name %s msg %s",
                                 name, msg};
index 5c779e37507f1c647f12cc68d2fb536a45a372a4..215d5b4f5e15148b79149341f269d4601c03d735 100644 (file)
@@ -133,10 +133,10 @@ fn prepend_str(rope: rope, str: @~str) -> rope {
 
 /// Concatenate two ropes
 fn append_rope(left: rope, right: rope) -> rope {
-   alt(left) {
+   match (left) {
      node::empty => return right,
      node::content(left_content) => {
-       alt(right) {
+       match (right) {
          node::empty => return left,
          node::content(right_content) => {
            return node::content(node::concat2(left_content, right_content));
@@ -197,9 +197,9 @@ fn concat(v: ~[rope]) -> rope {
  * to rebalance your rope at some point, before using it for other purposes.
  */
 fn bal(rope:rope) -> rope {
-    alt(rope) {
+    match (rope) {
       node::empty => return rope,
-      node::content(x) => alt(node::bal(x)) {
+      node::content(x) => match (node::bal(x)) {
         option::none    => rope,
         option::some(y) => node::content(y)
       }
@@ -226,7 +226,7 @@ fn bal(rope:rope) -> rope {
  */
 fn sub_chars(rope: rope, char_offset: uint, char_len: uint) -> rope {
     if char_len == 0u { return node::empty; }
-    alt(rope) {
+    match (rope) {
       node::empty => fail,
       node::content(node) => if char_len > node::char_len(node) {
         fail
@@ -251,7 +251,7 @@ fn sub_chars(rope: rope, char_offset: uint, char_len: uint) -> rope {
  */
 fn sub_bytes(rope: rope, byte_offset: uint, byte_len: uint) -> rope {
     if byte_len == 0u { return node::empty; }
-    alt(rope) {
+    match (rope) {
       node::empty => fail,
       node::content(node) =>if byte_len > node::byte_len(node) {
         fail
@@ -276,7 +276,7 @@ fn sub_bytes(rope: rope, byte_offset: uint, byte_len: uint) -> rope {
  * value if `left > right`
  */
 fn cmp(left: rope, right: rope) -> int {
-    alt((left, right)) {
+    match ((left, right)) {
       (node::empty, node::empty) => return 0,
       (node::empty, _)     => return -1,
       (_, node::empty)     => return  1,
@@ -379,7 +379,7 @@ fn gt(left: rope, right: rope) -> bool {
  * that is if `it` returned `false` at any point.
  */
 fn loop_chars(rope: rope, it: fn(char) -> bool) -> bool {
-   alt(rope) {
+   match (rope) {
       node::empty => return true,
       node::content(x) => return node::loop_chars(x, it)
    }
@@ -422,7 +422,7 @@ fn iter_chars(rope: rope, it: fn(char)) {
  * that is if `it` returned `false` at any point.
  */
 fn loop_leaves(rope: rope, it: fn(node::leaf) -> bool) -> bool{
-   alt(rope) {
+   match (rope) {
       node::empty => return true,
       node::content(x) => return node::loop_leaves(x, it)
    }
@@ -431,7 +431,7 @@ fn loop_leaves(rope: rope, it: fn(node::leaf) -> bool) -> bool{
 mod iterator {
     mod leaf {
         fn start(rope: rope) -> node::leaf_iterator::t {
-            alt(rope) {
+            match (rope) {
               node::empty      => return node::leaf_iterator::empty(),
               node::content(x) => return node::leaf_iterator::start(x)
             }
@@ -442,7 +442,7 @@ fn next(it: node::leaf_iterator::t) -> option<node::leaf> {
     }
     mod char {
         fn start(rope: rope) -> node::char_iterator::t {
-            alt(rope) {
+            match (rope) {
               node::empty      => return node::char_iterator::empty(),
               node::content(x) => return node::char_iterator::start(x)
             }
@@ -469,7 +469,7 @@ fn next(it: node::char_iterator::t) -> option<char> {
  * Constant time.
  */
 fn height(rope: rope) -> uint {
-   alt(rope) {
+   match (rope) {
       node::empty      => return 0u,
       node::content(x) => return node::height(x)
    }
@@ -485,7 +485,7 @@ fn height(rope: rope) -> uint {
  * Constant time.
  */
 pure fn char_len(rope: rope) -> uint {
-   alt(rope) {
+   match (rope) {
      node::empty            => return 0u,
      node::content(x)       => return node::char_len(x)
    }
@@ -499,7 +499,7 @@ fn height(rope: rope) -> uint {
  * Constant time.
  */
 pure fn byte_len(rope: rope) -> uint {
-   alt(rope) {
+   match (rope) {
      node::empty            => return 0u,
      node::content(x)       => return node::byte_len(x)
    }
@@ -522,7 +522,7 @@ fn height(rope: rope) -> uint {
  * rope + the (bounded) length of the largest leaf.
  */
 fn char_at(rope: rope, pos: uint) -> char {
-   alt(rope) {
+   match (rope) {
       node::empty => fail,
       node::content(x) => return node::char_at(x, pos)
    }
@@ -730,14 +730,14 @@ fn of_substr_unsafer(str: @~str, byte_start: uint, byte_len: uint,
 
     pure fn byte_len(node: @node) -> uint {
         //FIXME (#2744): Could we do this without the pattern-matching?
-        alt(*node) {
+        match (*node) {
           leaf(y)   => return y.byte_len,
           concat(y) => return y.byte_len
         }
     }
 
     pure fn char_len(node: @node) -> uint {
-        alt(*node) {
+        match (*node) {
           leaf(y)   => return y.char_len,
           concat(y) => return y.char_len
         }
@@ -800,7 +800,7 @@ fn serialize_node(node: @node) -> ~str unsafe {
         let mut offset = 0u;//Current position in the buffer
         let it = leaf_iterator::start(node);
         loop {
-            alt(leaf_iterator::next(it)) {
+            match (leaf_iterator::next(it)) {
               option::none => break,
               option::some(x) => {
                 //FIXME (#2744): Replace with memcpy or something similar
@@ -827,7 +827,7 @@ fn serialize_node(node: @node) -> ~str unsafe {
      * This function executes in linear time.
      */
     fn flatten(node: @node) -> @node unsafe {
-        alt(*node) {
+        match (*node) {
           leaf(_) => return node,
           concat(x) => {
             return @leaf({
@@ -861,7 +861,7 @@ fn bal(node: @node) -> option<@node> {
         let mut forest = ~[mut];
         let it = leaf_iterator::start(node);
         loop {
-            alt (leaf_iterator::next(it)) {
+            match (leaf_iterator::next(it)) {
               option::none    => break,
               option::some(x) => vec::push(forest, @leaf(x))
             }
@@ -898,7 +898,7 @@ fn sub_bytes(node: @node, byte_offset: uint, byte_len: uint) -> @node {
             if byte_offset == 0u && byte_len == node::byte_len(node) {
                 return node;
             }
-            alt(*node) {
+            match (*node) {
               node::leaf(x) => {
                 let char_len =
                     str::count_chars(*x.content, byte_offset, byte_len);
@@ -956,7 +956,7 @@ fn sub_chars(node: @node, char_offset: uint, char_len: uint) -> @node {
         let mut node        = node;
         let mut char_offset = char_offset;
         loop {
-            alt(*node) {
+            match (*node) {
               node::leaf(x) => {
                 if char_offset == 0u && char_len == x.char_len {
                     return node;
@@ -1007,7 +1007,7 @@ fn concat2(left: @node, right: @node) -> @node {
     }
 
     fn height(node: @node) -> uint {
-        alt(*node) {
+        match (*node) {
           leaf(_)   => return 0u,
           concat(x) => return x.height
         }
@@ -1018,7 +1018,7 @@ fn cmp(a: @node, b: @node) -> int {
         let itb = char_iterator::start(b);
         let mut result = 0;
         while result == 0 {
-            alt((char_iterator::next(ita), char_iterator::next(itb))) {
+            match ((char_iterator::next(ita), char_iterator::next(itb))) {
               (option::none, option::none) => break,
               (option::some(chara), option::some(charb)) => {
                 result = char::cmp(chara, charb);
@@ -1059,7 +1059,7 @@ fn loop_chars(node: @node, it: fn(char) -> bool) -> bool {
     fn loop_leaves(node: @node, it: fn(leaf) -> bool) -> bool{
         let mut current = node;
         loop {
-            alt(*current) {
+            match (*current) {
               leaf(x) => return it(x),
               concat(x) => if loop_leaves(x.left, it) { //non tail call
                 current = x.right;       //tail call
@@ -1091,7 +1091,7 @@ fn char_at(node: @node, pos: uint) -> char {
         let mut node    = node;
         let mut pos     = pos;
         loop {
-            alt *node {
+            match *node {
               leaf(x) => return str::char_at(*x.content, pos),
               concat({left, right, _}) => {
                 let left_len = char_len(left);
@@ -1126,7 +1126,7 @@ fn next(it: t) -> option<leaf> {
             loop {
                 let current = it.stack[it.stackpos];
                 it.stackpos -= 1;
-                alt(*current) {
+                match (*current) {
                   concat(x) => {
                     it.stackpos += 1;
                     it.stack[it.stackpos] = x.right;
@@ -1164,11 +1164,11 @@ fn empty() -> t {
 
         fn next(it: t) -> option<char> {
             loop {
-                alt(get_current_or_next_leaf(it)) {
+                match (get_current_or_next_leaf(it)) {
                   option::none => return option::none,
                   option::some(_) => {
                     let next_char = get_next_char_in_leaf(it);
-                    alt(next_char) {
+                    match (next_char) {
                       option::none => again,
                       option::some(_) => return next_char
                     }
@@ -1178,11 +1178,11 @@ fn next(it: t) -> option<char> {
         }
 
         fn get_current_or_next_leaf(it: t) -> option<leaf> {
-            alt(it.leaf) {
+            match (it.leaf) {
               option::some(_) => return it.leaf,
               option::none => {
                 let next = leaf_iterator::next(it.leaf_iterator);
-                alt(next) {
+                match (next) {
                   option::none => return option::none,
                   option::some(_) => {
                     it.leaf          = next;
@@ -1195,7 +1195,7 @@ fn get_current_or_next_leaf(it: t) -> option<leaf> {
         }
 
         fn get_next_char_in_leaf(it: t) -> option<char> {
-            alt copy it.leaf {
+            match copy it.leaf {
               option::none => return option::none,
               option::some(aleaf) => {
                 if it.leaf_byte_pos >= aleaf.byte_len {
@@ -1220,12 +1220,12 @@ mod tests {
 
     //Utility function, used for sanity check
     fn rope_to_string(r: rope) -> ~str {
-        alt(r) {
+        match (r) {
           node::empty => return ~"",
           node::content(x) => {
             let str = @mut ~"";
             fn aux(str: @mut ~str, node: @node::node) unsafe {
-                alt(*node) {
+                match (*node) {
                   node::leaf(x) => {
                     *str += str::slice(
                         *x.content, x.byte_offset,
@@ -1274,7 +1274,7 @@ fn of_string2() {
         let rope_iter   = iterator::char::start(r);
         let mut equal   = true;
         while equal {
-            alt(node::char_iterator::next(rope_iter)) {
+            match (node::char_iterator::next(rope_iter)) {
               option::none => {
                 if string_iter < string_len {
                     equal = false;
@@ -1301,7 +1301,7 @@ fn iter1() {
         let mut len = 0u;
         let it  = iterator::char::start(r);
         loop {
-            alt(node::char_iterator::next(it)) {
+            match (node::char_iterator::next(it)) {
               option::none => break,
               option::some(_) => len += 1u
             }
index 622d31c00b926028f7b0e3cd3f112abe7dbe0cb8..86421ea3e74740632946afeeaac84c4fbd92ab62 100644 (file)
@@ -243,7 +243,7 @@ fn deserialize_bool<D: deserializer>(d: D) -> bool {
 
 fn serialize_option<S: serializer,T>(s: S, v: option<T>, st: fn(T)) {
     do s.emit_enum(~"option") {
-        alt v {
+        match v {
           none => do s.emit_enum_variant(~"none", 0u, 0u) {
           }
 
@@ -260,7 +260,7 @@ fn deserialize_option<D: deserializer,T: copy>(d: D, st: fn() -> T)
     -> option<T> {
     do d.read_enum(~"option") {
         do d.read_enum_variant |i| {
-            alt check i {
+            match check i {
               0u => none,
               1u => some(d.read_enum_variant_arg(0u, || st() ))
             }
index 2fe09f75d56c714b9e2326d8a4412568966ad7be..6ed2a397b3f6f90abd830327ae5ab80c040fe126 100644 (file)
@@ -48,7 +48,7 @@ fn insert<T: copy>(self: smallintmap<T>, key: uint, val: T) {
  * If the key does not exist in the map
  */
 pure fn get<T: copy>(self: smallintmap<T>, key: uint) -> T {
-    alt find(self, key) {
+    match find(self, key) {
       none => {
         error!{"smallintmap::get(): key not present"};
         fail;
@@ -67,7 +67,7 @@ impl <V: copy> of map::map<uint, V> for smallintmap<V> {
     fn size() -> uint {
         let mut sz = 0u;
         for self.v.each |item| {
-            alt item {
+            match item {
               some(_) => sz += 1u,
               _ => ()
             }
@@ -103,7 +103,7 @@ fn rehash() { fail }
     fn each(it: fn(+key: uint, +value: V) -> bool) {
         let mut idx = 0u, l = self.v.len();
         while idx < l {
-            alt self.v.get_elt(idx) {
+            match self.v.get_elt(idx) {
               some(elt) => if !it(idx, elt) { break }
               none => ()
             }
@@ -119,7 +119,7 @@ fn each_value(it: fn(+value: V) -> bool) {
     fn each_ref(it: fn(key: &uint, value: &V) -> bool) {
         let mut idx = 0u, l = self.v.len();
         while idx < l {
-            alt self.v.get_elt(idx) {
+            match self.v.get_elt(idx) {
               some(elt) => if !it(&idx, &elt) { break }
               none => ()
             }
index a67164ee1076420a62c053dbab9763e155357775..1ebfe6955193e0c74d3d379664c261f027b6cb58 100644 (file)
@@ -21,7 +21,7 @@ fn mkdtemp(prefix: ~str, suffix: ~str) -> option<~str> {
 #[test]
 fn test_mkdtemp() {
     let r = mkdtemp(~"./", ~"foobar");
-    alt r {
+    match r {
         some(p) => {
             os::remove_dir(p);
             assert(str::ends_with(p, ~"foobar"));
index 1d2ae7bca5dd451504fe5dfcccdd7a82932ff8f7..0d3112238476819c1c6db863d617ff0546384093 100644 (file)
@@ -35,7 +35,7 @@ fn reset(writer: io::writer) {
 fn color_supported() -> bool {
     let supported_terms = ~[~"xterm-color", ~"xterm",
                            ~"screen-bce", ~"xterm-256color"];
-    return alt os::getenv(~"TERM") {
+    return match os::getenv(~"TERM") {
           option::some(env) => {
             for vec::each(supported_terms) |term| {
                 if term == env { return true; }
index 890bddb3519fe9079453f96a62ebdbb309c06cd7..a4b52c5168594d9e48f31ecc18721dd9e02ad6ea 100644 (file)
@@ -52,7 +52,7 @@
 // arguments and a vector of test_descs (generated at compile time).
 fn test_main(args: ~[~str], tests: ~[test_desc]) {
     let opts =
-        alt parse_opts(args) {
+        match parse_opts(args) {
           either::left(o) => o,
           either::right(m) => fail m
         };
@@ -69,7 +69,7 @@ fn parse_opts(args: ~[~str]) -> opt_res {
     let args_ = vec::tail(args);
     let opts = ~[getopts::optflag(~"ignored"), getopts::optopt(~"logfile")];
     let matches =
-        alt getopts::getopts(args_, opts) {
+        match getopts::getopts(args_, opts) {
           ok(m) => m,
           err(f) => return either::right(getopts::fail_str(f))
         };
@@ -105,7 +105,7 @@ fn run_tests_console(opts: test_opts,
                      tests: ~[test_desc]) -> bool {
 
     fn callback(event: testevent, st: console_test_state) {
-        alt event {
+        match event {
           te_filtered(filtered_tests) => {
             st.total = vec::len(filtered_tests);
             let noun = if st.total != 1u { ~"tests" } else { ~"test" };
@@ -113,11 +113,11 @@ fn callback(event: testevent, st: console_test_state) {
           }
           te_wait(test) => st.out.write_str(fmt!{"test %s ... ", test.name}),
           te_result(test, result) => {
-            alt st.log_out {
+            match st.log_out {
                 some(f) => write_log(f, result, test),
                 none => ()
             }
-            alt result {
+            match result {
               tr_ok => {
                 st.passed += 1u;
                 write_ok(st.out, st.use_color);
@@ -139,8 +139,9 @@ fn callback(event: testevent, st: console_test_state) {
         }
     }
 
-    let log_out = alt opts.logfile {
-        some(path) => alt io::file_writer(path, ~[io::create, io::truncate]) {
+    let log_out = match opts.logfile {
+        some(path) => match io::file_writer(path,
+                                            ~[io::create, io::truncate]) {
           result::ok(w) => some(w),
           result::err(s) => {
               fail(fmt!{"can't open output file: %s", s})
@@ -180,7 +181,7 @@ fn callback(event: testevent, st: console_test_state) {
 
     fn write_log(out: io::writer, result: test_result, test: test_desc) {
         out.write_line(fmt!{"%s %s",
-                    alt result {
+                    match result {
                         tr_ok => ~"ok",
                         tr_failed => ~"failed",
                         tr_ignored => ~"ignored"
@@ -334,7 +335,7 @@ fn filter_tests(opts: test_opts,
         filtered
     } else {
         let filter_str =
-            alt opts.filter {
+            match opts.filter {
           option::some(f) => f,
           option::none => ~""
         };
@@ -479,7 +480,7 @@ fn f() { }
     #[test]
     fn first_free_arg_should_be_a_filter() {
         let args = ~[~"progname", ~"filter"];
-        let opts = alt parse_opts(args) {
+        let opts = match parse_opts(args) {
           either::left(o) => o,
           _ => fail ~"Malformed arg in first_free_arg_should_be_a_filter"
         };
@@ -489,7 +490,7 @@ fn first_free_arg_should_be_a_filter() {
     #[test]
     fn parse_ignored_flag() {
         let args = ~[~"progname", ~"filter", ~"--ignored"];
-        let opts = alt parse_opts(args) {
+        let opts = match parse_opts(args) {
           either::left(o) => o,
           _ => fail ~"Malformed arg in parse_ignored_flag"
         };
index 23b6bf222762448442efdb4248d493e0e81ad7da..3a4b5f3ccd927d61d3db798951232d383970f525 100644 (file)
@@ -181,7 +181,7 @@ fn match_digits(s: ~str, pos: uint, digits: uint, ws: bool)
             let {ch, next} = str::char_range_at(s, pos);
             pos = next;
 
-            alt ch {
+            match ch {
               '0' to '9' => {
                 value = value * 10_i32 + (ch as i32 - '0' as i32);
               }
@@ -208,8 +208,8 @@ fn parse_char(s: ~str, pos: uint, c: char) -> result<uint, ~str> {
 
     fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
       -> result<uint, ~str> {
-        alt ch {
-          'A' => alt match_strs(s, pos, ~[
+        match ch {
+          'A' => match match_strs(s, pos, ~[
               (~"Sunday", 0_i32),
               (~"Monday", 1_i32),
               (~"Tuesday", 2_i32),
@@ -221,7 +221,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
             some(item) => { let (v, pos) = item; tm.tm_wday = v; ok(pos) }
             none => err(~"Invalid day")
           }
-          'a' => alt match_strs(s, pos, ~[
+          'a' => match match_strs(s, pos, ~[
               (~"Sun", 0_i32),
               (~"Mon", 1_i32),
               (~"Tue", 2_i32),
@@ -233,7 +233,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
             some(item) => { let (v, pos) = item; tm.tm_wday = v; ok(pos) }
             none => err(~"Invalid day")
           }
-          'B' => alt match_strs(s, pos, ~[
+          'B' => match match_strs(s, pos, ~[
               (~"January", 0_i32),
               (~"February", 1_i32),
               (~"March", 2_i32),
@@ -250,7 +250,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
             some(item) => { let (v, pos) = item; tm.tm_mon = v; ok(pos) }
             none => err(~"Invalid month")
           }
-          'b' | 'h' => alt match_strs(s, pos, ~[
+          'b' | 'h' => match match_strs(s, pos, ~[
               (~"Jan", 0_i32),
               (~"Feb", 1_i32),
               (~"Mar", 2_i32),
@@ -267,7 +267,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
             some(item) => { let (v, pos) = item; tm.tm_mon = v; ok(pos) }
             none => err(~"Invalid month")
           }
-          'C' => alt match_digits(s, pos, 2u, false) {
+          'C' => match match_digits(s, pos, 2u, false) {
             some(item) => {
                 let (v, pos) = item;
                   tm.tm_year += (v * 100_i32) - 1900_i32;
@@ -293,11 +293,11 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
                 .chain(|pos| parse_char(s, pos, '/'))
                 .chain(|pos| parse_type(s, pos, 'y', tm))
           }
-          'd' => alt match_digits(s, pos, 2u, false) {
+          'd' => match match_digits(s, pos, 2u, false) {
             some(item) => { let (v, pos) = item; tm.tm_mday = v; ok(pos) }
             none => err(~"Invalid day of the month")
           }
-          'e' => alt match_digits(s, pos, 2u, true) {
+          'e' => match match_digits(s, pos, 2u, true) {
             some(item) => { let (v, pos) = item; tm.tm_mday = v; ok(pos) }
             none => err(~"Invalid day of the month")
           }
@@ -310,14 +310,14 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
           }
           'H' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 2u, false) {
+            match match_digits(s, pos, 2u, false) {
               some(item) => { let (v, pos) = item; tm.tm_hour = v; ok(pos) }
               none => err(~"Invalid hour")
             }
           }
           'I' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 2u, false) {
+            match match_digits(s, pos, 2u, false) {
               some(item) => {
                   let (v, pos) = item;
                   tm.tm_hour = if v == 12_i32 { 0_i32 } else { v };
@@ -328,7 +328,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
           }
           'j' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 3u, false) {
+            match match_digits(s, pos, 3u, false) {
               some(item) => {
                 let (v, pos) = item;
                 tm.tm_yday = v - 1_i32;
@@ -339,14 +339,14 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
           }
           'k' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 2u, true) {
+            match match_digits(s, pos, 2u, true) {
               some(item) => { let (v, pos) = item; tm.tm_hour = v; ok(pos) }
               none => err(~"Invalid hour")
             }
           }
           'l' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 2u, true) {
+            match match_digits(s, pos, 2u, true) {
               some(item) => {
                   let (v, pos) = item;
                   tm.tm_hour = if v == 12_i32 { 0_i32 } else { v };
@@ -357,14 +357,14 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
           }
           'M' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 2u, false) {
+            match match_digits(s, pos, 2u, false) {
               some(item) => { let (v, pos) = item; tm.tm_min = v; ok(pos) }
               none => err(~"Invalid minute")
             }
           }
           'm' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 2u, false) {
+            match match_digits(s, pos, 2u, false) {
               some(item) => {
                 let (v, pos) = item;
                 tm.tm_mon = v - 1_i32;
@@ -374,11 +374,15 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
             }
           }
           'n' => parse_char(s, pos, '\n'),
-          'P' => alt match_strs(s, pos, ~[(~"am", 0_i32), (~"pm", 12_i32)]) {
+          'P' => match match_strs(s, pos,
+                                  ~[(~"am", 0_i32), (~"pm", 12_i32)]) {
+
             some(item) => { let (v, pos) = item; tm.tm_hour += v; ok(pos) }
             none => err(~"Invalid hour")
           }
-          'p' => alt match_strs(s, pos, ~[(~"AM", 0_i32), (~"PM", 12_i32)]) {
+          'p' => match match_strs(s, pos,
+                                  ~[(~"AM", 0_i32), (~"PM", 12_i32)]) {
+
             some(item) => { let (v, pos) = item; tm.tm_hour += v; ok(pos) }
             none => err(~"Invalid hour")
           }
@@ -398,7 +402,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
           }
           'S' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 2u, false) {
+            match match_digits(s, pos, 2u, false) {
               some(item) => {
                 let (v, pos) = item;
                 tm.tm_sec = v;
@@ -418,7 +422,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
           't' => parse_char(s, pos, '\t'),
           'u' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 1u, false) {
+            match match_digits(s, pos, 1u, false) {
               some(item) => {
                 let (v, pos) = item;
                 tm.tm_wday = v;
@@ -437,7 +441,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
           //'W' {}
           'w' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 1u, false) {
+            match match_digits(s, pos, 1u, false) {
               some(item) => { let (v, pos) = item; tm.tm_wday = v; ok(pos) }
               none => err(~"Invalid weekday")
             }
@@ -446,7 +450,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
           //'x' {}
           'Y' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 4u, false) {
+            match match_digits(s, pos, 4u, false) {
               some(item) => {
                 let (v, pos) = item;
                 tm.tm_year = v - 1900_i32;
@@ -457,7 +461,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
           }
           'y' => {
             // FIXME (#2350): range check.
-            alt match_digits(s, pos, 2u, false) {
+            match match_digits(s, pos, 2u, false) {
               some(item) => {
                 let (v, pos) = item;
                 tm.tm_year = v - 1900_i32;
@@ -489,7 +493,7 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
             let {ch, next} = str::char_range_at(s, pos);
 
             if ch == '+' || ch == '-' {
-                alt match_digits(s, next, 4u, false) {
+                match match_digits(s, next, 4u, false) {
                   some(item) => {
                     let (v, pos) = item;
                     if v == 0_i32 {
@@ -534,8 +538,8 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
         while !rdr.eof() && pos < len {
             let {ch, next} = str::char_range_at(s, pos);
 
-            alt rdr.read_char() {
-              '%' => alt parse_type(s, pos, rdr.read_char(), tm) {
+            match rdr.read_char() {
+              '%' => match parse_type(s, pos, rdr.read_char(), tm) {
                 ok(next) => pos = next,
                   err(e) => { result = err(e); break; }
               }
@@ -568,8 +572,8 @@ fn parse_type(s: ~str, pos: uint, ch: char, tm: tm_mut)
 fn strftime(format: ~str, tm: tm) -> ~str {
     fn parse_type(ch: char, tm: tm) -> ~str {
         //FIXME (#2350): Implement missing types.
-        alt check ch {
-          'A' => alt check tm.tm_wday as int {
+        match check ch {
+          'A' => match check tm.tm_wday as int {
             0 => ~"Sunday",
             1 => ~"Monday",
             2 => ~"Tuesday",
@@ -578,7 +582,7 @@ fn parse_type(ch: char, tm: tm) -> ~str {
             5 => ~"Friday",
             6 => ~"Saturday"
           }
-          'a' => alt check tm.tm_wday as int {
+          'a' => match check tm.tm_wday as int {
             0 => ~"Sun",
             1 => ~"Mon",
             2 => ~"Tue",
@@ -587,7 +591,7 @@ fn parse_type(ch: char, tm: tm) -> ~str {
             5 => ~"Fri",
             6 => ~"Sat"
           }
-          'B' => alt check tm.tm_mon as int {
+          'B' => match check tm.tm_mon as int {
             0 => ~"January",
             1 => ~"February",
             2 => ~"March",
@@ -601,7 +605,7 @@ fn parse_type(ch: char, tm: tm) -> ~str {
             10 => ~"November",
             11 => ~"December"
           }
-          'b' | 'h' => alt check tm.tm_mon as int {
+          'b' | 'h' => match check tm.tm_mon as int {
             0 => ~"Jan",
             1 => ~"Feb",
             2 => ~"Mar",
@@ -716,7 +720,7 @@ fn parse_type(ch: char, tm: tm) -> ~str {
 
     do io::with_str_reader(format) |rdr| {
         while !rdr.eof() {
-            alt rdr.read_char() {
+            match rdr.read_char() {
                 '%' => buf += parse_type(rdr.read_char(), tm),
                 ch => str::push_char(buf, ch)
             }
@@ -932,7 +936,7 @@ fn test_strptime() {
         os::setenv(~"TZ", ~"America/Los_Angeles");
         tzset();
 
-        alt strptime(~"", ~"") {
+        match strptime(~"", ~"") {
           ok(tm) => {
             assert tm.tm_sec == 0_i32;
             assert tm.tm_min == 0_i32;
@@ -954,7 +958,7 @@ fn test_strptime() {
         assert strptime(~"Fri Feb 13 15:31:30", format)
             == err(~"Invalid time");
 
-        alt strptime(~"Fri Feb 13 15:31:30 2009", format) {
+        match strptime(~"Fri Feb 13 15:31:30 2009", format) {
           err(e) => fail e,
           ok(tm) => {
             assert tm.tm_sec == 30_i32;
@@ -973,7 +977,7 @@ fn test_strptime() {
         }
 
         fn test(s: ~str, format: ~str) -> bool {
-            alt strptime(s, format) {
+            match strptime(s, format) {
               ok(tm) => tm.strftime(format) == s,
               err(e) => fail e
             }
index de629d98d6353eae64b28ff27b99ab044b947d1c..d19d7a1adccc473603b85bc93828e5d083054695 100644 (file)
@@ -215,7 +215,7 @@ fn test_gl_timer_recv_timeout_before_time_passes() {
                 delayed_send(hl_loop, 1u, test_ch, expected);
             };
 
-            alt recv_timeout(hl_loop, 10u, test_po) {
+            match recv_timeout(hl_loop, 10u, test_po) {
               some(val) => {
                 assert val == expected;
                 successes += 1;
@@ -243,7 +243,7 @@ fn test_gl_timer_recv_timeout_after_time_passes() {
                 delayed_send(hl_loop, 1000u, test_ch, expected);
             };
 
-            alt recv_timeout(hl_loop, 1u, test_po) {
+            match recv_timeout(hl_loop, 1u, test_po) {
               none => successes += 1,
               _ => failures += 1
             };
index ab7330fb1eecab16467c188ee01b28aa055008ef..65dbadb4a53e0b53e04e1ce3fdcbf922998de6ea 100644 (file)
@@ -30,7 +30,7 @@ fn treemap<K, V>() -> treemap<K, V> { @mut none }
 
 /// Insert a value into the map
 fn insert<K: copy, V: copy>(m: &mut tree_edge<K, V>, k: K, v: V) {
-    alt copy *m {
+    match copy *m {
       none => {
         *m = some(@tree_node({key: k,
                               mut value: v,
@@ -52,7 +52,7 @@ fn insert<K: copy, V: copy>(m: &mut tree_edge<K, V>, k: K, v: V) {
 
 /// Find a value based on the key
 fn find<K: copy, V: copy>(m: &const tree_edge<K, V>, k: K) -> option<V> {
-    alt copy *m {
+    match copy *m {
       none => none,
 
       // FIXME (#2808): was that an optimization?
@@ -70,7 +70,7 @@ fn find<K: copy, V: copy>(m: &const tree_edge<K, V>, k: K) -> option<V> {
 
 /// Visit all pairs in the map in order.
 fn traverse<K, V: copy>(m: &const tree_edge<K, V>, f: fn(K, V)) {
-    alt copy *m {
+    match copy *m {
       none => (),
       some(node) => {
         traverse(&const node.left, f);
index 52e4879c0b2d4435cf7c695c6873b929c7274fbd..b2ae1de6e4ac4efbd5c3e338a138bf16b15db3df 100644 (file)
@@ -56,7 +56,7 @@ fn get_monitor_task_gl() -> iotask unsafe {
             let hl_loop = spawn_loop();
             loop {
                 debug!{"in outer_loop..."};
-                alt select2(weak_exit_po, msg_po) {
+                match select2(weak_exit_po, msg_po) {
                   left(weak_exit) => {
                     // all normal tasks have ended, tell the
                     // libuv loop to tear_down, then exit
index 5b9d3b1f2f2d106e202d1679d22a8a090bccab4c..80d1053570ea3e6b5b5cac0be97494e648cfd037 100644 (file)
@@ -144,7 +144,7 @@ fn send_msg(iotask: iotask,
     let msg_po = (*data).msg_po;
 
     while msg_po.peek() {
-        alt msg_po.recv() {
+        match msg_po.recv() {
           interaction(cb) => cb(loop_ptr),
           teardown_loop => begin_teardown(data)
         }
index 9d120cce7428222c02d193250fcad215184b34fb..26b95a9a37b93a48f53051a3c0253589b4be3841 100644 (file)
@@ -848,7 +848,7 @@ unsafe fn ip6_name(src: &sockaddr_in6) -> ~str {
                         src_unsafe_ptr, src});
         let result = rustrt::rust_uv_ip6_name(src_unsafe_ptr,
                                               dst_buf, size as libc::size_t);
-        alt result {
+        match result {
           0i32 => str::unsafe::from_buf(dst_buf),
           _ => ~""
         }
index daf3e20f469c427edabb0497ea4b42e6a0475f93..f10ec1423285aa36e804beb3fff4ab4f17d121fc 100644 (file)
@@ -193,7 +193,7 @@ enum vstore {
 }
 
 pure fn is_blockish(p: ast::proto) -> bool {
-    alt p {
+    match p {
       proto_block => true,
       proto_bare | proto_uniq | proto_box => false
     }
index f23385f2e17a48f7822d9177b6763abf4a5454ea..2c774abff579e8940469e57a54bcd1abf6da2fdb 100644 (file)
@@ -12,7 +12,7 @@ enum path_elt { path_mod(ident), path_name(ident) }
 /* FIXMEs that say "bad" are as per #2543 */
 fn path_to_str_with_sep(p: path, sep: ~str) -> ~str {
     let strs = do vec::map(p) |e| {
-        alt e {
+        match e {
           path_mod(s) => /* FIXME (#2543) */ copy *s,
           path_name(s) => /* FIXME (#2543) */ copy *s
         }
@@ -104,7 +104,7 @@ fn map_decoded_item(diag: span_handler,
     // methods get added to the AST map when their impl is visited.  Since we
     // don't decode and instantiate the impl, but just the method, we have to
     // add it to the table now:
-    alt ii {
+    match ii {
       ii_item(*) | ii_ctor(*) | ii_dtor(*) => { /* fallthrough */ }
       ii_foreign(i) => {
         cx.map.insert(i.id, node_foreign_item(i, foreign_abi_rust_intrinsic,
@@ -127,7 +127,7 @@ fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
                           copy a, cx.local_id));
         cx.local_id += 1u;
     }
-    alt fk {
+    match fk {
       visit::fk_ctor(nm, attrs, tps, self_id, parent_id) => {
           let ct = @{node: {id: id,
                             attrs: attrs,
@@ -159,7 +159,7 @@ fn map_block(b: blk, cx: ctx, v: vt) {
 
 fn number_pat(cx: ctx, pat: @pat) {
     do ast_util::walk_pat(pat) |p| {
-        alt p.node {
+        match p.node {
           pat_ident(*) => {
             cx.map.insert(p.id, node_local(cx.local_id));
             cx.local_id += 1u;
@@ -189,7 +189,7 @@ fn map_method(impl_did: def_id, impl_path: @path,
 fn map_item(i: @item, cx: ctx, v: vt) {
     let item_path = @/* FIXME (#2543) */ copy cx.path;
     cx.map.insert(i.id, node_item(i, item_path));
-    alt i.node {
+    match i.node {
       item_impl(_, opt_ir, _, ms) => {
         let impl_did = ast_util::local_def(i.id);
         for ms.each |m| {
@@ -205,7 +205,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
         }
       }
       item_foreign_mod(nm) => {
-        let abi = alt attr::foreign_abi(i.attrs) {
+        let abi = match attr::foreign_abi(i.attrs) {
           either::left(msg) => cx.diag.span_fatal(i.span, msg),
           either::right(abi) => abi
         };
@@ -248,7 +248,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
       }
       _ => ()
     }
-    alt i.node {
+    match i.node {
       item_mod(_) | item_foreign_mod(_) => {
         vec::push(cx.path, path_mod(i.ident));
       }
@@ -259,9 +259,9 @@ fn map_item(i: @item, cx: ctx, v: vt) {
 }
 
 fn map_view_item(vi: @view_item, cx: ctx, _v: vt) {
-    alt vi.node {
+    match vi.node {
       view_item_export(vps) => for vps.each |vp| {
-        let (id, name) = alt vp.node {
+        let (id, name) = match vp.node {
           view_path_simple(nm, _, id) => {
             (id, /* FIXME (#2543) */ copy nm)
           }
@@ -281,7 +281,7 @@ fn map_expr(ex: @expr, cx: ctx, v: vt) {
 }
 
 fn node_id_to_str(map: map, id: node_id) -> ~str {
-    alt map.find(id) {
+    match map.find(id) {
       none => {
         fmt!{"unknown node (id=%d)", id}
       }
index cf5168fc6daf42198560020c898ebca304f74c71..4f261afa3def5d974b20e7fe3dabef178b4b3734 100644 (file)
@@ -35,7 +35,7 @@
 pure fn is_local(did: ast::def_id) -> bool { did.crate == local_crate }
 
 pure fn stmt_id(s: stmt) -> node_id {
-    alt s.node {
+    match s.node {
       stmt_decl(_, id) => id,
       stmt_expr(_, id) => id,
       stmt_semi(_, id) => id
@@ -43,7 +43,7 @@
 }
 
 fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
-    alt d {
+    match d {
       def_variant(enum_id, var_id) => {
         return {enm: enum_id, var: var_id}
       }
@@ -52,7 +52,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn def_id_of_def(d: def) -> def_id {
-    alt d {
+    match d {
       def_fn(id, _) | def_mod(id) |
       def_foreign_mod(id) | def_const(id) |
       def_variant(_, id) | def_ty(id) | def_ty_param(id, _) |
@@ -70,7 +70,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn binop_to_str(op: binop) -> ~str {
-    alt op {
+    match op {
       add => return ~"+",
       subtract => return ~"-",
       mul => return ~"*",
@@ -93,7 +93,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn binop_to_method_name(op: binop) -> option<~str> {
-    alt op {
+    match op {
       add => return some(~"add"),
       subtract => return some(~"sub"),
       mul => return some(~"mul"),
@@ -109,7 +109,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn lazy_binop(b: binop) -> bool {
-    alt b {
+    match b {
       and => true,
       or => true,
       _ => false
@@ -117,7 +117,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn is_shift_binop(b: binop) -> bool {
-    alt b {
+    match b {
       shl => true,
       shr => true,
       _ => false
@@ -125,7 +125,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn unop_to_str(op: unop) -> ~str {
-    alt op {
+    match op {
       box(mt) => if mt == m_mutbl { ~"@mut " } else { ~"@" },
       uniq(mt) => if mt == m_mutbl { ~"~mut " } else { ~"~" },
       deref => ~"*",
@@ -135,11 +135,11 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn is_path(e: @expr) -> bool {
-    return alt e.node { expr_path(_) => true, _ => false };
+    return match e.node { expr_path(_) => true, _ => false };
 }
 
 pure fn int_ty_to_str(t: int_ty) -> ~str {
-    alt t {
+    match t {
       ty_char => ~"u8", // ???
       ty_i => ~"",
       ty_i8 => ~"i8",
@@ -150,7 +150,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn int_ty_max(t: int_ty) -> u64 {
-    alt t {
+    match t {
       ty_i8 => 0x80u64,
       ty_i16 => 0x8000u64,
       ty_i | ty_char | ty_i32 => 0x80000000u64, // actually ni about ty_i
@@ -159,7 +159,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn uint_ty_to_str(t: uint_ty) -> ~str {
-    alt t {
+    match t {
       ty_u => ~"u",
       ty_u8 => ~"u8",
       ty_u16 => ~"u16",
@@ -169,7 +169,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn uint_ty_max(t: uint_ty) -> u64 {
-    alt t {
+    match t {
       ty_u8 => 0xffu64,
       ty_u16 => 0xffffu64,
       ty_u | ty_u32 => 0xffffffffu64, // actually ni about ty_u
@@ -178,7 +178,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
 }
 
 pure fn float_ty_to_str(t: float_ty) -> ~str {
-    alt t { ty_f => ~"f", ty_f32 => ~"f32", ty_f64 => ~"f64" }
+    match t { ty_f => ~"f", ty_f32 => ~"f32", ty_f64 => ~"f64" }
 }
 
 fn is_exported(i: ident, m: _mod) -> bool {
@@ -186,7 +186,7 @@ fn is_exported(i: ident, m: _mod) -> bool {
     let mut parent_enum : option<ident> = none;
     for m.items.each |it| {
         if it.ident == i { local = true; }
-        alt it.node {
+        match it.node {
           item_enum(variants, _) => for variants.each |v| {
             if v.node.name == i {
                 local = true;
@@ -199,14 +199,14 @@ fn is_exported(i: ident, m: _mod) -> bool {
     }
     let mut has_explicit_exports = false;
     for m.view_items.each |vi| {
-        alt vi.node {
+        match vi.node {
           view_item_export(vps) => {
             has_explicit_exports = true;
             for vps.each |vp| {
-                alt vp.node {
+                match vp.node {
                   ast::view_path_simple(id, _, _) => {
                     if id == i { return true; }
-                    alt parent_enum {
+                    match parent_enum {
                       some(parent_enum_id) => {
                         if id == parent_enum_id { return true; }
                       }
@@ -240,7 +240,7 @@ fn is_exported(i: ident, m: _mod) -> bool {
 }
 
 pure fn is_call_expr(e: @expr) -> bool {
-    alt e.node { expr_call(_, _, _) => true, _ => false }
+    match e.node { expr_call(_, _, _) => true, _ => false }
 }
 
 pure fn eq_ty(a: &@ty, b: &@ty) -> bool { box::ptr_eq(*a, *b) }
@@ -284,7 +284,7 @@ fn ident_to_path(s: span, +i: ident) -> @path {
 }
 
 pure fn is_unguarded(&&a: arm) -> bool {
-    alt a.guard {
+    match a.guard {
       none => true,
       _    => false
     }
@@ -295,7 +295,7 @@ fn ident_to_path(s: span, +i: ident) -> @path {
 }
 
 pure fn class_item_ident(ci: @class_member) -> ident {
-    alt ci.node {
+    match ci.node {
       instance_var(i,_,_,_,_) => /* FIXME (#2543) */ copy i,
       class_method(it) => /* FIXME (#2543) */ copy it.ident
     }
@@ -306,7 +306,7 @@ fn ident_to_path(s: span, +i: ident) -> @path {
 
 fn public_methods(ms: ~[@method]) -> ~[@method] {
     vec::filter(ms,
-                |m| alt m.vis {
+                |m| match m.vis {
                     public => true,
                     _   => false
                 })
@@ -315,7 +315,7 @@ fn public_methods(ms: ~[@method]) -> ~[@method] {
 fn split_class_items(cs: ~[@class_member]) -> (~[ivar], ~[@method]) {
     let mut vs = ~[], ms = ~[];
     for cs.each |c| {
-      alt c.node {
+      match c.node {
         instance_var(i, t, cm, id, vis) => {
           vec::push(vs, {ident: /* FIXME (#2543) */ copy i,
                          ty: t,
@@ -332,7 +332,7 @@ fn split_class_items(cs: ~[@class_member]) -> (~[ivar], ~[@method]) {
 // extract a ty_method from a trait_method. if the trait_method is
 // a default, pull out the useful fields to make a ty_method
 fn trait_method_to_ty_method(method: trait_method) -> ty_method {
-    alt method {
+    match method {
       required(m) => m,
       provided(m) => {
         {ident: m.ident, attrs: m.attrs,
@@ -346,7 +346,7 @@ fn split_trait_methods(trait_methods: ~[trait_method])
     -> (~[ty_method], ~[@method]) {
     let mut reqd = ~[], provd = ~[];
     for trait_methods.each |trt_method| {
-        alt trt_method {
+        match trt_method {
           required(tm) => vec::push(reqd, tm),
           provided(m) => vec::push(provd, m)
         }
@@ -355,7 +355,7 @@ fn split_trait_methods(trait_methods: ~[trait_method])
 }
 
 pure fn class_member_visibility(ci: @class_member) -> visibility {
-  alt ci.node {
+  match ci.node {
      instance_var(_, _, _, _, vis) => vis,
      class_method(m) => m.vis
   }
@@ -369,7 +369,7 @@ trait inlined_item_utils {
 
 impl inlined_item_methods of inlined_item_utils for inlined_item {
     fn ident() -> ident {
-        alt self {
+        match self {
           ii_item(i) => /* FIXME (#2543) */ copy i.ident,
           ii_foreign(i) => /* FIXME (#2543) */ copy i.ident,
           ii_method(_, m) => /* FIXME (#2543) */ copy m.ident,
@@ -379,7 +379,7 @@ fn ident() -> ident {
     }
 
     fn id() -> ast::node_id {
-        alt self {
+        match self {
           ii_item(i) => i.id,
           ii_foreign(i) => i.id,
           ii_method(_, m) => m.id,
@@ -389,7 +389,7 @@ fn id() -> ast::node_id {
     }
 
     fn accept<E>(e: E, v: visit::vt<E>) {
-        alt self {
+        match self {
           ii_item(i) => v.visit_item(i, e, v),
           ii_foreign(i) => v.visit_foreign_item(i, e, v),
           ii_method(_, m) => visit::visit_method_helper(m, e, v),
@@ -406,7 +406,7 @@ fn accept<E>(e: E, v: visit::vt<E>) {
 /* True if d is either a def_self, or a chain of def_upvars
  referring to a def_self */
 fn is_self(d: ast::def) -> bool {
-  alt d {
+  match d {
     def_self(_)        => true,
     def_upvar(_, d, _) => is_self(*d),
     _                  => false
@@ -415,7 +415,7 @@ fn is_self(d: ast::def) -> bool {
 
 /// Maps a binary operator to its precedence
 fn operator_prec(op: ast::binop) -> uint {
-  alt op {
+  match op {
       mul | div | rem   => 12u,
       // 'as' sits between here with 11
       add | subtract    => 10u,
@@ -455,11 +455,11 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
         },
 
         visit_view_item: fn@(vi: @view_item) {
-            alt vi.node {
+            match vi.node {
               view_item_use(_, _, id) => vfn(id),
               view_item_import(vps) | view_item_export(vps) => {
                 do vec::iter(vps) |vp| {
-                    alt vp.node {
+                    match vp.node {
                       view_path_simple(_, _, id) => vfn(id),
                       view_path_glob(_, id) => vfn(id),
                       view_path_list(_, _, id) => vfn(id)
@@ -475,7 +475,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
 
         visit_item: fn@(i: @item) {
             vfn(i.id);
-            alt i.node {
+            match i.node {
               item_enum(vs, _) => for vs.each |v| { vfn(v.node.id); }
               _ => ()
             }
@@ -511,7 +511,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
         },
 
         visit_ty: fn@(t: @ty) {
-            alt t.node {
+            match t.node {
               ty_path(_, id) => vfn(id),
               _ => { /* fall through */ }
             }
@@ -525,7 +525,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
                       _b: ast::blk, _sp: span, id: ast::node_id) {
             vfn(id);
 
-            alt fk {
+            match fk {
               visit::fk_ctor(nm, _, tps, self_id, parent_id) => {
                 vec::iter(tps, |tp| vfn(tp.id));
                 vfn(id);
@@ -565,7 +565,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
         },
 
         visit_class_item: fn@(c: @class_member) {
-            alt c.node {
+            match c.node {
               instance_var(_, _, _, id,_) => vfn(id),
               class_method(_) => ()
             }
@@ -592,7 +592,7 @@ fn compute_id_range_for_inlined_item(item: inlined_item) -> id_range {
 }
 
 pure fn is_item_impl(item: @ast::item) -> bool {
-    alt item.node {
+    match item.node {
        item_impl(*) => true,
        _            => false
     }
@@ -600,7 +600,7 @@ fn compute_id_range_for_inlined_item(item: inlined_item) -> id_range {
 
 fn walk_pat(pat: @pat, it: fn(@pat)) {
     it(pat);
-    alt pat.node {
+    match pat.node {
       pat_ident(_, pth, some(p)) => walk_pat(p, it),
       pat_rec(fields, _) => for fields.each |f| { walk_pat(f.pat, it) }
       pat_enum(_, some(s)) | pat_tup(s) => for s.each |p| {
@@ -613,7 +613,7 @@ fn walk_pat(pat: @pat, it: fn(@pat)) {
 }
 
 fn view_path_id(p: @view_path) -> node_id {
-    alt p.node {
+    match p.node {
       view_path_simple(_, _, id) | view_path_glob(_, id) |
       view_path_list(_, _, id) => id
     }
index f04a8e42ab7329e4dd4e0e3866621fbf4d4b910e..0838a1a70d9ec285a6f94170b5857a000561385c 100644 (file)
@@ -114,7 +114,7 @@ fn get_attr_name(attr: ast::attribute) -> ast::ident {
 
 // All "bad" FIXME copies are as per #2543
 fn get_meta_item_name(meta: @ast::meta_item) -> ast::ident {
-    alt meta.node {
+    match meta.node {
       ast::meta_word(n) => /* FIXME (#2543) */ copy n,
       ast::meta_name_value(n, _) => /* FIXME (#2543) */ copy n,
       ast::meta_list(n, _) => /* FIXME (#2543) */ copy n
@@ -126,8 +126,8 @@ fn get_meta_item_name(meta: @ast::meta_item) -> ast::ident {
  * containing a string, otherwise none
  */
 fn get_meta_item_value_str(meta: @ast::meta_item) -> option<@~str> {
-    alt meta.node {
-      ast::meta_name_value(_, v) => alt v.node {
+    match meta.node {
+      ast::meta_name_value(_, v) => match v.node {
         ast::lit_str(s) => option::some(s),
         _ => option::none
       }
@@ -137,7 +137,7 @@ fn get_meta_item_value_str(meta: @ast::meta_item) -> option<@~str> {
 
 /// Gets a list of inner meta items from a list meta_item type
 fn get_meta_item_list(meta: @ast::meta_item) -> option<~[@ast::meta_item]> {
-    alt meta.node {
+    match meta.node {
       ast::meta_list(_, l) => option::some(/* FIXME (#2543) */ copy l),
       _ => option::none
     }
@@ -150,7 +150,7 @@ fn get_meta_item_list(meta: @ast::meta_item) -> option<~[@ast::meta_item]> {
 fn get_name_value_str_pair(
     item: @ast::meta_item
 ) -> option<(ast::ident, @~str)> {
-    alt attr::get_meta_item_value_str(item) {
+    match attr::get_meta_item_value_str(item) {
       some(value) => {
         let name = attr::get_meta_item_name(item);
         some((name, value))
@@ -203,12 +203,12 @@ fn contains(haystack: ~[@ast::meta_item], needle: @ast::meta_item) -> bool {
 }
 
 fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool {
-    return alt a.node {
-          ast::meta_word(na) => alt b.node {
+    return match a.node {
+          ast::meta_word(na) => match b.node {
             ast::meta_word(nb) => na == nb,
             _ => false
           }
-          ast::meta_name_value(na, va) => alt b.node {
+          ast::meta_name_value(na, va) => match b.node {
             ast::meta_name_value(nb, vb) => na == nb && va.node == vb.node,
             _ => false
           }
@@ -253,8 +253,8 @@ fn last_meta_item_value_str_by_name(
     items: ~[@ast::meta_item],
     +name: ~str
 ) -> option<@~str> {
-    alt last_meta_item_by_name(items, name) {
-      some(item) => alt attr::get_meta_item_value_str(item) {
+    match last_meta_item_by_name(items, name) {
+      some(item) => match attr::get_meta_item_value_str(item) {
         some(value) => some(value),
         none => none
       }
@@ -266,7 +266,7 @@ fn last_meta_item_list_by_name(
     items: ~[@ast::meta_item],
     +name: ~str
 ) -> option<~[@ast::meta_item]> {
-    alt last_meta_item_by_name(items, name) {
+    match last_meta_item_by_name(items, name) {
       some(item) => attr::get_meta_item_list(item),
       none => none
     }
@@ -280,7 +280,7 @@ fn last_meta_item_list_by_name(
 fn sort_meta_items(+items: ~[@ast::meta_item]) -> ~[@ast::meta_item] {
     pure fn lteq(ma: &@ast::meta_item, mb: &@ast::meta_item) -> bool {
         pure fn key(m: &ast::meta_item) -> ast::ident {
-            alt m.node {
+            match m.node {
               ast::meta_word(name) => /* FIXME (#2543) */ copy name,
               ast::meta_name_value(name, _) => /* FIXME (#2543) */ copy name,
               ast::meta_list(name, _) => /* FIXME (#2543) */ copy name
@@ -310,7 +310,7 @@ fn remove_meta_items_by_name(items: ~[@ast::meta_item], name: ast::ident) ->
 fn find_linkage_attrs(attrs: ~[ast::attribute]) -> ~[ast::attribute] {
     let mut found = ~[];
     for find_attrs_by_name(attrs, ~"link").each |attr| {
-        alt attr.node.value.node {
+        match attr.node.value.node {
           ast::meta_list(_, _) => vec::push(found, attr),
           _ => debug!{"ignoring link attribute that has incorrect type"}
         }
@@ -324,14 +324,14 @@ fn find_linkage_attrs(attrs: ~[ast::attribute]) -> ~[ast::attribute] {
  */
 fn find_linkage_metas(attrs: ~[ast::attribute]) -> ~[@ast::meta_item] {
     do find_linkage_attrs(attrs).flat_map |attr| {
-        alt check attr.node.value.node {
+        match check attr.node.value.node {
           ast::meta_list(_, items) => /* FIXME (#2543) */ copy items
         }
     }
 }
 
 fn foreign_abi(attrs: ~[ast::attribute]) -> either<~str, ast::foreign_abi> {
-    return alt attr::first_attr_value_str_by_name(attrs, ~"abi") {
+    return match attr::first_attr_value_str_by_name(attrs, ~"abi") {
       option::none => {
         either::right(ast::foreign_abi_cdecl)
       }
@@ -361,7 +361,7 @@ enum inline_attr {
 fn find_inline_attr(attrs: ~[ast::attribute]) -> inline_attr {
     // FIXME (#2809)---validate the usage of #[inline] and #[inline(always)]
     do vec::foldl(ia_none, attrs) |ia,attr| {
-        alt attr.node.value.node {
+        match attr.node.value.node {
           ast::meta_word(@~"inline") => ia_hint,
           ast::meta_list(@~"inline", items) => {
             if !vec::is_empty(find_meta_items_by_name(items, ~"always")) {
index 575edaa771cbef6ec57ecfcd207786295fca6087..e725eaaa724657168eb53731834c89318e75147c 100644 (file)
@@ -124,7 +124,7 @@ fn lookup_char_pos_adj(map: codemap, pos: uint)
     -> {filename: ~str, line: uint, col: uint, file: option<filemap>}
 {
     let loc = lookup_char_pos(map, pos);
-    alt (loc.file.substr) {
+    match (loc.file.substr) {
       fss_none => {
         {filename: /* FIXME (#2543) */ copy loc.file.name,
          line: loc.line,
@@ -146,7 +146,7 @@ fn lookup_char_pos_adj(map: codemap, pos: uint)
 fn adjust_span(map: codemap, sp: span) -> span {
     pure fn lookup(pos: file_pos) -> uint { return pos.ch; }
     let line = lookup_line(map, sp.lo, lookup);
-    alt (line.fm.substr) {
+    match (line.fm.substr) {
       fss_none => sp,
       fss_internal(s) => {
         adjust_span(map, {lo: s.lo + (sp.lo - line.fm.start_pos.ch),
@@ -196,7 +196,7 @@ fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines {
 
 fn get_line(fm: filemap, line: int) -> ~str unsafe {
     let begin: uint = fm.lines[line].byte - fm.start_pos.byte;
-    let end = alt str::find_char_from(*fm.src, '\n', begin) {
+    let end = match str::find_char_from(*fm.src, '\n', begin) {
       some(e) => e,
       none => str::len(*fm.src)
     };
index 6195849f3404fa3325256f58b182ac64fa523b04..bd5b37ab6982687c8ffa71e757a38ed412c0d923 100644 (file)
@@ -87,7 +87,7 @@ fn bump_err_count() {
     fn has_errors() -> bool { self.err_count > 0u }
     fn abort_if_errors() {
         let s;
-        alt self.err_count {
+        match self.err_count {
           0u => return,
           1u => s = ~"aborting due to previous error",
           _  => {
@@ -122,7 +122,7 @@ fn mk_span_handler(handler: handler, cm: codemap::codemap) -> span_handler {
 
 fn mk_handler(emitter: option<emitter>) -> handler {
 
-    let emit = alt emitter {
+    let emit = match emitter {
       some(e) => e,
       none => {
         let f = fn@(cmsp: option<(codemap::codemap, span)>,
@@ -147,7 +147,7 @@ enum level {
 }
 
 fn diagnosticstr(lvl: level) -> ~str {
-    alt lvl {
+    match lvl {
       fatal => ~"error",
       error => ~"error",
       warning => ~"warning",
@@ -156,7 +156,7 @@ fn diagnosticstr(lvl: level) -> ~str {
 }
 
 fn diagnosticcolor(lvl: level) -> u8 {
-    alt lvl {
+    match lvl {
       fatal => term::color_bright_red,
       error => term::color_bright_red,
       warning => term::color_bright_yellow,
@@ -182,7 +182,7 @@ fn print_diagnostic(topic: ~str, lvl: level, msg: ~str) {
 
 fn emit(cmsp: option<(codemap::codemap, span)>,
         msg: ~str, lvl: level) {
-    alt cmsp {
+    match cmsp {
       some((cm, sp)) => {
         let sp = codemap::adjust_span(cm,sp);
         let ss = codemap::span_to_str(sp, cm);
@@ -266,7 +266,7 @@ fn print_macro_backtrace(cm: codemap::codemap, sp: span) {
 
 fn expect<T: copy>(diag: span_handler,
                    opt: option<T>, msg: fn() -> ~str) -> T {
-    alt opt {
+    match opt {
        some(t) => t,
        none => diag.handler().bug(msg())
     }
index 6e9673f4bc202ca45ae5506682a251dfa4273eaf..c87ea71fc47d6349675acc428413fe1d51efcc9a 100644 (file)
@@ -101,7 +101,7 @@ fn filter_attrs(item: @ast::item) -> @ast::item {
     }
 
     do vec::flat_map(in_items) |in_item| {
-        alt in_item.node {
+        match in_item.node {
           ast::item_ty(ty, tps) => {
             vec::append(~[filter_attrs(in_item)],
                         ty_fns(cx, in_item.ident, ty, tps))
@@ -375,7 +375,7 @@ fn ser_lambda(cx: ext_ctxt, tps: ser_tps_map, ty: @ast::ty,
 }
 
 fn is_vec_or_str(ty: @ast::ty) -> bool {
-    alt ty.node {
+    match ty.node {
       ast::ty_vec(_) => true,
       // This may be wrong if the user has shadowed (!) str
       ast::ty_path(@{span: _, global: _, idents: ids,
@@ -391,7 +391,7 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
 
     let ext_cx = cx; // required for #ast{}
 
-    alt ty.node {
+    match ty.node {
       ast::ty_nil => {
         ~[#ast[stmt]{$(s).emit_nil()}]
       }
@@ -447,7 +447,7 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
       ast::ty_tup(tys) => {
         // Generate code like
         //
-        // alt v {
+        // match v {
         //    (v1, v2, v3) {
         //       .. serialize v1, v2, v3 ..
         //    }
@@ -483,7 +483,7 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
             vec::is_empty(path.types) {
             let ident = path.idents[0];
 
-            alt tps.find(*ident) {
+            match tps.find(*ident) {
               some(f) => f(v),
               none => ser_path(cx, tps, path, s, v)
             }
@@ -634,7 +634,7 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map,
 
     let ext_cx = cx; // required for #ast{}
 
-    alt ty.node {
+    match ty.node {
       ast::ty_nil => {
         #ast{ $(d).read_nil() }
       }
@@ -709,7 +709,7 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map,
             vec::is_empty(path.types) {
             let ident = path.idents[0];
 
-            alt tps.find(*ident) {
+            match tps.find(*ident) {
               some(f) => f(),
               none => deser_path(cx, tps, path, d)
             }
index b8cce21190c13494ff823f1d0a5ea8d3ed143ac1..f2e1855c0f5b208e99f3bc8cc7810f6106e7e533 100644 (file)
@@ -150,7 +150,7 @@ fn backtrace() -> expn_info { self.backtrace }
         fn mod_pop() { vec::pop(self.mod_path); }
         fn mod_path() -> ~[ast::ident] { return self.mod_path; }
         fn bt_push(ei: codemap::expn_info_) {
-            alt ei {
+            match ei {
               expanded_from({call_site: cs, callie: callie}) => {
                 self.backtrace =
                     some(@expanded_from({
@@ -161,7 +161,7 @@ fn bt_push(ei: codemap::expn_info_) {
             }
         }
         fn bt_pop() {
-            alt self.backtrace {
+            match self.backtrace {
               some(@expanded_from({call_site: {expn_info: prev, _}, _})) => {
                 self.backtrace = prev
               }
@@ -206,8 +206,8 @@ fn next_id() -> ast::node_id {
 }
 
 fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, error: ~str) -> ~str {
-    alt expr.node {
-      ast::expr_lit(l) => alt l.node {
+    match expr.node {
+      ast::expr_lit(l) => match l.node {
         ast::lit_str(s) => return *s,
         _ => cx.span_fatal(l.span, error)
       }
@@ -216,7 +216,7 @@ fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, error: ~str) -> ~str {
 }
 
 fn expr_to_ident(cx: ext_ctxt, expr: @ast::expr, error: ~str) -> ast::ident {
-    alt expr.node {
+    match expr.node {
       ast::expr_path(p) => {
         if vec::len(p.types) > 0u || vec::len(p.idents) != 1u {
             cx.span_fatal(expr.span, error);
@@ -233,11 +233,11 @@ fn get_mac_args_no_max(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
 
 fn get_mac_args(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
                 min: uint, max: option<uint>, name: ~str) -> ~[@ast::expr] {
-    alt arg {
-      some(expr) => alt expr.node {
+    match arg {
+      some(expr) => match expr.node {
         ast::expr_vec(elts, _) => {
             let elts_len = vec::len(elts);
-              alt max {
+              match max {
                 some(max) if ! (min <= elts_len && elts_len <= max) => {
                   cx.span_fatal(sp,
                                 fmt!{"#%s takes between %u and %u arguments.",
@@ -261,7 +261,7 @@ fn get_mac_args(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
 fn get_mac_body(cx: ext_ctxt, sp: span, args: ast::mac_body)
     -> ast::mac_body_
 {
-    alt (args) {
+    match (args) {
       some(body) => body,
       none => cx.span_fatal(sp, ~"missing macro body")
     }
@@ -289,10 +289,10 @@ fn ms(m: matcher_) -> matcher {
     let arg_reader = new_tt_reader(cx.parse_sess().span_diagnostic,
                                    cx.parse_sess().interner, none, arg);
     let args =
-        alt parse_or_else(cx.parse_sess(), cx.cfg(), arg_reader as reader,
+        match parse_or_else(cx.parse_sess(), cx.cfg(), arg_reader as reader,
                           argument_gram).get(@~"arg") {
           @matched_seq(s, _) => do s.map() |lf| {
-            alt lf {
+            match lf {
               @matched_nonterminal(parse::token::nt_expr(arg)) => {
                 arg /* whew! list of exprs, here we come! */
               }
index 143a675fa639c5b38d39c5e125e0631a5ec2920b..01030591da955f3f9fe10cb143d68f9bfc779d9d 100644 (file)
@@ -16,7 +16,7 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
     // option<str> rather than just an maybe-empty string.
 
     let var = expr_to_str(cx, args[0], ~"#env requires a string");
-    alt os::getenv(var) {
+    match os::getenv(var) {
       option::none => return mk_uniq_str(cx, sp, ~""),
       option::some(s) => return mk_uniq_str(cx, sp, s)
     }
index ee1ec62e4e2c0c409303090eb25ecfc35a884815..9b50101683a7610eafdfc909725cefebebbb34a7 100644 (file)
@@ -15,18 +15,18 @@ fn expand_expr(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt,
                orig: fn@(expr_, span, ast_fold) -> (expr_, span))
     -> (expr_, span)
 {
-    return alt e {
+    return match e {
       // expr_mac should really be expr_ext or something; it's the
       // entry-point for all syntax extensions.
           expr_mac(mac) => {
 
             // Old-style macros, for compatibility, will erase this whole
             // block once we've transitioned.
-            alt mac.node {
+            match mac.node {
               mac_invoc(pth, args, body) => {
                 assert (vec::len(pth.idents) > 0u);
                 let extname = pth.idents[0];
-                alt exts.find(*extname) {
+                match exts.find(*extname) {
                   none => {
                     cx.span_fatal(pth.span,
                                   fmt!{"macro undefined: '%s'", *extname})
@@ -69,13 +69,13 @@ fn expand_expr(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt,
               mac_invoc_tt(pth, tts) => {
                 assert (vec::len(pth.idents) == 1u);
                 let extname = pth.idents[0];
-                alt exts.find(*extname) {
+                match exts.find(*extname) {
                   none => {
                     cx.span_fatal(pth.span,
                                   fmt!{"macro undefined: '%s'", *extname})
                   }
                   some(expr_tt({expander: exp, span: exp_sp})) => {
-                    let expanded = alt exp(cx, mac.span, tts) {
+                    let expanded = match exp(cx, mac.span, tts) {
                       mr_expr(e) => e,
                       _ => cx.span_fatal(
                           pth.span, fmt!{"non-expr macro in expr pos: %s",
@@ -141,12 +141,12 @@ fn expand_mod_items(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt,
     // the item into a new set of items.
     let new_items = do vec::flat_map(module_.items) |item| {
         do vec::foldr(item.attrs, ~[item]) |attr, items| {
-            let mname = alt attr.node.value.node {
+            let mname = match attr.node.value.node {
               ast::meta_word(n) => n,
               ast::meta_name_value(n, _) => n,
               ast::meta_list(n, _) => n
             };
-            alt exts.find(*mname) {
+            match exts.find(*mname) {
               none | some(normal(_)) | some(macro_defining(_))
               | some(expr_tt(_)) | some(item_tt(*)) => items,
               some(item_decorator(dec_fn)) => {
@@ -166,16 +166,16 @@ fn expand_item(exts: hashmap<~str, syntax_extension>,
                orig: fn@(&&@ast::item, ast_fold) -> option<@ast::item>)
     -> option<@ast::item>
 {
-    let is_mod = alt it.node {
+    let is_mod = match it.node {
       ast::item_mod(_) | ast::item_foreign_mod(_) => true,
       _ => false
     };
-    let maybe_it = alt it.node {
+    let maybe_it = match it.node {
       ast::item_mac(*) => expand_item_mac(exts, cx, it, fld),
       _ => some(it)
     };
 
-    alt maybe_it {
+    match maybe_it {
       some(it) => {
         if is_mod { cx.mod_push(it.ident); }
         let ret_val = orig(it, fld);
@@ -192,10 +192,10 @@ fn expand_item(exts: hashmap<~str, syntax_extension>,
 fn expand_item_mac(exts: hashmap<~str, syntax_extension>,
                    cx: ext_ctxt, &&it: @ast::item,
                    fld: ast_fold) -> option<@ast::item> {
-    alt it.node {
+    match it.node {
       item_mac({node: mac_invoc_tt(pth, tts), span}) => {
         let extname = pth.idents[0];
-        alt exts.find(*extname) {
+        match exts.find(*extname) {
           none => {
             cx.span_fatal(pth.span,
                           fmt!{"macro undefined: '%s'", *extname})
@@ -205,7 +205,7 @@ fn expand_item_mac(exts: hashmap<~str, syntax_extension>,
             cx.bt_push(expanded_from({call_site: it.span,
                                       callie: {name: *extname,
                                                span: expand.span}}));
-            let maybe_it = alt expanded {
+            let maybe_it = match expanded {
               mr_item(it) => fld.fold_item(it),
               mr_expr(e) => cx.span_fatal(pth.span,
                                          ~"expr macro in item position: " +
index d1acf622c1f614b238752d1c2f45bbe9cc89bb84..19b5fefc1cf0847a165f7abb193db108c9f27561 100644 (file)
@@ -52,7 +52,7 @@ fn make_rt_conv_expr(cx: ext_ctxt, sp: span, cnv: conv) -> @ast::expr {
         fn make_flags(cx: ext_ctxt, sp: span, flags: ~[flag]) -> @ast::expr {
             let mut tmp_expr = make_rt_path_expr(cx, sp, @~"flag_none");
             for flags.each |f| {
-                let fstr = alt f {
+                let fstr = match f {
                   flag_left_justify => ~"flag_left_justify",
                   flag_left_zero_pad => ~"flag_left_zero_pad",
                   flag_space_for_sign => ~"flag_space_for_sign",
@@ -65,7 +65,7 @@ fn make_flags(cx: ext_ctxt, sp: span, flags: ~[flag]) -> @ast::expr {
             return tmp_expr;
         }
         fn make_count(cx: ext_ctxt, sp: span, cnt: count) -> @ast::expr {
-            alt cnt {
+            match cnt {
               count_implied => {
                 return make_rt_path_expr(cx, sp, @~"count_implied");
               }
@@ -80,8 +80,8 @@ fn make_count(cx: ext_ctxt, sp: span, cnt: count) -> @ast::expr {
         }
         fn make_ty(cx: ext_ctxt, sp: span, t: ty) -> @ast::expr {
             let mut rt_type;
-            alt t {
-              ty_hex(c) => alt c {
+            match t {
+              ty_hex(c) => match c {
                 case_upper => rt_type = ~"ty_hex_upper",
                 case_lower => rt_type = ~"ty_hex_lower"
               }
@@ -121,8 +121,8 @@ fn make_new_conv(cx: ext_ctxt, sp: span, cnv: conv, arg: @ast::expr) ->
         // FIXME: Move validation code into core::extfmt (Issue #2249)
 
         fn is_signed_type(cnv: conv) -> bool {
-            alt cnv.ty {
-              ty_int(s) => alt s {
+            match cnv.ty {
+              ty_int(s) => match s {
                 signed => return true,
                 unsigned => return false
               }
@@ -131,12 +131,12 @@ fn is_signed_type(cnv: conv) -> bool {
             }
         }
         let unsupported = ~"conversion not supported in #fmt string";
-        alt cnv.param {
+        match cnv.param {
           option::none => (),
           _ => cx.span_unimpl(sp, unsupported)
         }
         for cnv.flags.each |f| {
-            alt f {
+            match f {
               flag_left_justify => (),
               flag_sign_always => {
                 if !is_signed_type(cnv) {
@@ -156,19 +156,19 @@ fn is_signed_type(cnv: conv) -> bool {
               _ => cx.span_unimpl(sp, unsupported)
             }
         }
-        alt cnv.width {
+        match cnv.width {
           count_implied => (),
           count_is(_) => (),
           _ => cx.span_unimpl(sp, unsupported)
         }
-        alt cnv.precision {
+        match cnv.precision {
           count_implied => (),
           count_is(_) => (),
           _ => cx.span_unimpl(sp, unsupported)
         }
-        alt cnv.ty {
+        match cnv.ty {
           ty_str => return make_conv_call(cx, arg.span, ~"str", cnv, arg),
-          ty_int(sign) => alt sign {
+          ty_int(sign) => match sign {
             signed => return make_conv_call(cx, arg.span, ~"int", cnv, arg),
             unsigned => {
                 return make_conv_call(cx, arg.span, ~"uint", cnv, arg)
@@ -188,12 +188,12 @@ fn is_signed_type(cnv: conv) -> bool {
         }
     }
     fn log_conv(c: conv) {
-        alt c.param {
+        match c.param {
           some(p) => { log(debug, ~"param: " + int::to_str(p, 10u)); }
           _ => debug!{"param: none"}
         }
         for c.flags.each |f| {
-            alt f {
+            match f {
               flag_left_justify => debug!{"flag: left justify"},
               flag_left_zero_pad => debug!{"flag: left zero pad"},
               flag_space_for_sign => debug!{"flag: left space pad"},
@@ -201,7 +201,7 @@ fn log_conv(c: conv) {
               flag_alternate => debug!{"flag: alternate"}
             }
         }
-        alt c.width {
+        match c.width {
           count_is(i) => log(
               debug, ~"width: count is " + int::to_str(i, 10u)),
           count_is_param(i) => log(
@@ -209,7 +209,7 @@ fn log_conv(c: conv) {
           count_is_next_param => debug!{"width: count is next param"},
           count_implied => debug!{"width: count is implied"}
         }
-        alt c.precision {
+        match c.precision {
           count_is(i) => log(
               debug, ~"prec: count is " + int::to_str(i, 10u)),
           count_is_param(i) => log(
@@ -217,16 +217,16 @@ fn log_conv(c: conv) {
           count_is_next_param => debug!{"prec: count is next param"},
           count_implied => debug!{"prec: count is implied"}
         }
-        alt c.ty {
+        match c.ty {
           ty_bool => debug!{"type: bool"},
           ty_str => debug!{"type: str"},
           ty_char => debug!{"type: char"},
-          ty_int(s) => alt s {
+          ty_int(s) => match s {
             signed => debug!{"type: signed"},
             unsigned => debug!{"type: unsigned"}
           }
           ty_bits => debug!{"type: bits"},
-          ty_hex(cs) => alt cs {
+          ty_hex(cs) => match cs {
             case_upper => debug!{"type: uhex"},
             case_lower => debug!{"type: lhex"},
           }
@@ -240,7 +240,7 @@ fn log_conv(c: conv) {
     let mut piece_exprs = ~[];
     let nargs = args.len();
     for pieces.each |pc| {
-        alt pc {
+        match pc {
           piece_string(s) => {
             vec::push(piece_exprs, mk_uniq_str(cx, fmt_sp, s))
           }
index 59687eda96d5d6f4b66e68bde758dd695a142e3e..8595a991e2480a2772852253ba5b538100fba234 100644 (file)
@@ -44,7 +44,7 @@ fn visit_state(state: state, _m: &[()]) {
 
     fn visit_message(name: ident, _span: span, _tys: &[@ast::ty],
                      this: state, next: next_state) {
-        alt next {
+        match next {
           some({state: next, tys: next_tys}) => {
             let proto = this.proto;
             if !proto.has_state(next) {
index 678f5b36c45bfc5df0ba40ffa4f4ee004bfec777..aa553d8ae53ea64d6349b6b617981592a72d37e8 100644 (file)
@@ -25,12 +25,12 @@ fn parse_proto(id: ident) -> protocol {
     fn parse_state(proto: protocol) {
         let id = self.parse_ident();
         self.expect(token::COLON);
-        let dir = alt copy self.token {
+        let dir = match copy self.token {
           token::IDENT(n, _) => self.get_str(n),
           _ => fail
         };
         self.bump();
-        let dir = alt dir {
+        let dir = match dir {
           @~"send" => send,
           @~"recv" => recv,
           _ => fail
@@ -64,7 +64,7 @@ fn parse_message(state: state) {
 
         self.expect(token::RARROW);
 
-        let next = alt copy self.token {
+        let next = match copy self.token {
           token::IDENT(_, _) => {
             let name = self.parse_ident();
             let ntys = if self.token == token::LT {
index f61601a2aa035848d0f8b995afd97cd4b683ef5b..16ba6d3a0633bc3d82815c375ca18bf43a876d99 100644 (file)
@@ -47,7 +47,7 @@ trait gen_init {
 impl compile of gen_send for message {
     fn gen_send(cx: ext_ctxt) -> @ast::item {
         debug!{"pipec: gen_send"};
-        alt self {
+        match self {
           message(id, span, tys, this,
                   some({state: next, tys: next_tys})) => {
             debug!{"pipec: next state exists"};
@@ -71,7 +71,7 @@ fn gen_send(cx: ext_ctxt) -> @ast::item {
             let mut body = ~"{\n";
 
             if this.proto.is_bounded() {
-                let (sp, rp) = alt (this.dir, next.dir) {
+                let (sp, rp) = match (this.dir, next.dir) {
                   (send, send) => (~"c", ~"s"),
                   (send, recv) => (~"s", ~"c"),
                   (recv, send) => (~"s", ~"c"),
@@ -87,7 +87,7 @@ fn gen_send(cx: ext_ctxt) -> @ast::item {
                              rp, *next.name};
             }
             else {
-                let pat = alt (this.dir, next.dir) {
+                let pat = match (this.dir, next.dir) {
                   (send, send) => ~"(c, s)",
                   (send, recv) => ~"(s, c)",
                   (recv, send) => ~"(s, c)",
@@ -181,12 +181,12 @@ fn to_type_decls(cx: ext_ctxt) -> ~[@ast::item] {
         for self.messages.each |m| {
             let message(name, _span, tys, this, next) = m;
 
-            let tys = alt next {
+            let tys = match next {
               some({state: next, tys: next_tys}) => {
                 let next = this.proto.get_state(next);
                 let next_name = next.data_name();
 
-                let dir = alt this.dir {
+                let dir = match this.dir {
                   send => @~"server",
                   recv => @~"client"
                 };
@@ -208,7 +208,7 @@ fn to_type_decls(cx: ext_ctxt) -> ~[@ast::item] {
 
     fn to_endpoint_decls(cx: ext_ctxt, dir: direction) -> ~[@ast::item] {
         debug!{"pipec: to_endpoint_decls"};
-        let dir = alt dir {
+        let dir = match dir {
           send => (*self).dir,
           recv => (*self).dir.reverse()
         };
@@ -255,7 +255,7 @@ fn gen_init(cx: ext_ctxt) -> @ast::item {
         let start_state = self.states[0];
 
         let body = if !self.is_bounded() {
-            alt start_state.dir {
+            match start_state.dir {
               send => #ast { pipes::entangle() },
               recv => {
                 #ast {{
@@ -267,7 +267,7 @@ fn gen_init(cx: ext_ctxt) -> @ast::item {
         }
         else {
             let body = self.gen_init_bounded(ext_cx);
-            alt start_state.dir {
+            match start_state.dir {
               send => body,
               recv => {
                 #ast {{
@@ -322,7 +322,7 @@ fn buffer_ty_path(cx: ext_ctxt) -> @ast::ty {
         let mut params: ~[ast::ty_param] = ~[];
         for (copy self.states).each |s| {
             for s.ty_params.each |tp| {
-                alt params.find(|tpp| *tp.ident == *tpp.ident) {
+                match params.find(|tpp| *tp.ident == *tpp.ident) {
                   none => vec::push(params, tp),
                   _ => ()
                 }
@@ -338,7 +338,7 @@ fn gen_buffer_type(cx: ext_ctxt) -> @ast::item {
         let mut params: ~[ast::ty_param] = ~[];
         let fields = do (copy self.states).map_to_vec |s| {
             for s.ty_params.each |tp| {
-                alt params.find(|tpp| *tp.ident == *tpp.ident) {
+                match params.find(|tpp| *tp.ident == *tpp.ident) {
                   none => vec::push(params, tp),
                   _ => ()
                 }
@@ -439,7 +439,7 @@ fn parse_item(s: ~str) -> @ast::item {
             self.cfg(),
             ~[],
             self.parse_sess());
-        alt res {
+        match res {
           some(ast) => ast,
           none => {
             error!{"Parse error with ```\n%s\n```", s};
index bd9ea96ee33ef7564de825e51f7b965aac69fef5..5769125225e3e81a54f1ee762763078731a01b6e 100644 (file)
@@ -11,7 +11,7 @@ enum direction {
 
 impl of to_str for direction {
     fn to_str() -> ~str {
-        alt self {
+        match self {
           send => ~"send",
           recv => ~"recv"
         }
@@ -20,7 +20,7 @@ fn to_str() -> ~str {
 
 impl methods for direction {
     fn reverse() -> direction {
-        alt self {
+        match self {
           send => recv,
           recv => send
         }
@@ -36,20 +36,20 @@ enum message {
 
 impl methods for message {
     fn name() -> ident {
-        alt self {
+        match self {
           message(id, _, _, _, _) => id
         }
     }
 
     fn span() -> span {
-        alt self {
+        match self {
           message(_, span, _, _, _) => span
         }
     }
 
     /// Return the type parameters actually used by this message
     fn get_params() -> ~[ast::ty_param] {
-        alt self {
+        match self {
           message(_, _, _, this, _) => this.ty_params
         }
     }
@@ -92,7 +92,7 @@ fn to_ty(cx: ext_ctxt) -> @ast::ty {
     /// from this state.
     fn reachable(f: fn(state) -> bool) {
         for self.messages.each |m| {
-            alt m {
+            match m {
               message(_, _, _, _, some({state: id, _})) => {
                 let state = self.proto.get_state(id);
                 if !f(state) { break }
index 21ba9599240ccf801d19e568363474a7199a2dda..491d6104c7bed3db65ae1b8ab88501a1bc26574e 100644 (file)
@@ -48,7 +48,7 @@ impl of qq_helper for @ast::expr {
     fn span() -> span {self.span}
     fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_expr(self, cx, v);}
     fn extract_mac() -> option<ast::mac_> {
-        alt (self.node) {
+        match (self.node) {
           ast::expr_mac({node: mac, _}) => some(mac),
           _ => none
         }
@@ -63,7 +63,7 @@ impl of qq_helper for @ast::ty {
     fn span() -> span {self.span}
     fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_ty(self, cx, v);}
     fn extract_mac() -> option<ast::mac_> {
-        alt (self.node) {
+        match (self.node) {
           ast::ty_mac({node: mac, _}) => some(mac),
           _ => none
         }
@@ -124,7 +124,7 @@ fn gather_anti_quotes<N: qq_helper>(lo: uint, node: N) -> aq_ctxt
 
 fn visit_aq<T:qq_helper>(node: T, constr: ~str, &&cx: aq_ctxt, v: vt<aq_ctxt>)
 {
-    alt (node.extract_mac()) {
+    match (node.extract_mac()) {
       some(mac_aq(sp, e)) => {
         cx.gather.push(gather_item {
             lo: sp.lo - cx.lo,
@@ -147,7 +147,7 @@ fn expand_ast(ecx: ext_ctxt, _sp: span,
     let mut what = ~"expr";
     do option::iter(arg) |arg| {
         let args: ~[@ast::expr] =
-            alt arg.node {
+            match arg.node {
               ast::expr_vec(elts, _) => elts,
               _ => {
                 ecx.span_fatal
@@ -157,7 +157,7 @@ fn expand_ast(ecx: ext_ctxt, _sp: span,
         if vec::len::<@ast::expr>(args) != 1u {
             ecx.span_fatal(_sp, ~"#ast requires exactly one arg");
         }
-        alt (args[0].node) {
+        match (args[0].node) {
           ast::expr_path(@{idents: id, _}) if vec::len(id) == 1u
           => what = *id[0],
           _ => ecx.span_fatal(args[0].span, ~"expected an identifier")
@@ -165,7 +165,7 @@ fn expand_ast(ecx: ext_ctxt, _sp: span,
     }
     let body = get_mac_body(ecx,_sp,body);
 
-    return alt what {
+    return match what {
       ~"crate" => finish(ecx, body, parse_crate),
       ~"expr" => finish(ecx, body, parse_expr),
       ~"ty" => finish(ecx, body, parse_ty),
@@ -183,7 +183,7 @@ fn parse_expr(p: parser) -> @ast::expr { p.parse_expr() }
 fn parse_pat(p: parser) -> @ast::pat { p.parse_pat(true) }
 
 fn parse_item(p: parser) -> @ast::item {
-    alt p.parse_item(~[]) {
+    match p.parse_item(~[]) {
       some(item) => item,
       none       => fail ~"parse_item: parsing an item failed"
     }
@@ -225,7 +225,7 @@ fn finish<T: qq_helper>
             state = skip(str::char_len(repl));
             str2 += repl;
         }
-        alt copy state {
+        match copy state {
           active => str::push_char(str2, ch),
           skip(1u) => state = blank,
           skip(sk) => state = skip (sk-1u),
@@ -308,8 +308,8 @@ fn replace_expr(repls: ~[fragment],
                 orig: fn@(ast::expr_, span, ast_fold)->(ast::expr_, span))
     -> (ast::expr_, span)
 {
-    alt e {
-      ast::expr_mac({node: mac_var(i), _}) => alt (repls[i]) {
+    match e {
+      ast::expr_mac({node: mac_var(i), _}) => match (repls[i]) {
         from_expr(r) => (r.node, r.span),
         _ => fail /* fixme error message */
       }
@@ -322,8 +322,8 @@ fn replace_ty(repls: ~[fragment],
                 orig: fn@(ast::ty_, span, ast_fold)->(ast::ty_, span))
     -> (ast::ty_, span)
 {
-    alt e {
-      ast::ty_mac({node: mac_var(i), _}) => alt (repls[i]) {
+    match e {
+      ast::ty_mac({node: mac_var(i), _}) => match (repls[i]) {
         from_ty(r) => (r.node, r.span),
         _ => fail /* fixme error message */
       }
index 79b609113abb557307726b0eac678ef13e7b5225..bdb0c663fc7e7cd10f6da710c4e53421e4ca2c16 100644 (file)
@@ -36,7 +36,7 @@ enum matchable {
 
 /* for when given an incompatible bit of AST */
 fn match_error(cx: ext_ctxt, m: matchable, expected: ~str) -> ! {
-    alt m {
+    match m {
       match_expr(x) => cx.span_fatal(
           x.span, ~"this argument is an expr, expected " + expected),
       match_path(x) => cx.span_fatal(
@@ -65,8 +65,8 @@ fn elts_to_ell(cx: ext_ctxt, elts: ~[@expr]) ->
     let mut idx: uint = 0u;
     let mut res = none;
     for elts.each |elt| {
-        alt elt.node {
-          expr_mac(m) => alt m.node {
+        match elt.node {
+          expr_mac(m) => match m.node {
             ast::mac_ellipsis => {
                 if res != none {
                     cx.span_fatal(m.span, ~"only one ellipsis allowed");
@@ -82,7 +82,7 @@ fn elts_to_ell(cx: ext_ctxt, elts: ~[@expr]) ->
         }
         idx += 1u;
     }
-    return alt res {
+    return match res {
           some(val) => val,
           none => {pre: elts, rep: none, post: ~[]}
     }
@@ -92,7 +92,7 @@ fn option_flatten_map<T: copy, U: copy>(f: fn@(T) -> option<U>, v: ~[T]) ->
    option<~[U]> {
     let mut res = ~[];
     for v.each |elem| {
-        alt f(elem) {
+        match f(elem) {
           none => return none,
           some(fv) => vec::push(res, fv)
         }
@@ -101,9 +101,9 @@ fn option_flatten_map<T: copy, U: copy>(f: fn@(T) -> option<U>, v: ~[T]) ->
 }
 
 fn a_d_map(ad: arb_depth<matchable>, f: selector) -> match_result {
-    alt ad {
+    match ad {
       leaf(x) => return f(x),
-      seq(ads, span) => alt option_flatten_map(|x| a_d_map(x, f), *ads) {
+      seq(ads, span) => match option_flatten_map(|x| a_d_map(x, f), *ads) {
         none => return none,
         some(ts) => return some(seq(@ts, span))
       }
@@ -112,7 +112,7 @@ fn a_d_map(ad: arb_depth<matchable>, f: selector) -> match_result {
 
 fn compose_sels(s1: selector, s2: selector) -> selector {
     fn scomp(s1: selector, s2: selector, m: matchable) -> match_result {
-        return alt s1(m) {
+        return match s1(m) {
               none => none,
               some(matches) => a_d_map(matches, s2)
             }
@@ -156,11 +156,11 @@ fn use_selectors_to_bind(b: binders, e: @expr) -> option<bindings> {
     let res = box_str_hash::<arb_depth<matchable>>();
     //need to do this first, to check vec lengths.
     for b.literal_ast_matchers.each |sel| {
-        alt sel(match_expr(e)) { none => return none, _ => () }
+        match sel(match_expr(e)) { none => return none, _ => () }
     }
     let mut never_mind: bool = false;
     for b.real_binders.each |key, val| {
-        alt val(match_expr(e)) {
+        match val(match_expr(e)) {
           none => never_mind = true,
           some(mtc) => { res.insert(key, mtc); }
         }
@@ -209,7 +209,7 @@ fn follow(m: arb_depth<matchable>, idx_path: @mut ~[uint]) ->
    arb_depth<matchable> {
     let mut res: arb_depth<matchable> = m;
     for vec::each(*idx_path) |idx| {
-        res = alt res {
+        res = match res {
           leaf(_) => return res,/* end of the line */
           seq(new_ms, _) => new_ms[idx]
         }
@@ -219,10 +219,10 @@ fn follow(m: arb_depth<matchable>, idx_path: @mut ~[uint]) ->
 
 fn follow_for_trans(cx: ext_ctxt, mmaybe: option<arb_depth<matchable>>,
                     idx_path: @mut ~[uint]) -> option<matchable> {
-    alt mmaybe {
+    match mmaybe {
       none => return none,
       some(m) => {
-        return alt follow(m, idx_path) {
+        return match follow(m, idx_path) {
               seq(_, sp) => {
                 cx.span_fatal(sp,
                               ~"syntax matched under ... but not " +
@@ -258,10 +258,10 @@ fn mark_ident(&&i: ident, _fld: ast_fold, b: bindings,
 fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
                     recur: fn@(&&@expr) -> @expr,
                     exprs: ~[@expr]) -> ~[@expr] {
-    alt elts_to_ell(cx, exprs) {
+    match elts_to_ell(cx, exprs) {
       {pre: pre, rep: repeat_me_maybe, post: post} => {
         let mut res = vec::map(pre, recur);
-        alt repeat_me_maybe {
+        match repeat_me_maybe {
           none => (),
           some(repeat_me) => {
             let mut repeat: option<{rep_count: uint, name: ident}> = none;
@@ -269,10 +269,10 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
             the leaves, which are just duplicated */
             do free_vars(b, repeat_me) |fv| {
                 let cur_pos = follow(b.get(fv), idx_path);
-                alt cur_pos {
+                match cur_pos {
                   leaf(_) => (),
                   seq(ms, _) => {
-                    alt repeat {
+                    match repeat {
                       none => {
                         repeat = some({rep_count: vec::len(*ms), name: fv});
                       }
@@ -290,7 +290,7 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
                   }
                 }
             };
-            alt repeat {
+            match repeat {
               none => {
                 cx.span_fatal(repeat_me.span,
                               ~"'...' surrounds an expression without any" +
@@ -320,7 +320,7 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
 // substitute, in a position that's required to be an ident
 fn transcribe_ident(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
                     &&i: ident, _fld: ast_fold) -> ident {
-    return alt follow_for_trans(cx, b.find(i), idx_path) {
+    return match follow_for_trans(cx, b.find(i), idx_path) {
           some(match_ident(a_id)) => a_id.node,
           some(m) => match_error(cx, m, ~"an identifier"),
           none => i
@@ -332,7 +332,7 @@ fn transcribe_path(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
                    p: path, _fld: ast_fold) -> path {
     // Don't substitute into qualified names.
     if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { return p; }
-    alt follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
+    match follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
       some(match_ident(id)) => {
         {span: id.span, global: false, idents: ~[id.node],
          rp: none, types: ~[]}
@@ -349,13 +349,13 @@ fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
                    orig: fn@(ast::expr_, span, ast_fold)->(ast::expr_, span))
     -> (ast::expr_, span)
 {
-    return alt e {
+    return match e {
           expr_path(p) => {
             // Don't substitute into qualified names.
             if vec::len(p.types) > 0u || vec::len(p.idents) != 1u {
                 (e, s);
             }
-            alt follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
+            match follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
               some(match_ident(id)) => {
                 (expr_path(@{span: id.span,
                              global: false,
@@ -378,11 +378,11 @@ fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
                    orig: fn@(ast::ty_, span, ast_fold) -> (ast::ty_, span))
     -> (ast::ty_, span)
 {
-    return alt t {
+    return match t {
           ast::ty_path(pth, _) => {
-            alt path_to_ident(pth) {
+            match path_to_ident(pth) {
               some(id) => {
-                alt follow_for_trans(cx, b.find(id), idx_path) {
+                match follow_for_trans(cx, b.find(id), idx_path) {
                   some(match_ty(ty)) => (ty.node, ty.span),
                   some(m) => match_error(cx, m, ~"a type"),
                   none => orig(t, s, fld)
@@ -404,9 +404,9 @@ fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
                     orig: fn@(blk_, span, ast_fold) -> (blk_, span))
     -> (blk_, span)
 {
-    return alt block_to_ident(blk) {
+    return match block_to_ident(blk) {
           some(id) => {
-            alt follow_for_trans(cx, b.find(id), idx_path) {
+            match follow_for_trans(cx, b.find(id), idx_path) {
               some(match_block(new_blk)) => (new_blk.node, new_blk.span),
 
               // possibly allow promotion of ident/path/expr to blocks?
@@ -424,12 +424,12 @@ fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
 fn p_t_s_rec(cx: ext_ctxt, m: matchable, s: selector, b: binders) {
 
     //it might be possible to traverse only exprs, not matchables
-    alt m {
+    match m {
       match_expr(e) => {
-        alt e.node {
+        match e.node {
           expr_path(p_pth) => p_t_s_r_path(cx, p_pth, s, b),
           expr_vec(p_elts, _) => {
-            alt elts_to_ell(cx, p_elts) {
+            match elts_to_ell(cx, p_elts) {
               {pre: pre, rep: some(repeat_me), post: post} => {
                 p_t_s_r_length(cx, vec::len(pre) + vec::len(post), true, s,
                                b);
@@ -459,7 +459,7 @@ fn p_t_s_rec(cx: ext_ctxt, m: matchable, s: selector, b: binders) {
           _ => {
             fn select(cx: ext_ctxt, m: matchable, pat: @expr) ->
                match_result {
-                return alt m {
+                return match m {
                       match_expr(e) => {
                         if e == pat { some(leaf(match_exact)) } else { none }
                       }
@@ -477,11 +477,11 @@ fn select(cx: ext_ctxt, m: matchable, pat: @expr) ->
 
 /* make a match more precise */
 fn specialize_match(m: matchable) -> matchable {
-    return alt m {
+    return match m {
           match_expr(e) => {
-            alt e.node {
+            match e.node {
               expr_path(pth) => {
-                alt path_to_ident(pth) {
+                match path_to_ident(pth) {
                   some(id) => match_ident(respan(pth.span, id)),
                   none => match_path(pth)
                 }
@@ -495,10 +495,10 @@ fn specialize_match(m: matchable) -> matchable {
 
 /* pattern_to_selectors helper functions */
 fn p_t_s_r_path(cx: ext_ctxt, p: @path, s: selector, b: binders) {
-    alt path_to_ident(p) {
+    match path_to_ident(p) {
       some(p_id) => {
         fn select(cx: ext_ctxt, m: matchable) -> match_result {
-            return alt m {
+            return match m {
                   match_expr(e) => some(leaf(specialize_match(m))),
                   _ => cx.bug(~"broken traversal in p_t_s_r")
                 }
@@ -514,8 +514,8 @@ fn select(cx: ext_ctxt, m: matchable) -> match_result {
 
 fn block_to_ident(blk: blk_) -> option<ident> {
     if vec::len(blk.stmts) != 0u { return none; }
-    return alt blk.expr {
-          some(expr) => alt expr.node {
+    return match blk.expr {
+          some(expr) => match expr.node {
             expr_path(pth) => path_to_ident(pth),
             _ => none
           }
@@ -526,8 +526,8 @@ fn block_to_ident(blk: blk_) -> option<ident> {
 fn p_t_s_r_mac(cx: ext_ctxt, mac: ast::mac, _s: selector, _b: binders) {
     fn select_pt_1(cx: ext_ctxt, m: matchable,
                    fn_m: fn(ast::mac) -> match_result) -> match_result {
-        return alt m {
-              match_expr(e) => alt e.node {
+        return match m {
+              match_expr(e) => match e.node {
                 expr_mac(mac) => fn_m(mac),
                 _ => none
               }
@@ -537,7 +537,7 @@ fn select_pt_1(cx: ext_ctxt, m: matchable,
     fn no_des(cx: ext_ctxt, sp: span, syn: ~str) -> ! {
         cx.span_fatal(sp, ~"destructuring " + syn + ~" is not yet supported");
     }
-    alt mac.node {
+    match mac.node {
       ast::mac_ellipsis => cx.span_fatal(mac.span, ~"misused `...`"),
       ast::mac_invoc(_, _, _) => no_des(cx, mac.span, ~"macro calls"),
       ast::mac_invoc_tt(_, _) => no_des(cx, mac.span, ~"macro calls"),
@@ -550,9 +550,9 @@ fn p_t_s_r_ellipses(cx: ext_ctxt, repeat_me: @expr, offset: uint, s: selector,
                     b: binders) {
     fn select(cx: ext_ctxt, repeat_me: @expr, offset: uint, m: matchable) ->
        match_result {
-        return alt m {
+        return match m {
               match_expr(e) => {
-                alt e.node {
+                match e.node {
                   expr_vec(arg_elts, _) => {
                     let mut elts = ~[];
                     let mut idx = offset;
@@ -580,9 +580,9 @@ fn p_t_s_r_length(cx: ext_ctxt, len: uint, at_least: bool, s: selector,
                   b: binders) {
     fn len_select(_cx: ext_ctxt, m: matchable, at_least: bool, len: uint) ->
        match_result {
-        return alt m {
+        return match m {
               match_expr(e) => {
-                alt e.node {
+                match e.node {
                   expr_vec(arg_elts, _) => {
                     let actual_len = vec::len(arg_elts);
                     if at_least && actual_len >= len || actual_len == len {
@@ -604,9 +604,9 @@ fn p_t_s_r_actual_vector(cx: ext_ctxt, elts: ~[@expr], _repeat_after: bool,
     let mut idx: uint = 0u;
     while idx < vec::len(elts) {
         fn select(cx: ext_ctxt, m: matchable, idx: uint) -> match_result {
-            return alt m {
+            return match m {
                   match_expr(e) => {
-                    alt e.node {
+                    match e.node {
                       expr_vec(arg_elts, _) => {
                         some(leaf(match_expr(arg_elts[idx])))
                       }
@@ -629,7 +629,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
     let mut macro_name: option<@~str> = none;
     let mut clauses: ~[@clause] = ~[];
     for args.each |arg| {
-        alt arg.node {
+        match arg.node {
           expr_vec(elts, mutbl) => {
             if vec::len(elts) != 2u {
                 cx.span_fatal((*arg).span,
@@ -638,12 +638,12 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
             }
 
 
-            alt elts[0u].node {
+            match elts[0u].node {
               expr_mac(mac) => {
-                alt mac.node {
+                match mac.node {
                   mac_invoc(pth, invoc_arg, body) => {
-                    alt path_to_ident(pth) {
-                      some(id) => alt macro_name {
+                    match path_to_ident(pth) {
+                      some(id) => match macro_name {
                         none => macro_name = some(id),
                         some(other_id) => if id != other_id {
                             cx.span_fatal(pth.span,
@@ -654,7 +654,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
                       none => cx.span_fatal(pth.span,
                                             ~"macro name must not be a path")
                     }
-                    let arg = alt invoc_arg {
+                    let arg = match invoc_arg {
                       some(arg) => arg,
                       none => cx.span_fatal(mac.span,
                                            ~"macro must have arguments")
@@ -689,7 +689,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
     let ext = |a,b,c,d, move clauses| generic_extension(a,b,c,d,clauses);
 
     return {ident:
-             alt macro_name {
+             match macro_name {
                some(id) => id,
                none => cx.span_fatal(sp, ~"macro definition must have " +
                                      ~"at least one clause")
@@ -699,12 +699,12 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
     fn generic_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
                          _body: ast::mac_body,
                          clauses: ~[@clause]) -> @expr {
-        let arg = alt arg {
+        let arg = match arg {
           some(arg) => arg,
           none => cx.span_fatal(sp, ~"macro must have arguments")
         };
         for clauses.each |c| {
-            alt use_selectors_to_bind(c.params, arg) {
+            match use_selectors_to_bind(c.params, arg) {
               some(bindings) => return transcribe(cx, bindings, c.body),
               none => again
             }
index c55f1e67be23d1b793c7b0aa70da3775667f7ae7..3fdd5239e651538b68c49e928967b4f576e011b8 100644 (file)
@@ -70,7 +70,7 @@ fn expand_include_str(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
     let file = expr_to_str(cx, args[0], ~"#include_str requires a string");
 
     let res = io::read_whole_file_str(res_rel_file(cx, sp, file));
-    alt res {
+    match res {
       result::ok(_) => { /* Continue. */ }
       result::err(e) => {
         cx.parse_sess().span_diagnostic.handler().fatal(e);
@@ -86,7 +86,7 @@ fn expand_include_bin(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
 
     let file = expr_to_str(cx, args[0], ~"#include_bin requires a string");
 
-    alt io::read_whole_file(res_rel_file(cx, sp, file)) {
+    match io::read_whole_file(res_rel_file(cx, sp, file)) {
       result::ok(src) => {
         let u8_exprs = vec::map(src, |char: u8| {
             mk_u8(cx, sp, char)
index 6a801f33aa61e7e1ab6f5278dd0473af98f138aa..f1c7ebb7dadaf4acad958fa399245b36f7490e91 100644 (file)
@@ -31,7 +31,7 @@ enum matcher_pos_up { /* to break a circularity */
 }
 
 fn is_some(&&mpu: matcher_pos_up) -> bool {
-    alt mpu {
+    match mpu {
       matcher_pos_up(none) => false,
       _ => true
     }
@@ -48,7 +48,7 @@ fn is_some(&&mpu: matcher_pos_up) -> bool {
 };
 
 fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos {
-    alt mpu {
+    match mpu {
       matcher_pos_up(some(mp)) => copy mp,
       _ => fail
     }
@@ -56,7 +56,7 @@ fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos {
 
 fn count_names(ms: &[matcher]) -> uint {
     vec::foldl(0u, ms, |ct, m| {
-        ct + alt m.node {
+        ct + match m.node {
           match_tok(_) => 0u,
           match_seq(more_ms, _, _, _, _) => count_names(more_ms),
           match_nonterminal(_,_,_) => 1u
@@ -68,7 +68,7 @@ fn initial_matcher_pos(ms: ~[matcher], sep: option<token>, lo: uint)
     -> matcher_pos {
     let mut match_idx_hi = 0u;
     for ms.each() |elt| {
-        alt elt.node {
+        match elt.node {
           match_tok(_) => (),
           match_seq(_,_,_,_,hi) => {
             match_idx_hi = hi;       // it is monotonic...
@@ -113,7 +113,7 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
     -> hashmap<ident,@named_match> {
     fn n_rec(p_s: parse_sess, m: matcher, res: ~[@named_match],
              ret_val: hashmap<ident, @named_match>) {
-        alt m {
+        match m {
           {node: match_tok(_), span: _} => (),
           {node: match_seq(more_ms, _, _, _, _), span: _} => {
             for more_ms.each() |next_m| { n_rec(p_s, next_m, res, ret_val) };
@@ -139,7 +139,7 @@ enum parse_result {
 
 fn parse_or_else(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
                  ms: ~[matcher]) -> hashmap<ident, @named_match> {
-    alt parse(sess, cfg, rdr, ms) {
+    match parse(sess, cfg, rdr, ms) {
       success(m) => m,
       failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str)
     }
@@ -202,7 +202,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                     // can we go around again?
 
                     // the *_t vars are workarounds for the lack of unary move
-                    alt copy ei.sep {
+                    match copy ei.sep {
                       some(t) if idx == len => { // we need a separator
                         if tok == t { //pass the separator
                             let ei_t <- ei;
@@ -220,7 +220,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                     vec::push(eof_eis, ei);
                 }
             } else {
-                alt copy ei.elts[idx].node {
+                match copy ei.elts[idx].node {
                   /* need to descend into sequence */
                   match_seq(matchers, sep, zero_ok,
                             match_idx_lo, match_idx_hi) => {
@@ -270,7 +270,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
             if (bb_eis.len() > 0u && next_eis.len() > 0u)
                 || bb_eis.len() > 1u {
                 let nts = str::connect(vec::map(bb_eis, |ei| {
-                    alt ei.elts[ei.idx].node {
+                    match ei.elts[ei.idx].node {
                       match_nonterminal(bind,name,_) => {
                         fmt!{"%s ('%s')", *name, *bind}
                       }
@@ -293,7 +293,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                 let rust_parser = parser(sess, cfg, rdr.dup(), SOURCE_FILE);
 
                 let ei = vec::pop(bb_eis);
-                alt ei.elts[ei.idx].node {
+                match ei.elts[ei.idx].node {
                   match_nonterminal(_, name, idx) => {
                     ei.matches[idx].push(@matched_nonterminal(
                         parse_nt(rust_parser, *name)));
@@ -318,8 +318,8 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
 }
 
 fn parse_nt(p: parser, name: ~str) -> nonterminal {
-    alt name {
-      ~"item" => alt p.parse_item(~[]) {
+    match name {
+      ~"item" => match p.parse_item(~[]) {
         some(i) => token::nt_item(i),
         none => p.fatal(~"expected an item keyword")
       }
@@ -329,7 +329,7 @@ fn parse_nt(p: parser, name: ~str) -> nonterminal {
       ~"expr" => token::nt_expr(p.parse_expr()),
       ~"ty" => token::nt_ty(p.parse_ty(false /* no need to disambiguate*/)),
       // this could be handled like a token, since it is one
-      ~"ident" => alt copy p.token {
+      ~"ident" => match copy p.token {
         token::IDENT(sn,b) => { p.bump(); token::nt_ident(sn,b) }
         _ => p.fatal(~"expected ident, found "
                      + token::to_str(*p.reader.interner(), copy p.token))
index b4fc1f5c484b22410ef64a57522f3ac5f3215bb5..a870928d50b992ef994ce42bb3516d1f67641814 100644 (file)
@@ -37,11 +37,11 @@ fn ms(m: matcher_) -> matcher {
                                      arg_reader as reader, argument_gram);
 
     // Extract the arguments:
-    let lhses:~[@named_match] = alt argument_map.get(@~"lhs") {
+    let lhses:~[@named_match] = match argument_map.get(@~"lhs") {
       @matched_seq(s, sp) => s,
       _ => cx.span_bug(sp, ~"wrong-structured lhs")
     };
-    let rhses:~[@named_match] = alt argument_map.get(@~"rhs") {
+    let rhses:~[@named_match] = match argument_map.get(@~"rhs") {
       @matched_seq(s, sp) => s,
       _ => cx.span_bug(sp, ~"wrong-structured rhs")
     };
@@ -58,13 +58,14 @@ fn generic_extension(cx: ext_ctxt, sp: span, arg: ~[ast::token_tree],
         let itr = cx.parse_sess().interner;
 
         for lhses.eachi() |i, lhs| { // try each arm's matchers
-            alt lhs {
+            match lhs {
               @matched_nonterminal(nt_matchers(mtcs)) => {
                 // `none` is because we're not interpolating
                 let arg_rdr = new_tt_reader(s_d, itr, none, arg) as reader;
-                alt parse(cx.parse_sess(), cx.cfg(), arg_rdr, mtcs) {
+                match parse(cx.parse_sess(), cx.cfg(), arg_rdr, mtcs) {
                   success(named_matches) => {
-                    let rhs = alt rhses[i] { // okay, what's your transcriber?
+                    let rhs = match rhses[i] {
+                        // okay, what's your transcriber?
                       @matched_nonterminal(nt_tt(@tt)) => tt,
                       _ => cx.span_bug(sp, ~"bad thing in rhs")
                     };
index c704fd351ecc6f5521f0c4aba28148d89259ec76..693b538ec6d0ed8fe0326b03004f28482508ef8a 100644 (file)
@@ -46,7 +46,7 @@ fn new_tt_reader(sp_diag: span_handler, itr: @interner<@~str>,
     let r = @{sp_diag: sp_diag, interner: itr,
               mut cur: @{readme: src, mut idx: 0u, dotdotdoted: false,
                          sep: none, up: tt_frame_up(option::none)},
-              interpolations: alt interp { /* just a convienience */
+              interpolations: match interp { /* just a convienience */
                 none => std::map::box_str_hash::<@named_match>(),
                 some(x) => x
               },
@@ -61,7 +61,7 @@ fn new_tt_reader(sp_diag: span_handler, itr: @interner<@~str>,
 
 pure fn dup_tt_frame(&&f: tt_frame) -> tt_frame {
     @{readme: f.readme, mut idx: f.idx, dotdotdoted: f.dotdotdoted,
-      sep: f.sep, up: alt f.up {
+      sep: f.sep, up: match f.up {
         tt_frame_up(some(up_frame)) => {
           tt_frame_up(some(dup_tt_frame(up_frame)))
         }
@@ -82,7 +82,7 @@ fn new_tt_reader(sp_diag: span_handler, itr: @interner<@~str>,
 pure fn lookup_cur_matched_by_matched(r: tt_reader,
                                       start: @named_match) -> @named_match {
     pure fn red(&&ad: @named_match, &&idx: uint) -> @named_match {
-        alt *ad {
+        match *ad {
           matched_nonterminal(_) => {
             // end of the line; duplicate henceforth
             ad
@@ -102,10 +102,10 @@ enum lis {
 
 fn lockstep_iter_size(&&t: token_tree, &&r: tt_reader) -> lis {
     fn lis_merge(lhs: lis, rhs: lis) -> lis {
-        alt lhs {
+        match lhs {
           lis_unconstrained => rhs,
           lis_contradiction(_) => lhs,
-          lis_constraint(l_len, l_id) => alt rhs {
+          lis_constraint(l_len, l_id) => match rhs {
             lis_unconstrained => lhs,
             lis_contradiction(_) => rhs,
             lis_constraint(r_len, _) if l_len == r_len => lhs,
@@ -117,13 +117,13 @@ fn lis_merge(lhs: lis, rhs: lis) -> lis {
           }
         }
     }
-    alt t {
+    match t {
       tt_delim(tts) | tt_seq(_, tts, _, _) => {
         vec::foldl(lis_unconstrained, tts, {|lis, tt|
             lis_merge(lis, lockstep_iter_size(tt, r)) })
       }
       tt_tok(*) => lis_unconstrained,
-      tt_nonterminal(_, name) => alt *lookup_cur_matched(r, name) {
+      tt_nonterminal(_, name) => match *lookup_cur_matched(r, name) {
         matched_nonterminal(_) => lis_unconstrained,
         matched_seq(ads, _) => lis_constraint(ads.len(), name)
       }
@@ -138,7 +138,7 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
         if ! r.cur.dotdotdoted
             || r.repeat_idx.last() == r.repeat_len.last() - 1 {
 
-            alt r.cur.up {
+            match r.cur.up {
               tt_frame_up(none) => {
                 r.cur_tok = EOF;
                 return ret_val;
@@ -156,7 +156,7 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
         } else { /* repeat */
             r.cur.idx = 0u;
             r.repeat_idx[r.repeat_idx.len() - 1u] += 1u;
-            alt r.cur.sep {
+            match r.cur.sep {
               some(tk) => {
                 r.cur_tok = tk; /* repeat same span, I guess */
                 return ret_val;
@@ -167,7 +167,7 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
     }
     loop { /* because it's easiest, this handles `tt_delim` not starting
     with a `tt_tok`, even though it won't happen */
-        alt r.cur.readme[r.cur.idx] {
+        match r.cur.readme[r.cur.idx] {
           tt_delim(tts) => {
             r.cur = @{readme: tts, mut idx: 0u, dotdotdoted: false,
                       sep: none, up: tt_frame_up(option::some(r.cur)) };
@@ -179,7 +179,7 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
             return ret_val;
           }
           tt_seq(sp, tts, sep, zerok) => {
-            alt lockstep_iter_size(tt_seq(sp, tts, sep, zerok), r) {
+            match lockstep_iter_size(tt_seq(sp, tts, sep, zerok), r) {
               lis_unconstrained => {
                 r.sp_diag.span_fatal(
                     sp, /* blame macro writer */
@@ -212,7 +212,7 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
           }
           // FIXME #2887: think about span stuff here
           tt_nonterminal(sp, ident) => {
-            alt *lookup_cur_matched(r, ident) {
+            match *lookup_cur_matched(r, ident) {
               /* sidestep the interpolation tricks for ident because
               (a) idents can be in lots of places, so it'd be a pain
               (b) we actually can, since it's a token. */
index 71c23ff4fa6d4e656b8058c2305bd16e9a28fd90..40c676f8b80cabf4324fd579a69f27b0ea8b9996 100644 (file)
@@ -80,7 +80,7 @@ trait ast_fold {
 //used in noop_fold_item and noop_fold_crate and noop_fold_crate_directive
 fn fold_meta_item_(&&mi: @meta_item, fld: ast_fold) -> @meta_item {
     return @{node:
-              alt mi.node {
+              match mi.node {
                 meta_word(id) => meta_word(fld.fold_ident(id)),
                 meta_list(id, mis) => {
                   let fold_meta_item = |x|fold_meta_item_(x, fld);
@@ -112,7 +112,7 @@ fn fold_arg_(a: arg, fld: ast_fold) -> arg {
 //used in noop_fold_expr, and possibly elsewhere in the future
 fn fold_mac_(m: mac, fld: ast_fold) -> mac {
     return {node:
-             alt m.node {
+             match m.node {
                mac_invoc(pth, arg, body) => {
                  mac_invoc(fld.fold_path(pth),
                            option::map(arg, |x| fld.fold_expr(x)), body)
@@ -133,7 +133,7 @@ fn fold_fn_decl(decl: ast::fn_decl, fld: ast_fold) -> ast::fn_decl {
 }
 
 fn fold_ty_param_bound(tpb: ty_param_bound, fld: ast_fold) -> ty_param_bound {
-    alt tpb {
+    match tpb {
       bound_copy | bound_send | bound_const | bound_owned => tpb,
       bound_trait(ty) => bound_trait(fld.fold_ty(ty))
     }
@@ -163,7 +163,7 @@ fn noop_fold_crate(c: crate_, fld: ast_fold) -> crate_ {
 
 fn noop_fold_crate_directive(cd: crate_directive_, fld: ast_fold) ->
    crate_directive_ {
-    return alt cd {
+    return match cd {
           cdir_src_mod(id, attrs) => {
             cdir_src_mod(fld.fold_ident(id), /* FIXME (#2543) */ copy attrs)
           }
@@ -190,7 +190,7 @@ fn noop_fold_foreign_item(&&ni: @foreign_item, fld: ast_fold)
     return @{ident: fld.fold_ident(ni.ident),
           attrs: vec::map(ni.attrs, fold_attribute),
           node:
-              alt ni.node {
+              match ni.node {
                 foreign_item_fn(fdec, typms) => {
                   foreign_item_fn({inputs: vec::map(fdec.inputs, fold_arg),
                                   output: fld.fold_ty(fdec.output),
@@ -216,7 +216,7 @@ fn noop_fold_item(&&i: @item, fld: ast_fold) -> option<@item> {
 
 fn noop_fold_class_item(&&ci: @class_member, fld: ast_fold)
     -> @class_member {
-    @{node: alt ci.node {
+    @{node: match ci.node {
         instance_var(ident, t, cm, id, p) => {
            instance_var(/* FIXME (#2543) */ copy ident,
                         fld.fold_ty(t), cm, id, p)
@@ -227,7 +227,7 @@ fn noop_fold_class_item(&&ci: @class_member, fld: ast_fold)
 }
 
 fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
-    return alt i {
+    return match i {
           item_const(t, e) => item_const(fld.fold_ty(t), fld.fold_expr(e)),
           item_fn(decl, typms, body) => {
               item_fn(fold_fn_decl(decl, fld),
@@ -244,7 +244,7 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
           }
           item_class(typms, traits, items, m_ctor, m_dtor) => {
             let resulting_optional_constructor;
-            alt m_ctor {
+            match m_ctor {
                 none => {
                     resulting_optional_constructor = none;
                 }
@@ -319,7 +319,7 @@ fn noop_fold_block(b: blk_, fld: ast_fold) -> blk_ {
 }
 
 fn noop_fold_stmt(s: stmt_, fld: ast_fold) -> stmt_ {
-    return alt s {
+    return match s {
       stmt_decl(d, nid) => stmt_decl(fld.fold_decl(d), fld.new_id(nid)),
       stmt_expr(e, nid) => stmt_expr(fld.fold_expr(e), fld.new_id(nid)),
       stmt_semi(e, nid) => stmt_semi(fld.fold_expr(e), fld.new_id(nid))
@@ -333,7 +333,7 @@ fn noop_fold_arm(a: arm, fld: ast_fold) -> arm {
 }
 
 fn noop_fold_pat(p: pat_, fld: ast_fold) -> pat_ {
-    return alt p {
+    return match p {
           pat_wild => pat_wild,
           pat_ident(binding_mode, pth, sub) => {
             pat_ident(binding_mode,
@@ -364,9 +364,9 @@ fn noop_fold_pat(p: pat_, fld: ast_fold) -> pat_ {
 }
 
 fn noop_fold_decl(d: decl_, fld: ast_fold) -> decl_ {
-    alt d {
+    match d {
       decl_local(ls) => decl_local(vec::map(ls, |x| fld.fold_local(x))),
-      decl_item(it) => alt fld.fold_item(it) {
+      decl_item(it) => match fld.fold_item(it) {
         some(it_folded) => decl_item(it_folded),
         none => decl_local(~[])
       }
@@ -393,7 +393,7 @@ fn fold_field_(field: field, fld: ast_fold) -> field {
 
     let fold_mac = |x| fold_mac_(x, fld);
 
-    return alt e {
+    return match e {
           expr_vstore(e, v) => {
             expr_vstore(fld.fold_expr(e), v)
           }
@@ -496,7 +496,7 @@ fn fold_field(f: ty_field, fld: ast_fold) -> ty_field {
                 mt: fold_mt(f.node.mt, fld)},
          span: fld.new_span(f.span)}
     }
-    alt t {
+    match t {
       ty_nil | ty_bot | ty_infer => copy t,
       ty_box(mt) => ty_box(fold_mt(mt, fld)),
       ty_uniq(mt) => ty_uniq(fold_mt(mt, fld)),
@@ -533,7 +533,7 @@ fn fold_variant_arg_(va: variant_arg, fld: ast_fold) -> variant_arg {
     let fold_attribute = |x| fold_attribute_(x, fld);
     let attrs = vec::map(v.attrs, fold_attribute);
 
-    let de = alt v.disr_expr {
+    let de = match v.disr_expr {
       some(e) => some(fld.fold_expr(e)),
       none => none
     };
@@ -560,7 +560,7 @@ fn noop_fold_local(l: local_, fld: ast_fold) -> local_ {
          ty: fld.fold_ty(l.ty),
          pat: fld.fold_pat(l.pat),
          init:
-             alt l.init {
+             match l.init {
                option::none::<initializer> => l.init,
                option::some::<initializer>(init) => {
                  option::some::<initializer>({op: init.op,
@@ -635,7 +635,7 @@ fn fold_item(&&i: @item) -> option<@item> {
         return self.fold_item(i, self as ast_fold);
     }
     fn fold_class_item(&&ci: @class_member) -> @class_member {
-        @{node: alt ci.node {
+        @{node: match ci.node {
            instance_var(nm, t, mt, id, p) => {
                instance_var(/* FIXME (#2543) */ copy nm,
                             (self as ast_fold).fold_ty(t), mt, id, p)
index 71e7c4a04e54a9cf577873824655e187fde66a02..0a6df808530dc2d7cfb3ddb62ac568fc06d4dd9d 100644 (file)
@@ -189,7 +189,7 @@ fn new_parser_etc_from_file(sess: parse_sess, cfg: ast::crate_cfg,
                             +path: ~str, ftype: parser::file_type) ->
    (parser, string_reader) {
     let res = io::read_whole_file_str(path);
-    alt res {
+    match res {
       result::ok(_) => { /* Continue. */ }
       result::err(e) => sess.span_diagnostic.handler().fatal(e)
     }
index 006bd3909d825336b15a60261f1c2f71549a04d4..aefa7264bf6cded85a6acf17500865e820618889 100644 (file)
@@ -29,7 +29,7 @@ fn parse_outer_attrs_or_ext(first_item_attrs: ~[ast::attribute])
         -> attr_or_ext
     {
         let expect_item_next = vec::is_not_empty(first_item_attrs);
-        alt self.token {
+        match self.token {
           token::POUND => {
             let lo = self.span.lo;
             if self.look_ahead(1u) == token::LBRACKET {
@@ -57,7 +57,7 @@ fn parse_outer_attrs_or_ext(first_item_attrs: ~[ast::attribute])
     fn parse_outer_attributes() -> ~[ast::attribute] {
         let mut attrs: ~[ast::attribute] = ~[];
         loop {
-            alt copy self.token {
+            match copy self.token {
               token::POUND => {
                 if self.look_ahead(1u) != token::LBRACKET {
                     break;
@@ -106,7 +106,7 @@ fn parse_inner_attrs_and_next() ->
         let mut inner_attrs: ~[ast::attribute] = ~[];
         let mut next_outer_attrs: ~[ast::attribute] = ~[];
         loop {
-            alt copy self.token {
+            match copy self.token {
               token::POUND => {
                 if self.look_ahead(1u) != token::LBRACKET {
                     // This is an extension
@@ -146,7 +146,7 @@ fn parse_inner_attrs_and_next() ->
     fn parse_meta_item() -> @ast::meta_item {
         let lo = self.span.lo;
         let ident = self.parse_ident();
-        alt self.token {
+        match self.token {
           token::EQ => {
             self.bump();
             let lit = self.parse_lit();
@@ -172,7 +172,7 @@ fn parse_meta_seq() -> ~[@ast::meta_item] {
     }
 
     fn parse_optional_meta() -> ~[@ast::meta_item] {
-        alt self.token {
+        match self.token {
           token::LPAREN => return self.parse_meta_seq(),
           _ => return ~[]
         }
index 8450ce0038dd1d11f9816c87956c63d59282ba7b..38599907e6f887eb80cf6301a2d6350d9b02d9b4 100644 (file)
@@ -5,7 +5,7 @@
 import ast_util::operator_prec;
 
 fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
-    alt e.node {
+    match e.node {
       ast::expr_if(_, _, _) | ast::expr_alt(_, _, _) | ast::expr_block(_)
       | ast::expr_while(_, _) | ast::expr_loop(_)
       | ast::expr_call(_, _, true) => false,
@@ -14,9 +14,9 @@ fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
 }
 
 fn stmt_ends_with_semi(stmt: ast::stmt) -> bool {
-    alt stmt.node {
+    match stmt.node {
       ast::stmt_decl(d, _) => {
-        return alt d.node {
+        return match d.node {
               ast::decl_local(_) => true,
               ast::decl_item(_) => false
             }
@@ -31,7 +31,7 @@ fn stmt_ends_with_semi(stmt: ast::stmt) -> bool {
 }
 
 fn need_parens(expr: @ast::expr, outer_prec: uint) -> bool {
-    alt expr.node {
+    match expr.node {
       ast::expr_binary(op, _, _) => operator_prec(op) < outer_prec,
       ast::expr_cast(_, _) => parse::prec::as_prec < outer_prec,
       // This may be too conservative in some cases
@@ -47,8 +47,8 @@ fn need_parens(expr: @ast::expr, outer_prec: uint) -> bool {
 }
 
 fn ends_in_lit_int(ex: @ast::expr) -> bool {
-    alt ex.node {
-      ast::expr_lit(node) => alt node {
+    match ex.node {
+      ast::expr_lit(node) => match node {
         @{node: ast::lit_int(_, ast::ty_i), _}
         | @{node: ast::lit_int_unsuffixed(_), _} => true,
         _ => false
@@ -60,7 +60,7 @@ fn ends_in_lit_int(ex: @ast::expr) -> bool {
       ast::expr_log(_, _, sub) | ast::expr_assert(sub) => {
         ends_in_lit_int(sub)
       }
-      ast::expr_fail(osub) | ast::expr_ret(osub) => alt osub {
+      ast::expr_fail(osub) | ast::expr_ret(osub) => match osub {
         some(ex) => ends_in_lit_int(ex),
         _ => false
       }
index 6b31b53eaa5c7d86582a2bf7ab86368f7d8d136f..445e4c20eede31ad15845435944f833d739d72e3 100644 (file)
@@ -84,7 +84,7 @@ fn expect(t: token::token) {
     }
 
     fn parse_ident() -> ast::ident {
-        alt copy self.token {
+        match copy self.token {
           token::IDENT(i, _) => { self.bump(); return self.get_str(i); }
           token::INTERPOLATED(token::nt_ident(*)) => { self.bug(
               ~"ident interpolation not converted to real token"); }
@@ -118,7 +118,7 @@ fn require_keyword(word: ~str) {
     }
 
     fn token_is_word(word: ~str, ++tok: token::token) -> bool {
-        alt tok {
+        match tok {
           token::IDENT(sid, false) => { word == *self.get_str(sid) }
           _ => { false }
         }
@@ -134,7 +134,7 @@ fn is_keyword(word: ~str) -> bool {
     }
 
     fn is_any_keyword(tok: token::token) -> bool {
-        alt tok {
+        match tok {
           token::IDENT(sid, false) => {
             self.keywords.contains_key_ref(self.get_str(sid))
           }
@@ -146,7 +146,7 @@ fn eat_keyword(word: ~str) -> bool {
         self.require_keyword(word);
 
         let mut bump = false;
-        let val = alt self.token {
+        let val = match self.token {
           token::IDENT(sid, false) => {
             if word == *self.get_str(sid) {
                 bump = true;
@@ -173,7 +173,7 @@ fn is_restricted_keyword(word: ~str) -> bool {
     }
 
     fn check_restricted_keywords() {
-        alt self.token {
+        match self.token {
           token::IDENT(_, false) => {
             let w = token_to_str(self.reader, self.token);
             self.check_restricted_keywords_(w);
@@ -209,7 +209,7 @@ fn parse_seq_to_before_gt<T: copy>(sep: option<token::token>,
         let mut v = ~[];
         while self.token != token::GT
             && self.token != token::BINOP(token::SHR) {
-            alt sep {
+            match sep {
               some(t) => {
                 if first { first = false; }
                 else { self.expect(t); }
@@ -253,7 +253,7 @@ fn parse_seq_to_before_end<T: copy>(ket: token::token, sep: seq_sep,
         let mut first: bool = true;
         let mut v: ~[T] = ~[];
         while self.token != ket {
-            alt sep.sep {
+            match sep.sep {
               some(t) => {
                 if first { first = false; }
                 else { self.expect(t); }
index 154e653e8908c86a28d3a669d4b055b744d2d3c3..6b0112922a5fb02063893a06ce439049aa68971c 100644 (file)
@@ -47,7 +47,7 @@ fn parse_companion_mod(cx: ctx, prefix: ~str, suffix: option<~str>)
     -> (~[@ast::view_item], ~[@ast::item], ~[ast::attribute]) {
 
     fn companion_file(+prefix: ~str, suffix: option<~str>) -> ~str {
-        return alt suffix {
+        return match suffix {
           option::some(s) => path::connect(prefix, s),
           option::none => prefix
         } + ~".rs";
@@ -56,7 +56,7 @@ fn companion_file(+prefix: ~str, suffix: option<~str>) -> ~str {
     fn file_exists(path: ~str) -> bool {
         // Crude, but there's no lib function for this and I'm not
         // up to writing it just now
-        alt io::file_reader(path) {
+        match io::file_reader(path) {
           result::ok(_) => true,
           result::err(_) => false
         }
@@ -79,7 +79,7 @@ fn file_exists(path: ~str) -> bool {
 }
 
 fn cdir_path_opt(id: ast::ident, attrs: ~[ast::attribute]) -> @~str {
-    alt ::attr::first_attr_value_str_by_name(attrs, ~"path") {
+    match ::attr::first_attr_value_str_by_name(attrs, ~"path") {
       some(d) => return d,
       none => return id
     }
@@ -88,7 +88,7 @@ fn cdir_path_opt(id: ast::ident, attrs: ~[ast::attribute]) -> @~str {
 fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: ~str,
                         &view_items: ~[@ast::view_item],
                         &items: ~[@ast::item]) {
-    alt cdir.node {
+    match cdir.node {
       ast::cdir_src_mod(id, attrs) => {
         let file_path = cdir_path_opt(@(*id + ~".rs"), attrs);
         let full_path =
index bc5aba5283cfaf07de82b45e469304eef1c43993..e9bfbc753f70d0e5ee5fe0d0358f871c14d39b49 100644 (file)
@@ -206,7 +206,7 @@ fn consume_whitespace_and_comments(rdr: string_reader)
 fn consume_any_line_comment(rdr: string_reader)
                                 -> option<{tok: token::token, sp: span}> {
     if rdr.curr == '/' {
-        alt nextch(rdr) {
+        match nextch(rdr) {
           '/' => {
             bump(rdr);
             bump(rdr);
@@ -313,7 +313,7 @@ fn scan_digits(rdr: string_reader, radix: uint) -> ~str {
     loop {
         let c = rdr.curr;
         if c == '_' { bump(rdr); again; }
-        alt char::to_digit(c, radix) {
+        match char::to_digit(c, radix) {
           some(d) => {
             str::push_char(rslt, c);
             bump(rdr);
@@ -371,7 +371,7 @@ fn scan_number(c: char, rdr: string_reader) -> token::token {
             rdr.fatal(~"no valid digits found for number");
         }
         let parsed = option::get(u64::from_str_radix(num_str, base as u64));
-        alt tp {
+        match tp {
           either::left(t) => return token::LIT_INT(parsed as i64, t),
           either::right(t) => return token::LIT_UINT(parsed, t)
         }
@@ -383,7 +383,7 @@ fn scan_number(c: char, rdr: string_reader) -> token::token {
         let dec_part = scan_digits(rdr, 10u);
         num_str += ~"." + dec_part;
     }
-    alt scan_exponent(rdr) {
+    match scan_exponent(rdr) {
       some(s) => {
         is_float = true;
         num_str += s;
@@ -472,7 +472,7 @@ fn binop(rdr: string_reader, op: token::binop) -> token::token {
             return token::BINOPEQ(op);
         } else { return token::BINOP(op); }
     }
-    alt c {
+    match c {
 
 
 
@@ -539,12 +539,12 @@ fn binop(rdr: string_reader, op: token::binop) -> token::token {
       }
       '<' => {
         bump(rdr);
-        alt rdr.curr {
+        match rdr.curr {
           '=' => { bump(rdr); return token::LE; }
           '<' => { return binop(rdr, token::SHL); }
           '-' => {
             bump(rdr);
-            alt rdr.curr {
+            match rdr.curr {
               '>' => { bump(rdr); return token::DARROW; }
               _ => { return token::LARROW; }
             }
@@ -554,7 +554,7 @@ fn binop(rdr: string_reader, op: token::binop) -> token::token {
       }
       '>' => {
         bump(rdr);
-        alt rdr.curr {
+        match rdr.curr {
           '=' => { bump(rdr); return token::GE; }
           '>' => { return binop(rdr, token::SHR); }
           _ => { return token::GT; }
@@ -567,7 +567,7 @@ fn binop(rdr: string_reader, op: token::binop) -> token::token {
         if c2 == '\\' {
             let escaped = rdr.curr;
             bump(rdr);
-            alt escaped {
+            match escaped {
               'n' => { c2 = '\n'; }
               'r' => { c2 = '\r'; }
               't' => { c2 = '\t'; }
@@ -599,11 +599,11 @@ fn binop(rdr: string_reader, op: token::binop) -> token::token {
 
             let ch = rdr.curr;
             bump(rdr);
-            alt ch {
+            match ch {
               '\\' => {
                 let escaped = rdr.curr;
                 bump(rdr);
-                alt escaped {
+                match escaped {
                   'n' => str::push_char(accum_str, '\n'),
                   'r' => str::push_char(accum_str, '\r'),
                   't' => str::push_char(accum_str, '\t'),
@@ -646,7 +646,7 @@ fn binop(rdr: string_reader, op: token::binop) -> token::token {
         } else { return binop(rdr, token::AND); }
       }
       '|' => {
-        alt nextch(rdr) {
+        match nextch(rdr) {
           '|' => { bump(rdr); bump(rdr); return token::OROR; }
           _ => { return binop(rdr, token::OR); }
         }
index 4a34b66793704c8c9e47558ca60eb5d5a9554bf1..7684c66c3649c8bb8077a999b1c0ebeca3e135dc 100644 (file)
@@ -107,7 +107,7 @@ enum class_contents { ctor_decl(fn_decl, ~[attribute], blk, codemap::span),
 The important thing is to make sure that lookahead doesn't balk
 at INTERPOLATED tokens */
 macro_rules! maybe_whole_expr {
-    {$p:expr} => { alt copy $p.token {
+    {$p:expr} => { match copy $p.token {
       INTERPOLATED(token::nt_expr(e)) => {
         $p.bump();
         return pexpr(e);
@@ -122,19 +122,19 @@ macro_rules! maybe_whole_expr {
 }
 
 macro_rules! maybe_whole {
-    {$p:expr, $constructor:ident} => { alt copy $p.token {
+    {$p:expr, $constructor:ident} => { match copy $p.token {
       INTERPOLATED(token::$constructor(x)) => { $p.bump(); return x; }
       _ => ()
     }} ;
-    {deref $p:expr, $constructor:ident} => { alt copy $p.token {
+    {deref $p:expr, $constructor:ident} => { match copy $p.token {
       INTERPOLATED(token::$constructor(x)) => { $p.bump(); return *x; }
       _ => ()
     }} ;
-    {some $p:expr, $constructor:ident} => { alt copy $p.token {
+    {some $p:expr, $constructor:ident} => { match copy $p.token {
       INTERPOLATED(token::$constructor(x)) => { $p.bump(); return some(x); }
       _ => ()
     }} ;
-    {pair_empty $p:expr, $constructor:ident} => { alt copy $p.token {
+    {pair_empty $p:expr, $constructor:ident} => { match copy $p.token {
       INTERPOLATED(token::$constructor(x)) => { $p.bump(); return (~[], x); }
       _ => ()
     }}
@@ -284,7 +284,7 @@ fn parse_trait_methods() -> ~[trait_method] {
             debug!{"parse_trait_methods(): trait method signature ends in \
                     `%s`",
                    token_to_str(p.reader, p.token)};
-            alt p.token {
+            match p.token {
               token::SEMI => {
                 p.bump();
                 debug!{"parse_trait_methods(): parsing required method"};
@@ -356,7 +356,7 @@ fn parse_ret_ty() -> (ret_style, @ty) {
     }
 
     fn region_from_name(s: option<@~str>) -> @region {
-        let r = alt s {
+        let r = match s {
           some (string) => re_named(string),
           none => re_anon
         };
@@ -368,7 +368,7 @@ fn region_from_name(s: option<@~str>) -> @region {
     fn parse_region() -> @region {
         self.expect(token::BINOP(token::AND));
 
-        alt copy self.token {
+        match copy self.token {
           token::IDENT(sid, _) => {
             self.bump();
             let n = self.get_str(sid);
@@ -383,7 +383,7 @@ fn parse_region() -> @region {
     // Parses something like "&x/" (note the trailing slash)
     fn parse_region_with_sep() -> @region {
         let name =
-            alt copy self.token {
+            match copy self.token {
               token::IDENT(sid, _) => {
                 if self.look_ahead(1u) == token::BINOP(token::SLASH) {
                     self.bump(); self.bump();
@@ -402,7 +402,7 @@ fn parse_ty(colons_before_params: bool) -> @ty {
 
         let lo = self.span.lo;
 
-        alt self.maybe_parse_dollar_mac() {
+        match self.maybe_parse_dollar_mac() {
           some(e) => {
             return @{id: self.get_id(),
                   node: ty_mac(spanned(lo, self.span.hi, e)),
@@ -471,7 +471,7 @@ fn parse_ty(colons_before_params: bool) -> @ty {
 
         let sp = mk_sp(lo, self.last_span.hi);
         return @{id: self.get_id(),
-              node: alt self.maybe_parse_fixed_vstore() {
+              node: match self.maybe_parse_fixed_vstore() {
                 // Consider a fixed vstore suffix (/N or /_)
                 none => t,
                 some(v) => {
@@ -542,11 +542,11 @@ fn parse_fn_block_arg() -> arg_or_capture_item {
     }
 
     fn maybe_parse_dollar_mac() -> option<mac_> {
-        alt copy self.token {
+        match copy self.token {
           token::DOLLAR => {
             let lo = self.span.lo;
             self.bump();
-            alt copy self.token {
+            match copy self.token {
               token::LIT_INT_UNSUFFIXED(num) => {
                 self.bump();
                 some(mac_var(num as uint))
@@ -570,7 +570,7 @@ fn maybe_parse_dollar_mac() -> option<mac_> {
     fn maybe_parse_fixed_vstore() -> option<option<uint>> {
         if self.token == token::BINOP(token::SLASH) {
             self.bump();
-            alt copy self.token {
+            match copy self.token {
               token::UNDERSCORE => {
                 self.bump(); some(none)
               }
@@ -585,7 +585,7 @@ fn maybe_parse_fixed_vstore() -> option<option<uint>> {
     }
 
     fn lit_from_token(tok: token::token) -> lit_ {
-        alt tok {
+        match tok {
           token::LIT_INT(i, it) => lit_int(i, it),
           token::LIT_UINT(u, ut) => lit_uint(u, ut),
           token::LIT_INT_UNSUFFIXED(i) => lit_int_unsuffixed(i),
@@ -733,7 +733,7 @@ fn mk_pexpr(lo: uint, hi: uint, node: expr_) -> pexpr {
     }
 
     fn to_expr(e: pexpr) -> @expr {
-        alt e.node {
+        match e.node {
           expr_tup(es) if vec::len(es) == 1u => es[0u],
           _ => *e
         }
@@ -746,7 +746,7 @@ fn parse_bottom_expr() -> pexpr {
 
         let mut ex: expr_;
 
-        alt self.maybe_parse_dollar_mac() {
+        match self.maybe_parse_dollar_mac() {
           some(x) => return pexpr(self.mk_mac_expr(lo, self.span.hi, x)),
           _ => ()
         }
@@ -794,11 +794,11 @@ fn parse_bottom_expr() -> pexpr {
             return pexpr(self.parse_while_expr());
         } else if self.eat_keyword(~"loop") {
             return pexpr(self.parse_loop_expr());
-        } else if self.eat_keyword(~"alt") || self.eat_keyword(~"match") {
+        } else if self.eat_keyword(~"match") {
             return pexpr(self.parse_alt_expr());
         } else if self.eat_keyword(~"fn") {
             let proto = self.parse_fn_ty_proto();
-            alt proto {
+            match proto {
               proto_bare => self.fatal(~"fn expr are deprecated, use fn@"),
               _ => { /* fallthrough */ }
             }
@@ -893,7 +893,7 @@ fn parse_bottom_expr() -> pexpr {
             /* `!`, as an operator, is prefix, so we know this isn't that */
             if self.token == token::NOT {
                 self.bump();
-                let tts = alt self.token {
+                let tts = match self.token {
                   token::LPAREN | token::LBRACE | token::LBRACKET => {
                     let ket = token::flip_delimiter(self.token);
                     self.parse_unspanned_seq(copy self.token, ket,
@@ -948,9 +948,9 @@ fn parse_bottom_expr() -> pexpr {
 
         // Vstore is legal following expr_lit(lit_str(...)) and expr_vec(...)
         // only.
-        alt ex {
+        match ex {
           expr_lit(@{node: lit_str(_), span: _}) |
-          expr_vec(_, _)  => alt self.maybe_parse_fixed_vstore() {
+          expr_vec(_, _)  => match self.maybe_parse_fixed_vstore() {
             none => (),
             some(v) => {
                 hi = self.span.hi;
@@ -976,7 +976,7 @@ fn parse_syntax_ext() -> @expr {
     }
 
     fn parse_syntax_ext_naked(lo: uint) -> @expr {
-        alt self.token {
+        match self.token {
           token::IDENT(_, _) => (),
           _ => self.fatal(~"expected a syntax expander name")
         }
@@ -1003,7 +1003,7 @@ fn parse_syntax_ext_naked(lo: uint) -> @expr {
             let lo = self.span.lo;
             let mut depth = 1u;
             while (depth > 0u) {
-                alt (self.token) {
+                match (self.token) {
                   token::LBRACE => depth += 1u,
                   token::RBRACE => depth -= 1u,
                   token::EOF => self.fatal(~"unexpected EOF in macro body"),
@@ -1033,7 +1033,7 @@ fn parse_dot_or_call_expr_with(e0: pexpr) -> pexpr {
         loop {
             // expr.f
             if self.eat(token::DOT) {
-                alt copy self.token {
+                match copy self.token {
                   token::IDENT(i, _) => {
                     hi = self.span.hi;
                     self.bump();
@@ -1051,7 +1051,7 @@ fn parse_dot_or_call_expr_with(e0: pexpr) -> pexpr {
                 again;
             }
             if self.expr_is_complete(e) { break; }
-            alt copy self.token {
+            match copy self.token {
               // expr(...)
               token::LPAREN if self.permits_call() => {
                 let es = self.parse_unspanned_seq(
@@ -1103,7 +1103,7 @@ fn parse_token_tree() -> token_tree {
         maybe_whole!{deref self, nt_tt};
 
         fn parse_tt_tok(p: parser, delim_ok: bool) -> token_tree {
-            alt p.token {
+            match p.token {
               token::RPAREN | token::RBRACE | token::RBRACKET
               if !delim_ok => {
                 p.fatal(~"incorrect close delimiter: `"
@@ -1134,7 +1134,7 @@ fn parse_tt_tok(p: parser, delim_ok: bool) -> token_tree {
             return res;
         }
 
-        return alt self.token {
+        return match self.token {
           token::LPAREN | token::LBRACE | token::LBRACKET => {
             let ket = token::flip_delimiter(self.token);
             tt_delim(vec::append(
@@ -1154,7 +1154,7 @@ fn parse_matchers() -> ~[matcher] {
         // the interpolation of matchers
         maybe_whole!{self, nt_matchers};
         let name_idx = @mut 0u;
-        return alt self.token {
+        return match self.token {
           token::LBRACE | token::LPAREN | token::LBRACKET => {
             self.parse_matcher_subseq(name_idx, copy self.token,
                                       token::flip_delimiter(self.token))
@@ -1222,7 +1222,7 @@ fn parse_prefix_expr() -> pexpr {
         let mut hi;
 
         let mut ex;
-        alt copy self.token {
+        match copy self.token {
           token::NOT => {
             self.bump();
             let e = self.to_expr(self.parse_prefix_expr());
@@ -1231,7 +1231,7 @@ fn parse_prefix_expr() -> pexpr {
             ex = expr_unary(not, e);
           }
           token::BINOP(b) => {
-            alt b {
+            match b {
               token::MINUS => {
                 self.bump();
                 let e = self.to_expr(self.parse_prefix_expr());
@@ -1251,7 +1251,7 @@ fn parse_prefix_expr() -> pexpr {
                 let e = self.to_expr(self.parse_prefix_expr());
                 hi = e.span.hi;
                 // HACK: turn &[...] into a &-evec
-                ex = alt e.node {
+                ex = match e.node {
                   expr_vec(*) | expr_lit(@{node: lit_str(_), span: _})
                   if m == m_imm => {
                     expr_vstore(e, vstore_slice(self.region_from_name(none)))
@@ -1268,7 +1268,7 @@ fn parse_prefix_expr() -> pexpr {
             let e = self.to_expr(self.parse_prefix_expr());
             hi = e.span.hi;
             // HACK: turn @[...] into a @-evec
-            ex = alt e.node {
+            ex = match e.node {
               expr_vec(*) | expr_lit(@{node: lit_str(_), span: _})
               if m == m_imm => expr_vstore(e, vstore_box),
               _ => expr_unary(box(m), e)
@@ -1280,7 +1280,7 @@ fn parse_prefix_expr() -> pexpr {
             let e = self.to_expr(self.parse_prefix_expr());
             hi = e.span.hi;
             // HACK: turn ~[...] into a ~-evec
-            ex = alt e.node {
+            ex = match e.node {
               expr_vec(*) | expr_lit(@{node: lit_str(_), span: _})
               if m == m_imm => expr_vstore(e, vstore_uniq),
               _ => expr_unary(uniq(m), e)
@@ -1311,7 +1311,7 @@ fn parse_more_binops(plhs: pexpr, min_prec: uint) ->
             return lhs;
         }
         let cur_opt   = token_to_binop(peeked);
-        alt cur_opt {
+        match cur_opt {
           some(cur_op) => {
             let cur_prec = operator_prec(cur_op);
             if cur_prec > min_prec {
@@ -1338,7 +1338,7 @@ fn parse_more_binops(plhs: pexpr, min_prec: uint) ->
     fn parse_assign_expr() -> @expr {
         let lo = self.span.lo;
         let lhs = self.parse_binops();
-        alt copy self.token {
+        match copy self.token {
           token::EQ => {
             self.bump();
             let rhs = self.parse_expr();
@@ -1348,7 +1348,7 @@ fn parse_assign_expr() -> @expr {
             self.bump();
             let rhs = self.parse_expr();
             let mut aop;
-            alt op {
+            match op {
               token::PLUS => aop = add,
               token::MINUS => aop = subtract,
               token::STAR => aop = mul,
@@ -1412,7 +1412,7 @@ fn parse_fn_expr(proto: proto) -> @expr {
     fn parse_lambda_block_expr() -> @expr {
         self.parse_lambda_expr_(
             || {
-                alt self.token {
+                match self.token {
                   token::BINOP(token::OR) | token::OROR => {
                     self.parse_fn_block_decl()
                   }
@@ -1481,7 +1481,7 @@ fn parse_sugary_call_expr(keyword: ~str,
         // Turn on the restriction to stop at | or || so we can parse
         // them as the lambda arguments
         let e = self.parse_expr_res(RESTRICT_NO_BAR_OR_DOUBLEBAR_OP);
-        alt e.node {
+        match e.node {
           expr_call(f, args, false) => {
             let block = self.parse_lambda_block_expr();
             let last_arg = self.mk_expr(block.span.lo, block.span.hi,
@@ -1608,7 +1608,7 @@ fn parse_expr_res(r: restriction) -> @expr {
     }
 
     fn parse_initializer() -> option<initializer> {
-        alt self.token {
+        match self.token {
           token::EQ => {
             self.bump();
             return some({op: init_assign, expr: self.parse_expr()});
@@ -1645,14 +1645,14 @@ fn parse_pat(refutable: bool) -> @pat {
         let lo = self.span.lo;
         let mut hi = self.span.hi;
         let mut pat;
-        alt self.token {
+        match self.token {
           token::UNDERSCORE => { self.bump(); pat = pat_wild; }
           token::AT => {
             self.bump();
             let sub = self.parse_pat(refutable);
             hi = sub.span.hi;
             // HACK: parse @"..." as a literal of a vstore @str
-            pat = alt sub.node {
+            pat = match sub.node {
               pat_lit(e@@{
                 node: expr_lit(@{node: lit_str(_), span: _}), _
               }) => {
@@ -1669,7 +1669,7 @@ fn parse_pat(refutable: bool) -> @pat {
             let sub = self.parse_pat(refutable);
             hi = sub.span.hi;
             // HACK: parse ~"..." as a literal of a vstore ~str
-            pat = alt sub.node {
+            pat = match sub.node {
               pat_lit(e@@{
                 node: expr_lit(@{node: lit_str(_), span: _}), _
               }) => {
@@ -1775,7 +1775,7 @@ fn parse_pat(refutable: bool) -> @pat {
                 }
 
                 if is_plain_ident(self.token) &&
-                    alt self.look_ahead(1) {
+                    match self.look_ahead(1) {
                       token::LPAREN | token::LBRACKET | token::LT => {
                         false
                       }
@@ -1794,8 +1794,8 @@ fn parse_pat(refutable: bool) -> @pat {
                     hi = enum_path.span.hi;
                     let mut args: ~[@pat] = ~[];
                     let mut star_pat = false;
-                    alt self.token {
-                      token::LPAREN => alt self.look_ahead(1u) {
+                    match self.token {
+                      token::LPAREN => match self.look_ahead(1u) {
                         token::BINOP(token::STAR) => {
                             // This is a "top constructor only" pat
                               self.bump(); self.bump();
@@ -1890,7 +1890,7 @@ fn check_expected_item(p: parser, current_attrs: ~[attribute]) {
             return @spanned(lo, decl.span.hi, stmt_decl(decl, self.get_id()));
         } else {
             let mut item_attrs;
-            alt self.parse_outer_attrs_or_ext(first_item_attrs) {
+            match self.parse_outer_attrs_or_ext(first_item_attrs) {
               none => item_attrs = ~[],
               some(left(attrs)) => item_attrs = attrs,
               some(right(ext)) => {
@@ -1901,7 +1901,7 @@ fn check_expected_item(p: parser, current_attrs: ~[attribute]) {
 
             let item_attrs = vec::append(first_item_attrs, item_attrs);
 
-            alt self.parse_item(item_attrs) {
+            match self.parse_item(item_attrs) {
               some(i) => {
                 let mut hi = i.span.hi;
                 let decl = @spanned(lo, hi, decl_item(i));
@@ -1993,16 +1993,16 @@ fn parse_block_tail_(lo: uint, s: blk_check_mode,
         }
 
         while self.token != token::RBRACE {
-            alt self.token {
+            match self.token {
               token::SEMI => {
                 self.bump(); // empty
               }
               _ => {
                 let stmt = self.parse_stmt(initial_attrs);
                 initial_attrs = ~[];
-                alt stmt.node {
+                match stmt.node {
                   stmt_expr(e, stmt_id) => { // Expression without semicolon:
-                    alt self.token {
+                    match self.token {
                       token::SEMI => {
                         self.bump();
                         push(stmts,
@@ -2086,7 +2086,7 @@ fn parse_fn_decl(purity: purity,
     }
 
     fn is_self_ident() -> bool {
-        alt self.token {
+        match self.token {
             token::IDENT(sid, false) if ~"self" == *self.get_str(sid) => true,
             _ => false
         }
@@ -2111,7 +2111,7 @@ fn parse_fn_decl_with_self(purity: purity,
         // backwards compatible.
         let lo = self.span.lo;
         let self_ty;
-        alt copy self.token {
+        match copy self.token {
             token::BINOP(token::AND) => {
                 // We need to make sure it isn't a mode.
                 self.bump();
@@ -2126,10 +2126,10 @@ fn parse_fn_decl_with_self(purity: purity,
 
                     // Parse an explicit region, if possible.
                     let region_name;
-                    alt copy self.token {
+                    match copy self.token {
                         token::BINOP(token::SLASH) => {
                             self.bump();
-                            alt copy self.token {
+                            match copy self.token {
                                 token::IDENT(sid, false) => {
                                     self.bump();
                                     region_name = some(self.get_str(sid));
@@ -2174,7 +2174,7 @@ fn parse_fn_decl_with_self(purity: purity,
         // If we parsed a self type, expect a comma before the argument list.
         let args_or_capture_items;
         if self_ty != sty_by_ref {
-            alt copy self.token {
+            match copy self.token {
                 token::COMMA => {
                     self.bump();
                     let sep = seq_sep_trailing_disallowed(token::COMMA);
@@ -2265,7 +2265,7 @@ fn parse_item_fn(purity: purity) -> item_info {
     }
 
     fn parse_method_name() -> ident {
-        alt copy self.token {
+        match copy self.token {
           token::BINOP(op) => { self.bump(); @token::binop_to_str(op) }
           token::NOT => { self.bump(); @~"!" }
           token::LBRACKET => {
@@ -2387,7 +2387,7 @@ fn wrap_path(p: parser, pt: @path) -> @ty {
             } else {
                 traits = ~[];
             };
-            ident = alt ident_old {
+            ident = match ident_old {
               some(name) => name,
               none => { self.expect_keyword(~"of"); fail; }
             };
@@ -2445,7 +2445,7 @@ fn parse_item_class() -> item_info {
                                    codemap::span)> = none;
         let mut the_dtor : option<(blk, ~[attribute], codemap::span)> = none;
         while self.token != token::RBRACE {
-            alt self.parse_class_item(class_path) {
+            match self.parse_class_item(class_path) {
               ctor_decl(a_fn_decl, attrs, blk, s) => {
                 the_ctor = some((a_fn_decl, attrs, blk, s));
               }
@@ -2463,7 +2463,7 @@ fn parse_item_class() -> item_info {
                     body: d_body},
              span: d_s}};
         self.bump();
-        alt the_ctor {
+        match the_ctor {
           some((ct_d, ct_attrs, ct_b, ct_s)) => {
             (class_name,
              item_class(ty_params, traits, ms, some({
@@ -2487,7 +2487,7 @@ fn parse_item_class() -> item_info {
     }
 
     fn token_is_pound_or_doc_comment(++tok: token::token) -> bool {
-        alt tok {
+        match tok {
             token::POUND | token::DOC_COMMENT(_) => true,
             _ => false
         }
@@ -2582,7 +2582,7 @@ fn parse_mod_items(term: token::token,
                 first = false;
             }
             debug!{"parse_mod_items: parse_item(attrs=%?)", attrs};
-            alt self.parse_item(attrs) {
+            match self.parse_item(attrs) {
               some(i) => vec::push(items, i),
               _ => {
                 self.fatal(~"expected item but found `" +
@@ -2764,7 +2764,7 @@ fn parse_item_enum() -> item_info {
     }
 
     fn parse_fn_ty_proto() -> proto {
-        alt self.token {
+        match self.token {
           token::AT => {
             self.bump();
             proto_box
@@ -2784,7 +2784,7 @@ fn parse_fn_ty_proto() -> proto {
     }
 
     fn fn_expr_lookahead(tok: token::token) -> bool {
-        alt tok {
+        match tok {
           token::LPAREN | token::AT | token::TILDE | token::BINOP(_) => true,
           _ => false
         }
@@ -2846,7 +2846,7 @@ fn parse_item(+attrs: ~[attribute]) -> option<@item> {
             let pth = self.parse_path_without_tps();
             self.expect(token::NOT);
             let id = self.parse_ident();
-            let tts = alt self.token {
+            let tts = match self.token {
               token::LPAREN | token::LBRACE | token::LBRACKET => {
                 let ket = token::flip_delimiter(self.token);
                 self.parse_unspanned_seq(copy self.token, ket,
@@ -2863,7 +2863,7 @@ fn parse_item(+attrs: ~[attribute]) -> option<@item> {
             (id, item_mac(m), none)
         } else { return none; };
         some(self.mk_item(lo, self.last_span.hi, ident, item_, visibility,
-                          alt extra_attrs {
+                          match extra_attrs {
                               some(as) => vec::append(attrs, as),
                               none => attrs
                           }))
@@ -2880,7 +2880,7 @@ fn parse_view_path() -> @view_path {
         let first_ident = self.parse_ident();
         let mut path = ~[first_ident];
         debug!{"parsed view_path: %s", *first_ident};
-        alt self.token {
+        match self.token {
           token::EQ => {
             // x = foo::bar
             self.bump();
@@ -2901,7 +2901,7 @@ fn parse_view_path() -> @view_path {
             while self.token == token::MOD_SEP {
                 self.bump();
 
-                alt copy self.token {
+                match copy self.token {
 
                   token::IDENT(i, _) => {
                     self.bump();
@@ -3004,7 +3004,7 @@ fn parse_crate_mod(_cfg: crate_cfg) -> @crate {
     }
 
     fn parse_str() -> @~str {
-        alt copy self.token {
+        match copy self.token {
           token::LIT_STR(s) => { self.bump(); self.get_str(s) }
           _ => self.fatal(~"expected string literal")
         }
@@ -3035,7 +3035,7 @@ fn parse_crate_directive(first_outer_attr: ~[attribute]) ->
                 self.expect_keyword(~"module");
             }
             let id = self.parse_ident();
-            alt self.token {
+            match self.token {
               // mod x = "foo.rs";
               token::SEMI => {
                 let mut hi = self.span.hi;
index 45bbe3b8e3b7c7234c3922aa6158a0944eff69e8..bd9ada9a3384370675e73cf6032171509d2d8cab 100644 (file)
@@ -20,7 +20,7 @@
  * operator and its precedence
  */
 fn token_to_binop(tok: token) -> option<ast::binop> {
-  alt tok {
+  match tok {
       BINOP(STAR)    => some(mul),
       BINOP(SLASH)   => some(div),
       BINOP(PERCENT) => some(rem),
index 9e9a3bbca56c63271bde3567fe18fc60284329f3..a99d071b6ef74055361847bc63c8182bb094d693 100644 (file)
@@ -102,7 +102,7 @@ enum nonterminal {
 }
 
 fn binop_to_str(o: binop) -> ~str {
-    alt o {
+    match o {
       PLUS => ~"+",
       MINUS => ~"-",
       STAR => ~"*",
@@ -117,7 +117,7 @@ fn binop_to_str(o: binop) -> ~str {
 }
 
 fn to_str(in: interner<@~str>, t: token) -> ~str {
-    alt t {
+    match t {
       EQ => ~"=",
       LT => ~"<",
       LE => ~"<=",
@@ -186,7 +186,7 @@ fn to_str(in: interner<@~str>, t: token) -> ~str {
       EOF => ~"<eof>",
       INTERPOLATED(nt) => {
         ~"an interpolated " +
-            alt nt {
+            match nt {
               nt_item(*) => ~"item",
               nt_block(*) => ~"block",
               nt_stmt(*) => ~"statement",
@@ -203,7 +203,7 @@ fn to_str(in: interner<@~str>, t: token) -> ~str {
 }
 
 pure fn can_begin_expr(t: token) -> bool {
-    alt t {
+    match t {
       LPAREN => true,
       LBRACE => true,
       LBRACKET => true,
@@ -234,7 +234,7 @@ fn to_str(in: interner<@~str>, t: token) -> ~str {
 
 /// what's the opposite delimiter?
 fn flip_delimiter(&t: token::token) -> token::token {
-    alt t {
+    match t {
       token::LPAREN => token::RPAREN,
       token::LBRACE => token::RBRACE,
       token::LBRACKET => token::RBRACKET,
@@ -248,7 +248,7 @@ fn flip_delimiter(&t: token::token) -> token::token {
 
 
 fn is_lit(t: token) -> bool {
-    alt t {
+    match t {
       LIT_INT(_, _) => true,
       LIT_UINT(_, _) => true,
       LIT_INT_UNSUFFIXED(_) => true,
@@ -259,22 +259,22 @@ fn is_lit(t: token) -> bool {
 }
 
 pure fn is_ident(t: token) -> bool {
-    alt t { IDENT(_, _) => true, _ => false }
+    match t { IDENT(_, _) => true, _ => false }
 }
 
 pure fn is_ident_or_path(t: token) -> bool {
-    alt t {
+    match t {
       IDENT(_, _) | INTERPOLATED(nt_path(*)) => true,
       _ => false
     }
 }
 
 pure fn is_plain_ident(t: token) -> bool {
-    alt t { IDENT(_, false) => true, _ => false }
+    match t { IDENT(_, false) => true, _ => false }
 }
 
 pure fn is_bar(t: token) -> bool {
-    alt t { BINOP(OR) | OROR => true, _ => false }
+    match t { BINOP(OR) | OROR => true, _ => false }
 }
 
 /**
@@ -333,7 +333,7 @@ fn contextual_keyword_table() -> hashmap<~str, ()> {
 fn restricted_keyword_table() -> hashmap<~str, ()> {
     let words = str_hash();
     let keys = ~[
-        ~"alt", ~"again", ~"assert",
+        ~"again", ~"assert",
         ~"break",
         ~"check", ~"class", ~"const", ~"copy",
         ~"do", ~"drop",
index 12ef7149f6be98b9971276e14fd3fa7bf0a70676..a8f9cf756a816237a87090f129e6355a8771d907 100644 (file)
@@ -62,7 +62,7 @@ enum breaks { consistent, inconsistent, }
 enum token { STRING(@~str, int), BREAK(break_t), BEGIN(begin_t), END, EOF, }
 
 fn tok_str(++t: token) -> ~str {
-    alt t {
+    match t {
       STRING(s, len) => return fmt!{"STR(%s,%d)", *s, len},
       BREAK(_) => return ~"BREAK",
       BEGIN(_) => return ~"BEGIN",
@@ -238,7 +238,7 @@ fn last_token() -> token { self.token[self.right] }
     fn replace_last_token(t: token) { self.token[self.right] = t; }
     fn pretty_print(t: token) {
         debug!{"pp ~[%u,%u]", self.left, self.right};
-        alt t {
+        match t {
           EOF => {
             if !self.scan_stack_empty {
                 self.check_stack(0);
@@ -357,7 +357,7 @@ fn advance_left(++x: token, L: int) {
                self.left, L};
         if L >= 0 {
             self.print(x, L);
-            alt x {
+            match x {
               BREAK(b) => self.left_total += b.blank_space,
               STRING(_, len) => { assert (len == L); self.left_total += len; }
               _ => ()
@@ -373,7 +373,7 @@ fn advance_left(++x: token, L: int) {
     fn check_stack(k: int) {
         if !self.scan_stack_empty {
             let x = self.scan_top();
-            alt copy self.token[x] {
+            match copy self.token[x] {
               BEGIN(b) => {
                 if k > 0 {
                     self.size[self.scan_pop()] = self.size[x] +
@@ -422,7 +422,7 @@ fn print(x: token, L: int) {
         debug!{"print %s %d (remaining line space=%d)", tok_str(x), L,
                self.space};
         log(debug, buf_str(self.token, self.size, self.left, self.right, 6u));
-        alt x {
+        match x {
           BEGIN(b) => {
             if L > self.space {
                 let col = self.margin - self.space + b.offset;
@@ -442,7 +442,7 @@ fn print(x: token, L: int) {
           }
           BREAK(b) => {
             let top = self.get_top();
-            alt top.pbreak {
+            match top.pbreak {
               fits => {
                 debug!{"print BREAK in fitting block"};
                 self.space -= b.blank_space;
index eca571b9ccd3f218b580f5f8c01792ff44271c60..e968fb92ad6498e636323a1a56e87edcc6fc0f48 100644 (file)
@@ -222,11 +222,11 @@ fn bclose_(s: ps, span: codemap::span, indented: uint) {
 fn bclose(s: ps, span: codemap::span) { bclose_(s, span, indent_unit); }
 
 fn is_begin(s: ps) -> bool {
-    alt s.s.last_token() { pp::BEGIN(_) => true, _ => false }
+    match s.s.last_token() { pp::BEGIN(_) => true, _ => false }
 }
 
 fn is_end(s: ps) -> bool {
-    alt s.s.last_token() { pp::END => true, _ => false }
+    match s.s.last_token() { pp::END => true, _ => false }
 }
 
 fn is_bol(s: ps) -> bool {
@@ -318,7 +318,7 @@ fn print_foreign_mod(s: ps, nmod: ast::foreign_mod,
 }
 
 fn print_region(s: ps, region: @ast::region) {
-    alt region.node {
+    match region.node {
       ast::re_anon => word_space(s, ~"&"),
       ast::re_named(name) => {
         word(s.s, ~"&");
@@ -334,14 +334,14 @@ fn print_type(s: ps, &&ty: @ast::ty) {
 fn print_type_ex(s: ps, &&ty: @ast::ty, print_colons: bool) {
     maybe_print_comment(s, ty.span.lo);
     ibox(s, 0u);
-    alt ty.node {
+    match ty.node {
       ast::ty_nil => word(s.s, ~"()"),
       ast::ty_bot => word(s.s, ~"!"),
       ast::ty_box(mt) => { word(s.s, ~"@"); print_mt(s, mt); }
       ast::ty_uniq(mt) => { word(s.s, ~"~"); print_mt(s, mt); }
       ast::ty_vec(mt) => {
         word(s.s, ~"[");
-        alt mt.mutbl {
+        match mt.mutbl {
           ast::m_mutbl => word_space(s, ~"mut"),
           ast::m_const => word_space(s, ~"const"),
           ast::m_imm => ()
@@ -351,7 +351,7 @@ fn print_type_ex(s: ps, &&ty: @ast::ty, print_colons: bool) {
       }
       ast::ty_ptr(mt) => { word(s.s, ~"*"); print_mt(s, mt); }
       ast::ty_rptr(region, mt) => {
-        alt region.node {
+        match region.node {
           ast::re_anon => word(s.s, ~"&"),
           _ => { print_region(s, region); word(s.s, ~"/"); }
         }
@@ -400,7 +400,7 @@ fn print_foreign_item(s: ps, item: @ast::foreign_item) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, item.span.lo);
     print_outer_attributes(s, item.attrs);
-    alt item.node {
+    match item.node {
       ast::foreign_item_fn(decl, typarams) => {
         print_fn(s, decl, item.ident, typarams);
         end(s); // end head-ibox
@@ -416,7 +416,7 @@ fn print_item(s: ps, &&item: @ast::item) {
     print_outer_attributes(s, item.attrs);
     let ann_node = node_item(s, item);
     s.ann.pre(ann_node);
-    alt item.node {
+    match item.node {
       ast::item_const(ty, expr) => {
         head(s, ~"const");
         word_space(s, *item.ident + ~":");
@@ -538,7 +538,7 @@ fn print_item(s: ps, &&item: @ast::item) {
              hardbreak_if_not_bol(s);
              maybe_print_comment(s, ci.span.lo);
              let pr = ast_util::class_member_visibility(ci);
-             alt pr {
+             match pr {
                 ast::private => {
                     head(s, ~"priv");
                     bopen(s);
@@ -546,10 +546,10 @@ fn print_item(s: ps, &&item: @ast::item) {
                 }
                 _ => ()
              }
-             alt ci.node {
+             match ci.node {
                 ast::instance_var(nm, t, mt, _,_) => {
                     word_nbsp(s, ~"let");
-                    alt mt {
+                    match mt {
                       ast::class_mutable => word_nbsp(s, ~"mut"),
                       _ => ()
                     }
@@ -562,7 +562,7 @@ fn print_item(s: ps, &&item: @ast::item) {
                     print_method(s, m);
                 }
              }
-             alt pr {
+             match pr {
                  ast::private => bclose(s, ci.span),
                  _ => ()
              }
@@ -625,10 +625,10 @@ fn print_item(s: ps, &&item: @ast::item) {
 /// and then pretty-print the resulting AST nodes (so, e.g., we print
 /// expression arguments as expressions). It can be done! I think.
 fn print_tt(s: ps, tt: ast::token_tree) {
-    alt tt {
+    match tt {
       ast::tt_delim(tts) => for tts.each() |tt_elt| { print_tt(s, tt_elt); }
       ast::tt_tok(_, tk) => {
-        alt tk {
+        match tk {
           parse::token::IDENT(*) => { // don't let idents run together
             if s.s.token_tree_last_was_ident { word(s.s, ~" ") }
             s.s.token_tree_last_was_ident = true;
@@ -641,7 +641,7 @@ fn print_tt(s: ps, tt: ast::token_tree) {
         word(s.s, ~"$(");
         for tts.each() |tt_elt| { print_tt(s, tt_elt); }
         word(s.s, ~")");
-        alt sep {
+        match sep {
           some(tk) => word(s.s, parse::token::to_str(*s.intr, tk)),
           none => ()
         }
@@ -665,7 +665,7 @@ fn print_variant_arg(s: ps, arg: ast::variant_arg) {
         commasep(s, consistent, v.node.args, print_variant_arg);
         pclose(s);
     }
-    alt v.node.disr_expr {
+    match v.node.disr_expr {
       some(d) => {
         space(s.s);
         word_space(s, ~"=");
@@ -684,7 +684,7 @@ fn print_ty_method(s: ps, m: ast::ty_method) {
 }
 
 fn print_trait_method(s: ps, m: ast::trait_method) {
-    alt m {
+    match m {
       required(ty_m) => print_ty_method(s, ty_m),
       provided(m)    => print_method(s, m)
     }
@@ -702,7 +702,7 @@ fn print_method(s: ps, meth: @ast::method) {
 fn print_outer_attributes(s: ps, attrs: ~[ast::attribute]) {
     let mut count = 0;
     for attrs.each |attr| {
-        alt attr.node.style {
+        match attr.node.style {
           ast::attr_outer => { print_attribute(s, attr); count += 1; }
           _ => {/* fallthrough */ }
         }
@@ -713,7 +713,7 @@ fn print_outer_attributes(s: ps, attrs: ~[ast::attribute]) {
 fn print_inner_attributes(s: ps, attrs: ~[ast::attribute]) {
     let mut count = 0;
     for attrs.each |attr| {
-        alt attr.node.style {
+        match attr.node.style {
           ast::attr_inner => {
             print_attribute(s, attr);
             if !attr.node.is_sugared_doc {
@@ -744,7 +744,7 @@ fn print_attribute(s: ps, attr: ast::attribute) {
 
 fn print_stmt(s: ps, st: ast::stmt) {
     maybe_print_comment(s, st.span.lo);
-    alt st.node {
+    match st.node {
       ast::stmt_decl(decl, _) => {
         print_decl(s, decl);
       }
@@ -780,7 +780,7 @@ fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type,
 
 fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
                                   indented: uint, attrs: ~[ast::attribute]) {
-    alt blk.node.rules {
+    match blk.node.rules {
       ast::unchecked_blk => word(s.s, ~"unchecked"),
       ast::unsafe_blk => word(s.s, ~"unsafe"),
       ast::default_blk => ()
@@ -788,7 +788,7 @@ fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
     maybe_print_comment(s, blk.span.lo);
     let ann_node = node_block(s, blk);
     s.ann.pre(ann_node);
-    alt embedded {
+    match embedded {
       block_block_fn => end(s),
       block_normal => bopen(s)
     }
@@ -799,7 +799,7 @@ fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
     for blk.node.stmts.each |st| {
         print_stmt(s, *st);
     }
-    alt blk.node.expr {
+    match blk.node.expr {
       some(expr) => {
         space_if_not_bol(s);
         print_expr(s, expr);
@@ -814,7 +814,7 @@ fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
 // return and fail, without arguments cannot appear is the discriminant of if,
 // alt, do, & while unambiguously without being parenthesized
 fn print_maybe_parens_discrim(s: ps, e: @ast::expr) {
-    let disambig = alt e.node {
+    let disambig = match e.node {
       ast::expr_ret(none) | ast::expr_fail(none) => true,
       _ => false
     };
@@ -831,9 +831,9 @@ fn print_if(s: ps, test: @ast::expr, blk: ast::blk,
     space(s.s);
     print_block(s, blk);
     fn do_else(s: ps, els: option<@ast::expr>) {
-        alt els {
+        match els {
           some(_else) => {
-            alt _else.node {
+            match _else.node {
               // "another else-if"
               ast::expr_if(i, t, e) => {
                 cbox(s, indent_unit - 1u);
@@ -864,11 +864,11 @@ fn do_else(s: ps, els: option<@ast::expr>) {
 }
 
 fn print_mac(s: ps, m: ast::mac) {
-    alt m.node {
+    match m.node {
       ast::mac_invoc(path, arg, body) => {
         word(s.s, ~"#");
         print_path(s, path, false);
-        alt arg {
+        match arg {
           some(@{node: ast::expr_vec(_, _), _}) => (),
           _ => word(s.s, ~" ")
         }
@@ -888,12 +888,12 @@ fn print_mac(s: ps, m: ast::mac) {
 }
 
 fn print_vstore(s: ps, t: ast::vstore) {
-    alt t {
+    match t {
       ast::vstore_fixed(some(i)) => word(s.s, fmt!{"%u", i}),
       ast::vstore_fixed(none) => word(s.s, ~"_"),
       ast::vstore_uniq => word(s.s, ~"~"),
       ast::vstore_box => word(s.s, ~"@"),
-      ast::vstore_slice(r) => alt r.node {
+      ast::vstore_slice(r) => match r.node {
         ast::re_anon => word(s.s, ~"&"),
         ast::re_named(name) => {
             word(s.s, ~"&");
@@ -919,8 +919,8 @@ fn print_field(s: ps, field: ast::field) {
     ibox(s, indent_unit);
     let ann_node = node_expr(s, expr);
     s.ann.pre(ann_node);
-    alt expr.node {
-      ast::expr_vstore(e, v) => alt v {
+    match expr.node {
+      ast::expr_vstore(e, v) => match v {
         ast::vstore_fixed(_) => {
             print_expr(s, e);
               word(s.s, ~"/");
@@ -961,7 +961,7 @@ fn print_field(s: ps, field: ast::field) {
       ast::expr_rec(fields, wth) => {
         word(s.s, ~"{");
         commasep_cmnt(s, consistent, fields, print_field, get_span);
-        alt wth {
+        match wth {
           some(expr) => {
             if vec::len(fields) > 0u { space(s.s); }
             ibox(s, indent_unit);
@@ -977,7 +977,7 @@ fn print_field(s: ps, field: ast::field) {
         print_path(s, path, true);
         word(s.s, ~"{");
         commasep_cmnt(s, consistent, fields, print_field, get_span);
-        alt wth {
+        match wth {
             some(expr) => {
                 if vec::len(fields) > 0u { space(s.s); }
                 ibox(s, indent_unit);
@@ -998,7 +998,7 @@ fn print_field(s: ps, field: ast::field) {
         let mut base_args = args;
         let blk = if has_block {
             let blk_arg = vec::pop(base_args);
-            alt blk_arg.node {
+            match blk_arg.node {
               ast::expr_loop_body(_) => word_nbsp(s, ~"for"),
               ast::expr_do_body(_) => word_nbsp(s, ~"do"),
               _ => ()
@@ -1056,7 +1056,7 @@ fn print_field(s: ps, field: ast::field) {
       ast::expr_alt(expr, arms, mode) => {
         cbox(s, alt_indent_unit);
         ibox(s, 4u);
-        word_nbsp(s, ~"alt");
+        word_nbsp(s, ~"match");
         if mode == ast::alt_check { word_nbsp(s, ~"check"); }
         print_maybe_parens_discrim(s, expr);
         space(s.s);
@@ -1074,7 +1074,7 @@ fn print_field(s: ps, field: ast::field) {
                 print_pat(s, p);
             }
             space(s.s);
-            alt arm.guard {
+            match arm.guard {
               some(e) => {
                 word_space(s, ~"if");
                 print_expr(s, e);
@@ -1087,7 +1087,7 @@ fn print_field(s: ps, field: ast::field) {
             assert arm.body.node.view_items.is_empty();
             assert arm.body.node.stmts.is_empty();
             assert arm.body.node.rules == ast::default_blk;
-            alt arm.body.node.expr {
+            match arm.body.node.expr {
               some(expr) => {
                 end(s); // close the ibox for the pattern
                 print_expr(s, expr);
@@ -1185,7 +1185,7 @@ fn print_field(s: ps, field: ast::field) {
       ast::expr_path(path) => print_path(s, path, true),
       ast::expr_fail(maybe_fail_val) => {
         word(s.s, ~"fail");
-        alt maybe_fail_val {
+        match maybe_fail_val {
           some(expr) => { word(s.s, ~" "); print_expr(s, expr); }
           _ => ()
         }
@@ -1194,13 +1194,13 @@ fn print_field(s: ps, field: ast::field) {
       ast::expr_again => word(s.s, ~"again"),
       ast::expr_ret(result) => {
         word(s.s, ~"return");
-        alt result {
+        match result {
           some(expr) => { word(s.s, ~" "); print_expr(s, expr); }
           _ => ()
         }
       }
       ast::expr_log(lvl, lexp, expr) => {
-        alt check lvl {
+        match check lvl {
           1 => { word_nbsp(s, ~"log"); print_expr(s, expr); }
           0 => { word_nbsp(s, ~"log_err"); print_expr(s, expr); }
           2 => {
@@ -1225,7 +1225,7 @@ fn print_field(s: ps, field: ast::field) {
 }
 
 fn print_expr_parens_if_not_bot(s: ps, ex: @ast::expr) {
-    let parens = alt ex.node {
+    let parens = match ex.node {
       ast::expr_fail(_) | ast::expr_ret(_) |
       ast::expr_binary(_, _, _) | ast::expr_unary(_, _) |
       ast::expr_move(_, _) | ast::expr_copy(_) |
@@ -1243,7 +1243,7 @@ fn print_expr_parens_if_not_bot(s: ps, ex: @ast::expr) {
 
 fn print_local_decl(s: ps, loc: @ast::local) {
     print_pat(s, loc.node.pat);
-    alt loc.node.ty.node {
+    match loc.node.ty.node {
       ast::ty_infer => (),
       _ => { word_space(s, ~":"); print_type(s, loc.node.ty); }
     }
@@ -1251,7 +1251,7 @@ fn print_local_decl(s: ps, loc: @ast::local) {
 
 fn print_decl(s: ps, decl: @ast::decl) {
     maybe_print_comment(s, decl.span.lo);
-    alt decl.node {
+    match decl.node {
       ast::decl_local(locs) => {
         space_if_not_bol(s);
         ibox(s, indent_unit);
@@ -1267,10 +1267,10 @@ fn print_local(s: ps, &&loc: @ast::local) {
             ibox(s, indent_unit);
             print_local_decl(s, loc);
             end(s);
-            alt loc.node.init {
+            match loc.node.init {
               some(init) => {
                 nbsp(s);
-                alt init.op {
+                match init.op {
                   ast::init_assign => word_space(s, ~"="),
                   ast::init_move => word_space(s, ~"<-")
                 }
@@ -1306,7 +1306,7 @@ fn print_path(s: ps, &&path: @ast::path, colons_before_params: bool) {
     if path.rp.is_some() || !path.types.is_empty() {
         if colons_before_params { word(s.s, ~"::"); }
 
-        alt path.rp {
+        match path.rp {
           none => { /* ok */ }
           some(r) => {
             word(s.s, ~"/");
@@ -1328,22 +1328,22 @@ fn print_pat(s: ps, &&pat: @ast::pat) {
     s.ann.pre(ann_node);
     /* Pat isn't normalized, but the beauty of it
      is that it doesn't matter */
-    alt pat.node {
+    match pat.node {
       ast::pat_wild => word(s.s, ~"_"),
       ast::pat_ident(binding_mode, path, sub) => {
-        alt binding_mode {
+        match binding_mode {
           ast::bind_by_ref => word_space(s, ~"ref"),
           ast::bind_by_value => ()
         }
         print_path(s, path, true);
-        alt sub {
+        match sub {
           some(p) => { word(s.s, ~"@"); print_pat(s, p); }
           none => ()
         }
       }
       ast::pat_enum(path, args_) => {
         print_path(s, path, true);
-        alt args_ {
+        match args_ {
           none => word(s.s, ~"(*)"),
           some(args) => {
             if vec::len(args) > 0u {
@@ -1391,7 +1391,7 @@ fn print_field(s: ps, f: ast::field_pat) {
 
 fn print_fn(s: ps, decl: ast::fn_decl, name: ast::ident,
             typarams: ~[ast::ty_param]) {
-    alt decl.purity {
+    match decl.purity {
       ast::impure_fn => head(s, ~"fn"),
       _ => head(s, purity_to_str(decl.purity) + ~" fn")
     }
@@ -1442,7 +1442,7 @@ fn print_fn_block_args(s: ps, decl: ast::fn_decl,
 }
 
 fn mode_to_str(m: ast::mode) -> ~str {
-    alt m {
+    match m {
       ast::expl(ast::by_mutbl_ref) => ~"&",
       ast::expl(ast::by_move) => ~"-",
       ast::expl(ast::by_ref) => ~"&&",
@@ -1462,7 +1462,7 @@ fn print_bounds(s: ps, bounds: @~[ast::ty_param_bound]) {
         word(s.s, ~":");
         for vec::each(*bounds) |bound| {
             nbsp(s);
-            alt bound {
+            match bound {
               ast::bound_copy => word(s.s, ~"copy"),
               ast::bound_send => word(s.s, ~"send"),
               ast::bound_const => word(s.s, ~"const"),
@@ -1487,7 +1487,7 @@ fn printParam(s: ps, param: ast::ty_param) {
 
 fn print_meta_item(s: ps, &&item: @ast::meta_item) {
     ibox(s, indent_unit);
-    alt item.node {
+    match item.node {
       ast::meta_word(name) => word(s.s, *name),
       ast::meta_name_value(name, value) => {
         word_space(s, *name);
@@ -1505,7 +1505,7 @@ fn print_meta_item(s: ps, &&item: @ast::meta_item) {
 }
 
 fn print_view_path(s: ps, &&vp: @ast::view_path) {
-    alt vp.node {
+    match vp.node {
       ast::view_path_simple(ident, path, _) => {
         if path.idents[vec::len(path.idents)-1u] != ident {
             word_space(s, *ident);
@@ -1538,7 +1538,7 @@ fn print_view_item(s: ps, item: @ast::view_item) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, item.span.lo);
     print_outer_attributes(s, item.attrs);
-    alt item.node {
+    match item.node {
       ast::view_item_use(id, mta, _) => {
         head(s, ~"use");
         word(s.s, *id);
@@ -1572,7 +1572,7 @@ fn print_op_maybe_parens(s: ps, expr: @ast::expr, outer_prec: uint) {
 }
 
 fn print_mutability(s: ps, mutbl: ast::mutability) {
-    alt mutbl {
+    match mutbl {
       ast::m_mutbl => word_nbsp(s, ~"mut"),
       ast::m_const => word_nbsp(s, ~"const"),
       ast::m_imm => {/* nothing */ }
@@ -1587,7 +1587,7 @@ fn print_mt(s: ps, mt: ast::mt) {
 fn print_arg(s: ps, input: ast::arg) {
     ibox(s, indent_unit);
     print_arg_mode(s, input.mode);
-    alt input.ty.node {
+    match input.ty.node {
       ast::ty_infer => word(s.s, *input.ident),
       _ => {
         if str::len(*input.ident) > 0u {
@@ -1604,8 +1604,8 @@ fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
                tps: option<~[ast::ty_param]>) {
     ibox(s, indent_unit);
     word(s.s, opt_proto_to_str(opt_proto));
-    alt id { some(id) => { word(s.s, ~" "); word(s.s, *id); } _ => () }
-    alt tps { some(tps) => print_type_params(s, tps), _ => () }
+    match id { some(id) => { word(s.s, ~" "); word(s.s, *id); } _ => () }
+    match tps { some(tps) => print_type_params(s, tps), _ => () }
     zerobreak(s.s);
     popen(s);
     commasep(s, inconsistent, decl.inputs, print_arg);
@@ -1625,14 +1625,14 @@ fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
 fn maybe_print_trailing_comment(s: ps, span: codemap::span,
                                 next_pos: option<uint>) {
     let mut cm;
-    alt s.cm { some(ccm) => cm = ccm, _ => return }
-    alt next_comment(s) {
+    match s.cm { some(ccm) => cm = ccm, _ => return }
+    match next_comment(s) {
       some(cmnt) => {
         if cmnt.style != comments::trailing { return; }
         let span_line = codemap::lookup_char_pos(cm, span.hi);
         let comment_line = codemap::lookup_char_pos(cm, cmnt.pos);
         let mut next = cmnt.pos + 1u;
-        alt next_pos { none => (), some(p) => next = p }
+        match next_pos { none => (), some(p) => next = p }
         if span.hi < cmnt.pos && cmnt.pos < next &&
                span_line.line == comment_line.line {
             print_comment(s, cmnt);
@@ -1648,7 +1648,7 @@ fn print_remaining_comments(s: ps) {
     // make sure there is a line break at the end.
     if option::is_none(next_comment(s)) { hardbreak(s.s); }
     loop {
-        alt next_comment(s) {
+        match next_comment(s) {
           some(cmnt) => { print_comment(s, cmnt); s.cur_cmnt += 1u; }
           _ => break
         }
@@ -1657,14 +1657,14 @@ fn print_remaining_comments(s: ps) {
 
 fn print_literal(s: ps, &&lit: @ast::lit) {
     maybe_print_comment(s, lit.span.lo);
-    alt next_lit(s, lit.span.lo) {
+    match next_lit(s, lit.span.lo) {
       some(ltrl) => {
         word(s.s, ltrl.lit);
         return;
       }
       _ => ()
     }
-    alt lit.node {
+    match lit.node {
       ast::lit_str(st) => print_string(s, *st),
       ast::lit_int(ch, ast::ty_char) => {
         word(s.s, ~"'" + char::escape_default(ch as char) + ~"'");
@@ -1705,7 +1705,7 @@ fn print_literal(s: ps, &&lit: @ast::lit) {
 fn lit_to_str(l: @ast::lit) -> ~str { return to_str(l, print_literal); }
 
 fn next_lit(s: ps, pos: uint) -> option<comments::lit> {
-    alt s.literals {
+    match s.literals {
       some(lits) => {
         while s.cur_lit < vec::len(lits) {
             let ltrl = lits[s.cur_lit];
@@ -1721,7 +1721,7 @@ fn next_lit(s: ps, pos: uint) -> option<comments::lit> {
 
 fn maybe_print_comment(s: ps, pos: uint) {
     loop {
-        alt next_comment(s) {
+        match next_comment(s) {
           some(cmnt) => {
             if cmnt.pos < pos {
                 print_comment(s, cmnt);
@@ -1734,7 +1734,7 @@ fn maybe_print_comment(s: ps, pos: uint) {
 }
 
 fn print_comment(s: ps, cmnt: comments::cmnt) {
-    alt cmnt.style {
+    match cmnt.style {
       comments::mixed => {
         assert (vec::len(cmnt.lines) == 1u);
         zerobreak(s.s);
@@ -1767,7 +1767,7 @@ fn print_comment(s: ps, cmnt: comments::cmnt) {
       comments::blank_line => {
         // We need to do at least one, possibly two hardbreaks.
         let is_semi =
-            alt s.s.last_token() {
+            match s.s.last_token() {
               pp::STRING(s, _) => *s == ~";",
               _ => false
             };
@@ -1792,7 +1792,7 @@ fn to_str<T>(t: T, f: fn@(ps, T)) -> ~str {
 }
 
 fn next_comment(s: ps) -> option<comments::cmnt> {
-    alt s.comments {
+    match s.comments {
       some(cmnts) => {
         if s.cur_cmnt < vec::len(cmnts) {
             return some(cmnts[s.cur_cmnt]);
@@ -1803,14 +1803,14 @@ fn next_comment(s: ps) -> option<comments::cmnt> {
 }
 
 fn opt_proto_to_str(opt_p: option<ast::proto>) -> ~str {
-    alt opt_p {
+    match opt_p {
       none => ~"fn",
       some(p) => proto_to_str(p)
     }
 }
 
 pure fn purity_to_str(p: ast::purity) -> ~str {
-    alt p {
+    match p {
       ast::impure_fn => ~"impure",
       ast::unsafe_fn => ~"unsafe",
       ast::pure_fn => ~"pure",
@@ -1819,14 +1819,14 @@ fn opt_proto_to_str(opt_p: option<ast::proto>) -> ~str {
 }
 
 fn print_purity(s: ps, p: ast::purity) {
-    alt p {
+    match p {
       ast::impure_fn => (),
       _ => word_nbsp(s, purity_to_str(p))
     }
 }
 
 fn proto_to_str(p: ast::proto) -> ~str {
-    return alt p {
+    return match p {
       ast::proto_bare => ~"extern fn",
       ast::proto_block => ~"fn&",
       ast::proto_uniq => ~"fn~",
index 80bd9e3a6d130586cc2cdeb42c968b4cbed19933..ccc5302015572b6fb263df136481a90bf8878b89 100644 (file)
@@ -27,7 +27,7 @@ trait interner<T: const copy> {
 
 impl <T: const copy> of interner<T> for hash_interner<T> {
     fn intern(val: T) -> uint {
-        alt self.map.find(val) {
+        match self.map.find(val) {
           some(idx) => return idx,
           none => {
             let new_idx = self.vect.len();
index 1c92f26cabe353a9fe57a2b656d6ecab00eb69bb..7df0fc739ad262a4c54892797b79874bda407585 100644 (file)
@@ -25,7 +25,7 @@ enum fn_kind {
 }
 
 fn name_of_fn(fk: fn_kind) -> ident {
-    alt fk {
+    match fk {
       fk_item_fn(name, _) | fk_method(name, _, _)
           | fk_ctor(name, _, _, _, _) => /* FIXME (#2543) */ copy name,
       fk_anon(*) | fk_fn_block(*) => @~"anon",
@@ -34,7 +34,7 @@ fn name_of_fn(fk: fn_kind) -> ident {
 }
 
 fn tps_of_fn(fk: fn_kind) -> ~[ty_param] {
-    alt fk {
+    match fk {
       fk_item_fn(_, tps) | fk_method(_, tps, _)
           | fk_ctor(_, _, tps, _, _) | fk_dtor(tps, _, _, _) => {
           /* FIXME (#2543) */ copy tps
@@ -89,7 +89,7 @@ fn visit_crate<E>(c: crate, e: E, v: vt<E>) {
 }
 
 fn visit_crate_directive<E>(cd: @crate_directive, e: E, v: vt<E>) {
-    alt cd.node {
+    match cd.node {
       cdir_src_mod(_, _) => (),
       cdir_dir_mod(_, cdirs, _) => for cdirs.each |cdir| {
         visit_crate_directive(cdir, e, v);
@@ -109,14 +109,14 @@ fn visit_view_item<E>(_vi: @view_item, _e: E, _v: vt<E>) { }
 fn visit_local<E>(loc: @local, e: E, v: vt<E>) {
     v.visit_pat(loc.node.pat, e, v);
     v.visit_ty(loc.node.ty, e, v);
-    alt loc.node.init {
+    match loc.node.init {
       none => (),
       some(i) => v.visit_expr(i.expr, e, v)
     }
 }
 
 fn visit_item<E>(i: @item, e: E, v: vt<E>) {
-    alt i.node {
+    match i.node {
       item_const(t, ex) => { v.visit_ty(t, e, v); v.visit_expr(ex, e, v); }
       item_fn(decl, tp, body) => {
         v.visit_fn(fk_item_fn(/* FIXME (#2543) */ copy i.ident,
@@ -175,7 +175,7 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) {
 }
 
 fn visit_class_item<E>(cm: @class_member, e:E, v:vt<E>) {
-    alt cm.node {
+    match cm.node {
       instance_var(_, t, _, _, _) => v.visit_ty(t, e, v),
       class_method(m) => visit_method_helper(m, e, v)
     }
@@ -184,7 +184,7 @@ fn visit_class_item<E>(cm: @class_member, e:E, v:vt<E>) {
 fn skip_ty<E>(_t: @ty, _e: E, _v: vt<E>) {}
 
 fn visit_ty<E>(t: @ty, e: E, v: vt<E>) {
-    alt t.node {
+    match t.node {
       ty_box(mt) | ty_uniq(mt) |
       ty_vec(mt) | ty_ptr(mt) | ty_rptr(_, mt) => {
         v.visit_ty(mt.ty, e, v);
@@ -213,7 +213,7 @@ fn visit_path<E>(p: @path, e: E, v: vt<E>) {
 }
 
 fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
-    alt p.node {
+    match p.node {
       pat_enum(path, children) => {
         visit_path(path, e, v);
         do option::iter(children) |children| {
@@ -237,7 +237,7 @@ fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
 }
 
 fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
-    alt ni.node {
+    match ni.node {
       foreign_item_fn(fd, tps) => {
         v.visit_ty_params(tps, e, v);
         visit_fn_decl(fd, e, v);
@@ -248,7 +248,7 @@ fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
 fn visit_ty_params<E>(tps: ~[ty_param], e: E, v: vt<E>) {
     for tps.each |tp| {
         for vec::each(*tp.bounds) |bound| {
-            alt bound {
+            match bound {
               bound_trait(t) => v.visit_ty(t, e, v),
               bound_copy | bound_send | bound_const | bound_owned => ()
             }
@@ -304,7 +304,7 @@ fn visit_ty_method<E>(m: ty_method, e: E, v: vt<E>) {
 }
 
 fn visit_trait_method<E>(m: trait_method, e: E, v: vt<E>) {
-    alt m {
+    match m {
       required(ty_m) => v.visit_ty_method(ty_m, e, v),
       provided(m) => visit_method_helper(m, e, v)
     }
@@ -317,7 +317,7 @@ fn visit_block<E>(b: ast::blk, e: E, v: vt<E>) {
 }
 
 fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
-    alt s.node {
+    match s.node {
       stmt_decl(d, _) => v.visit_decl(d, e, v),
       stmt_expr(ex, _) => v.visit_expr(ex, e, v),
       stmt_semi(ex, _) => v.visit_expr(ex, e, v)
@@ -325,7 +325,7 @@ fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
 }
 
 fn visit_decl<E>(d: @decl, e: E, v: vt<E>) {
-    alt d.node {
+    match d.node {
       decl_local(locs) => for locs.each |loc| {
         v.visit_local(loc, e, v)
       }
@@ -334,7 +334,7 @@ fn visit_decl<E>(d: @decl, e: E, v: vt<E>) {
 }
 
 fn visit_expr_opt<E>(eo: option<@expr>, e: E, v: vt<E>) {
-    alt eo { none => (), some(ex) => v.visit_expr(ex, e, v) }
+    match eo { none => (), some(ex) => v.visit_expr(ex, e, v) }
 }
 
 fn visit_exprs<E>(exprs: ~[@expr], e: E, v: vt<E>) {
@@ -342,7 +342,7 @@ fn visit_exprs<E>(exprs: ~[@expr], e: E, v: vt<E>) {
 }
 
 fn visit_mac<E>(m: mac, e: E, v: vt<E>) {
-    alt m.node {
+    match m.node {
       ast::mac_invoc(pth, arg, body) => {
         option::map(arg, |arg| v.visit_expr(arg, e, v)); }
       ast::mac_invoc_tt(pth, tt) => { /* no user-serviceable parts inside */ }
@@ -353,7 +353,7 @@ fn visit_mac<E>(m: mac, e: E, v: vt<E>) {
 }
 
 fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
-    alt ex.node {
+    match ex.node {
       expr_vstore(x, _) => v.visit_expr(x, e, v),
       expr_vec(es, _) => visit_exprs(es, e, v),
       expr_repeat(element, count, _) => {
index c4dc6efe7b2c9023fda52660f360a944aeccb375..e7fe5fa3e3df67f3dbc2ea77f23b53d7f36bf12f 100644 (file)
@@ -61,7 +61,7 @@ fn is_object_or_assembly_or_exe(ot: output_type) -> bool {
     // and the extension to use.
     fn mk_intermediate_name(output_path: ~str, extension: ~str) ->
         ~str unsafe {
-        let stem = alt str::find_char(output_path, '.') {
+        let stem = match str::find_char(output_path, '.') {
           some(dot_pos) => str::slice(output_path, 0u, dot_pos),
           none => output_path
         };
@@ -82,7 +82,7 @@ fn run_passes(sess: session, llmod: ModuleRef, output: ~str) {
         // specified.
 
         if opts.save_temps {
-            alt opts.output_type {
+            match opts.output_type {
               output_type_bitcode => {
                 if opts.optimize != 0u {
                     let filename = mk_intermediate_name(output, ~"no-opt.bc");
@@ -146,7 +146,7 @@ fn run_passes(sess: session, llmod: ModuleRef, output: ~str) {
             let LLVMOptDefault    = 2 as c_int; // -O2, -Os
             let LLVMOptAggressive = 3 as c_int; // -O3
 
-            let mut CodeGenOptLevel = alt check opts.optimize {
+            let mut CodeGenOptLevel = match check opts.optimize {
               0u => LLVMOptNone,
               1u => LLVMOptLess,
               2u => LLVMOptDefault,
@@ -323,12 +323,12 @@ fn provided_link_metas(sess: session, c: ast::crate) ->
         attr::require_unique_names(sess.diagnostic(), linkage_metas);
         for linkage_metas.each |meta| {
             if *attr::get_meta_item_name(meta) == ~"name" {
-                alt attr::get_meta_item_value_str(meta) {
+                match attr::get_meta_item_value_str(meta) {
                   some(v) => { name = some(v); }
                   none => vec::push(cmh_items, meta)
                 }
             } else if *attr::get_meta_item_name(meta) == ~"vers" {
-                alt attr::get_meta_item_value_str(meta) {
+                match attr::get_meta_item_value_str(meta) {
                   some(v) => { vers = some(v); }
                   none => vec::push(cmh_items, meta)
                 }
@@ -355,7 +355,7 @@ fn len_and_str_lit(l: ast::lit) -> ~str {
         symbol_hasher.reset();
         for cmh_items.each |m_| {
             let m = m_;
-            alt m.node {
+            match m.node {
               ast::meta_name_value(key, value) => {
                 symbol_hasher.write_str(len_and_str(*key));
                 symbol_hasher.write_str(len_and_str_lit(value));
@@ -385,7 +385,7 @@ fn warn_missing(sess: session, name: ~str, default: ~str) {
 
     fn crate_meta_name(sess: session, _crate: ast::crate,
                        output: ~str, metas: provided_metas) -> @~str {
-        return alt metas.name {
+        return match metas.name {
               some(v) => v,
               none => {
                 let name =
@@ -407,7 +407,7 @@ fn crate_meta_name(sess: session, _crate: ast::crate,
 
     fn crate_meta_vers(sess: session, _crate: ast::crate,
                        metas: provided_metas) -> @~str {
-        return alt metas.vers {
+        return match metas.vers {
               some(v) => v,
               none => {
                 let vers = ~"0.0";
@@ -451,7 +451,7 @@ fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
 }
 
 fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> ~str {
-    alt ccx.type_hashcodes.find(t) {
+    match ccx.type_hashcodes.find(t) {
       some(h) => return h,
       none => {
         let hash = symbol_hash(ccx.tcx, ccx.symbol_hasher, t, ccx.link_meta);
@@ -467,7 +467,7 @@ fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> ~str {
 fn sanitize(s: ~str) -> ~str {
     let mut result = ~"";
     do str::chars_iter(s) |c| {
-        alt c {
+        match c {
           '@' => result += ~"_sbox_",
           '~' => result += ~"_ubox_",
           '*' => result += ~"_ptr_",
@@ -503,7 +503,7 @@ fn mangle(ss: path) -> ~str {
     let mut n = ~"_ZN"; // Begin name-sequence.
 
     for ss.each |s| {
-        alt s { path_name(s) | path_mod(s) => {
+        match s { path_name(s) | path_mod(s) => {
           let sani = sanitize(*s);
           n += fmt!{"%u%s", str::len(sani), sani};
         } }
@@ -566,7 +566,7 @@ fn rmext(filename: ~str) -> ~str {
             vec::pop(parts);
             return str::connect(parts, ~".");
         }
-        return alt config.os {
+        return match config.os {
               session::os_macos => rmext(rmlib(filename)),
               session::os_linux => rmext(rmlib(filename)),
               session::os_freebsd => rmext(rmlib(filename)),
index f74ffe8f067edf660268925451577639fd895524..e06b0a2fe72e9e3458fd7e583bb2f145634285a5 100644 (file)
@@ -7,7 +7,7 @@
 export get_rpath_flags;
 
 pure fn not_win32(os: session::os) -> bool {
-  alt os {
+  match os {
       session::os_win32 => false,
       _ => true
   }
@@ -108,7 +108,7 @@ fn get_rpath_relative_to_output(os: session::os,
     assert not_win32(os);
 
     // Mac doesn't appear to support $ORIGIN
-    let prefix = alt os {
+    let prefix = match os {
         session::os_linux => ~"$ORIGIN" + path::path_sep(),
         session::os_freebsd => ~"$ORIGIN" + path::path_sep(),
         session::os_macos => ~"@executable_path" + path::path_sep(),
index 045a90de4955cfe9d8e2365d1b5ee12ae45e0c4e..78270f31e3731b71ed5088e3cd14f210a6bec39e 100644 (file)
@@ -8,7 +8,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
 
         meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),
 
-        data_layout: alt target_os {
+        data_layout: match target_os {
           session::os_macos => {
             ~"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" +
                 ~"-i32:32:32-i64:32:64" +
@@ -29,7 +29,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
           }
         },
 
-        target_triple: alt target_os {
+        target_triple: match target_os {
           session::os_macos => ~"i686-apple-darwin",
           session::os_win32 => ~"i686-pc-mingw32",
           session::os_linux => ~"i686-unknown-linux-gnu",
index 70a35eb328910494b02fcfa2209aadc021628e4b..18c2232c0fc9b58a9e177f292294e20fc10668c4 100644 (file)
@@ -8,7 +8,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
 
         meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),
 
-        data_layout: alt target_os {
+        data_layout: match target_os {
           session::os_macos => {
             ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
                 ~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
@@ -35,7 +35,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
           }
         },
 
-        target_triple: alt target_os {
+        target_triple: match target_os {
           session::os_macos => ~"x86_64-apple-darwin",
           session::os_win32 => ~"x86_64-pc-mingw32",
           session::os_linux => ~"x86_64-unknown-linux-gnu",
index 5a07c8f411cdf20920985b583a383e7d64146dc0..2f6bd86592f4bd261d6420545402afb8651fc36d 100644 (file)
@@ -26,7 +26,7 @@ enum pp_mode {ppm_normal, ppm_expanded, ppm_typed, ppm_identified,
 fn anon_src() -> ~str { ~"<anon>" }
 
 fn source_name(input: input) -> ~str {
-    alt input {
+    match input {
       file_input(ifile) => ifile,
       str_input(_) => anon_src()
     }
@@ -34,7 +34,7 @@ fn source_name(input: input) -> ~str {
 
 fn default_configuration(sess: session, argv0: ~str, input: input) ->
    ast::crate_cfg {
-    let libc = alt sess.targ_cfg.os {
+    let libc = match sess.targ_cfg.os {
       session::os_win32 => ~"msvcrt.dll",
       session::os_macos => ~"libc.dylib",
       session::os_linux => ~"libc.so.6",
@@ -44,7 +44,7 @@ fn default_configuration(sess: session, argv0: ~str, input: input) ->
 
     let mk = attr::mk_name_value_item_str;
 
-    let (arch,wordsz) = alt sess.targ_cfg.arch {
+    let (arch,wordsz) = match sess.targ_cfg.arch {
       session::arch_x86 => (~"x86",~"32"),
       session::arch_x86_64 => (~"x86_64",~"64"),
       session::arch_arm => (~"arm",~"32")
@@ -99,7 +99,7 @@ enum input {
 
 fn parse_input(sess: session, cfg: ast::crate_cfg, input: input)
     -> @ast::crate {
-    alt input {
+    match input {
       file_input(file) => {
         parse::parse_crate_from_file(file, cfg, sess.parse_sess)
       }
@@ -270,13 +270,13 @@ fn compile_input(sess: session, cfg: ast::crate_cfg, input: input,
 fn pretty_print_input(sess: session, cfg: ast::crate_cfg, input: input,
                       ppm: pp_mode) {
     fn ann_paren_for_expr(node: pprust::ann_node) {
-        alt node {
+        match node {
           pprust::node_expr(s, expr) => pprust::popen(s),
           _ => ()
         }
     }
     fn ann_typed_post(tcx: ty::ctxt, node: pprust::ann_node) {
-        alt node {
+        match node {
           pprust::node_expr(s, expr) => {
             pp::space(s.s);
             pp::word(s.s, ~"as");
@@ -288,7 +288,7 @@ fn ann_typed_post(tcx: ty::ctxt, node: pprust::ann_node) {
         }
     }
     fn ann_identified_post(node: pprust::ann_node) {
-        alt node {
+        match node {
           pprust::node_item(s, item) => {
             pp::space(s.s);
             pprust::synth_comment(s, int::to_str(item.id, 10u));
@@ -314,14 +314,14 @@ fn ann_identified_post(node: pprust::ann_node) {
     // to collect comments and literals, and we need to support reading
     // from stdin, we're going to just suck the source into a string
     // so both the parser and pretty-printer can use it.
-    let upto = alt ppm {
+    let upto = match ppm {
       ppm_expanded | ppm_expanded_identified => cu_expand,
       ppm_typed => cu_typeck,
       _ => cu_parse
     };
     let {crate, tcx} = compile_upto(sess, cfg, input, upto, none);
 
-    let ann = alt ppm {
+    let ann = match ppm {
       ppm_typed => {
         {pre: ann_paren_for_expr,
          post: |a| ann_typed_post(option::get(tcx), a) }
@@ -371,21 +371,21 @@ fn get_arch(triple: ~str) -> option<session::arch> {
 
 fn build_target_config(sopts: @session::options,
                        demitter: diagnostic::emitter) -> @session::config {
-    let os = alt get_os(sopts.target_triple) {
+    let os = match get_os(sopts.target_triple) {
       some(os) => os,
       none => early_error(demitter, ~"unknown operating system")
     };
-    let arch = alt get_arch(sopts.target_triple) {
+    let arch = match get_arch(sopts.target_triple) {
       some(arch) => arch,
       none => early_error(demitter,
                           ~"unknown architecture: " + sopts.target_triple)
     };
-    let (int_type, uint_type, float_type) = alt arch {
+    let (int_type, uint_type, float_type) = match arch {
       session::arch_x86 => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
       session::arch_x86_64 => (ast::ty_i64, ast::ty_u64, ast::ty_f64),
       session::arch_arm => (ast::ty_i32, ast::ty_u32, ast::ty_f64)
     };
-    let target_strs = alt arch {
+    let target_strs = match arch {
       session::arch_x86 => x86::get_target_strs(os),
       session::arch_x86_64 => x86_64::get_target_strs(os),
       session::arch_arm => x86::get_target_strs(os)
@@ -438,7 +438,7 @@ fn build_session_options(matches: getopts::matches,
                                 getopts::opt_strs(matches, level_name));
         for flags.each |lint_name| {
             let lint_name = str::replace(lint_name, ~"-", ~"_");
-            alt lint_dict.find(lint_name) {
+            match lint_dict.find(lint_name) {
               none => {
                 early_error(demitter, fmt!{"unknown %s flag: %s",
                                            level_name, lint_name});
@@ -486,7 +486,7 @@ fn build_session_options(matches: getopts::matches,
     let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
     let target_opt = getopts::opt_maybe_str(matches, ~"target");
     let save_temps = getopts::opt_present(matches, ~"save-temps");
-    alt output_type {
+    match output_type {
       // unless we're emitting huamn-readable assembly, omit comments.
       link::output_type_llvm_assembly | link::output_type_assembly => (),
       _ => debugging_opts |= session::no_asm_comments
@@ -498,7 +498,7 @@ fn build_session_options(matches: getopts::matches,
             }
             2u
         } else if opt_present(matches, ~"opt-level") {
-            alt getopts::opt_str(matches, ~"opt-level") {
+            match getopts::opt_str(matches, ~"opt-level") {
               ~"0" => 0u,
               ~"1" => 1u,
               ~"2" => 2u,
@@ -510,7 +510,7 @@ fn build_session_options(matches: getopts::matches,
             }
         } else { 0u };
     let target =
-        alt target_opt {
+        match target_opt {
             none => host_triple(),
             some(s) => s
         };
@@ -577,7 +577,7 @@ fn build_session_(sopts: @session::options,
 }
 
 fn parse_pretty(sess: session, &&name: ~str) -> pp_mode {
-    alt name {
+    match name {
       ~"normal" => ppm_normal,
       ~"expanded" => ppm_expanded,
       ~"typed" => ppm_typed,
@@ -628,7 +628,7 @@ fn build_output_filenames(input: input,
 
 
     let obj_suffix =
-        alt sopts.output_type {
+        match sopts.output_type {
           link::output_type_none => ~"none",
           link::output_type_bitcode => ~"bc",
           link::output_type_assembly => ~"s",
@@ -637,20 +637,20 @@ fn build_output_filenames(input: input,
           link::output_type_object | link::output_type_exe => ~"o"
         };
 
-    alt ofile {
+    match ofile {
       none => {
         // "-" as input file will cause the parser to read from stdin so we
         // have to make up a name
         // We want to toss everything after the final '.'
-        let dirname = alt odir {
+        let dirname = match odir {
           some(d) => d,
-          none => alt input {
+          none => match input {
             str_input(_) => os::getcwd(),
             file_input(ifile) => path::dirname(ifile)
           }
         };
 
-        let base_filename = alt input {
+        let base_filename = match input {
           file_input(ifile) => {
             let (path, _) = path::splitext(ifile);
             path::basename(path)
@@ -714,7 +714,7 @@ mod test {
     #[test]
     fn test_switch_implies_cfg_test() {
         let matches =
-            alt getopts::getopts(~[~"--test"], opts()) {
+            match getopts::getopts(~[~"--test"], opts()) {
               ok(m) => m,
               err(f) => fail ~"test_switch_implies_cfg_test: " +
                              getopts::fail_str(f)
@@ -730,7 +730,7 @@ fn test_switch_implies_cfg_test() {
     #[test]
     fn test_switch_implies_cfg_test_unless_cfg_test() {
         let matches =
-            alt getopts::getopts(~[~"--test", ~"--cfg=test"], opts()) {
+            match getopts::getopts(~[~"--test", ~"--cfg=test"], opts()) {
               ok(m) => m,
               err(f) => {
                 fail ~"test_switch_implies_cfg_test_unless_cfg_test: " +
index 483e1ca5808404615944e282ef87c5da102c20a0..dbbe48f84b20501feca993d22380d7757047a7ba 100644 (file)
@@ -95,7 +95,7 @@ fn padded(max: uint, s: ~str) -> ~str {
         let k = str::replace(k, ~"_", ~"-");
         io::println(fmt!{"    %s  %7.7s  %s",
                          padded(max_key, k),
-                         alt v.default {
+                         match v.default {
                              lint::allow => ~"allow",
                              lint::warn => ~"warn",
                              lint::deny => ~"deny",
@@ -124,7 +124,7 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
     if vec::len(args) == 0u { usage(binary); return; }
 
     let matches =
-        alt getopts::getopts(args, opts()) {
+        match getopts::getopts(args, opts()) {
           ok(m) => m,
           err(f) => {
             early_error(demitter, getopts::fail_str(f))
@@ -152,7 +152,7 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
         version(binary);
         return;
     }
-    let input = alt vec::len(matches.free) {
+    let input = match vec::len(matches.free) {
       0u => early_error(demitter, ~"no input filename given"),
       1u => {
         let ifile = matches.free[0];
@@ -175,7 +175,7 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
         option::map(getopts::opt_default(matches, ~"pretty",
                                          ~"normal"),
                     |a| parse_pretty(sess, a) );
-    alt pretty {
+    match pretty {
       some::<pp_mode>(ppm) => {
         pretty_print_input(sess, cfg, input, ppm);
         return;
@@ -184,7 +184,7 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
     }
     let ls = opt_present(matches, ~"ls");
     if ls {
-        alt input {
+        match input {
           file_input(ifile) => {
             list_metadata(sess, ifile, io::stdout());
           }
@@ -219,7 +219,7 @@ enum monitor_msg {
     let p = comm::port();
     let ch = comm::chan(p);
 
-    alt do task::try  {
+    match do task::try  {
 
         // The 'diagnostics emitter'. Every error, warning, etc. should
         // go through this function.
index 200dd1b00d73cec034b326f958be5979563fbaf4..df9370afaea27d793a47f6a096f92fc4cd8d320a 100644 (file)
@@ -152,7 +152,7 @@ fn unimpl(msg: ~str) -> ! {
     }
     fn span_lint_level(level: lint::level,
                        sp: span, msg: ~str) {
-        alt level {
+        match level {
           lint::allow => { },
           lint::warn => self.span_warn(sp, msg),
           lint::deny | lint::forbid => {
@@ -219,14 +219,14 @@ fn expect<T: copy>(sess: session, opt: option<T>, msg: fn() -> ~str) -> T {
 
 fn building_library(req_crate_type: crate_type, crate: @ast::crate,
                     testing: bool) -> bool {
-    alt req_crate_type {
+    match req_crate_type {
       bin_crate => false,
       lib_crate => true,
       unknown_crate => {
         if testing {
             false
         } else {
-            alt syntax::attr::first_attr_value_str_by_name(
+            match syntax::attr::first_attr_value_str_by_name(
                 crate.node.attrs,
                 ~"crate_type") {
               option::some(@~"lib") => true,
@@ -240,7 +240,7 @@ fn building_library(req_crate_type: crate_type, crate: @ast::crate,
 fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
     import metadata::loader;
 
-    alt os {
+    match os {
       os_win32 => loader::os_win32,
       os_linux => loader::os_linux,
       os_macos => loader::os_macos,
index 92035856ddf5a2009e769d3537cfb0b77fa53a06..ee9000b80e0454f450f9537510bc5fdc97ea2f87 100644 (file)
@@ -82,9 +82,9 @@ fn fold_foreign_mod(cx: ctxt, nm: ast::foreign_mod,
 
 fn filter_stmt(cx: ctxt, &&stmt: @ast::stmt) ->
    option<@ast::stmt> {
-    alt stmt.node {
+    match stmt.node {
       ast::stmt_decl(decl, _) => {
-        alt decl.node {
+        match decl.node {
           ast::decl_item(item) => {
             if item_in_cfg(cx, item) {
                 option::some(stmt)
index cc80a524f31ab372dc78c438eb3a25ee8c9deea5..85770b7b6dd43ef7ce3ce8607ab41335eb76f95a 100644 (file)
@@ -15,7 +15,7 @@ fn inject_intrinsic(sess: session,
                                                  ~[],
                                                  sess.parse_sess);
     let item =
-        alt item {
+        match item {
           some(i) => i,
           none => {
             sess.fatal(~"no item found in intrinsic module");
index 66e430f27cd1e6bff39b164b89e0eee2b6877942..9c54f6fa98161a9d105a1c8dd72a8450dfc80ff4 100644 (file)
@@ -70,7 +70,7 @@ fn fold_mod(_cx: test_ctxt, m: ast::_mod, fld: fold::ast_fold) -> ast::_mod {
     // FIXME (#2403): This is sloppy. Instead we should have some mechanism to
     // indicate to the translation pass which function we want to be main.
     fn nomain(&&item: @ast::item) -> option<@ast::item> {
-        alt item.node {
+        match item.node {
           ast::item_fn(_, _, _) => {
             if *item.ident == ~"main" {
                 option::none
@@ -102,7 +102,7 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
     debug!{"current path: %s", ast_util::path_name_i(cx.path)};
 
     if is_test_fn(i) {
-        alt i.node {
+        match i.node {
           ast::item_fn(decl, _, _) if decl.purity == ast::unsafe_fn => {
             cx.sess.span_fatal(
                 i.span,
@@ -129,7 +129,7 @@ fn is_test_fn(i: @ast::item) -> bool {
         vec::len(attr::find_attrs_by_name(i.attrs, ~"test")) > 0u;
 
     fn has_test_signature(i: @ast::item) -> bool {
-        alt i.node {
+        match i.node {
           ast::item_fn(decl, tps, _) => {
             let input_cnt = vec::len(decl.inputs);
             let no_output = decl.output.node == ast::ty_nil;
@@ -246,7 +246,7 @@ fn mk_path(cx: test_ctxt, path: ~[ast::ident]) -> ~[ast::ident] {
     // the paths with std::
     let is_std = {
         let items = attr::find_linkage_metas(cx.crate.node.attrs);
-        alt attr::last_meta_item_value_str_by_name(items, ~"name") {
+        match attr::last_meta_item_value_str_by_name(items, ~"name") {
           some(@~"std") => true,
           _ => false
         }
index 1effed07f13e48f0835049134446fc743940a869..2250d3d3086b7e56502ac1c81ea48168218c1e35 100644 (file)
@@ -1015,7 +1015,7 @@ fn type_to_str(names: type_names, ty: TypeRef) -> ~str {
 
 fn type_to_str_inner(names: type_names, outer0: ~[TypeRef], ty: TypeRef) ->
    ~str {
-    alt type_has_name(names, ty) {
+    match type_has_name(names, ty) {
       option::some(n) => return n,
       _ => {}
     }
@@ -1035,7 +1035,7 @@ fn tys_str(names: type_names, outer: ~[TypeRef],
         return s;
     }
 
-    alt kind {
+    match kind {
       Void => return ~"Void",
       Half => return ~"Half",
       Float => return ~"Float",
@@ -1103,7 +1103,7 @@ fn tys_str(names: type_names, outer: ~[TypeRef],
 }
 
 fn float_width(llt: TypeRef) -> uint {
-    return alt llvm::LLVMGetTypeKind(llt) as int {
+    return match llvm::LLVMGetTypeKind(llt) as int {
           1 => 32u,
           2 => 64u,
           3 => 80u,
index 03dd9c389dde2cb7e4b13aec69e3401527d4f7c8..5b72a6caa6c98680a1cbd9a174da2e0f2a04f50c 100644 (file)
@@ -100,7 +100,7 @@ fn warn_if_multiple_versions(diag: span_handler,
              mut next_crate_num: ast::crate_num};
 
 fn visit_view_item(e: env, i: @ast::view_item) {
-    alt i.node {
+    match i.node {
       ast::view_item_use(ident, meta_items, id) => {
         debug!{"resolving use stmt. ident: %?, meta: %?", ident, meta_items};
         let cnum = resolve_crate(e, ident, meta_items, ~"", i.span);
@@ -111,9 +111,9 @@ fn visit_view_item(e: env, i: @ast::view_item) {
 }
 
 fn visit_item(e: env, i: @ast::item) {
-    alt i.node {
+    match i.node {
       ast::item_foreign_mod(m) => {
-        alt attr::foreign_abi(i.attrs) {
+        match attr::foreign_abi(i.attrs) {
           either::right(abi) => {
             if abi != ast::foreign_abi_cdecl &&
                abi != ast::foreign_abi_stdcall { return; }
@@ -123,7 +123,7 @@ fn visit_item(e: env, i: @ast::item) {
 
         let cstore = e.cstore;
         let foreign_name =
-            alt attr::first_attr_value_str_by_name(i.attrs, ~"link_name") {
+            match attr::first_attr_value_str_by_name(i.attrs, ~"link_name") {
               some(nn) => {
                 if *nn == ~"" {
                     e.diag.span_fatal(
@@ -144,7 +144,7 @@ fn visit_item(e: env, i: @ast::item) {
                               ~"' already added: can't specify link_args.");
         }
         for link_args.each |a| {
-            alt attr::get_meta_item_value_str(attr::attr_meta(a)) {
+            match attr::get_meta_item_value_str(attr::attr_meta(a)) {
               some(linkarg) => {
                 cstore::add_used_link_args(cstore, *linkarg);
               }
@@ -187,7 +187,7 @@ fn resolve_crate(e: env, ident: ast::ident, metas: ~[@ast::meta_item],
                  hash: ~str, span: span) -> ast::crate_num {
     let metas = metas_with_ident(ident, metas);
 
-    alt existing_match(e, metas, hash) {
+    match existing_match(e, metas, hash) {
       none => {
         let load_ctxt: loader::ctxt = {
             diag: e.diag,
@@ -218,7 +218,7 @@ fn resolve_crate(e: env, ident: ast::ident, metas: ~[@ast::meta_item],
         let cnum_map = resolve_crate_deps(e, cdata);
 
         let cname =
-            alt attr::last_meta_item_value_str_by_name(metas, ~"name") {
+            match attr::last_meta_item_value_str_by_name(metas, ~"name") {
               option::some(v) => v,
               option::none => ident
             };
@@ -248,7 +248,7 @@ fn resolve_crate_deps(e: env, cdata: @~[u8]) -> cstore::cnum_map {
         let cmetas = metas_with(dep.vers, @~"vers", ~[]);
         debug!{"resolving dep crate %s ver: %s hash: %s",
                *dep.name, *dep.vers, *dep.hash};
-        alt existing_match(e, metas_with_ident(cname, cmetas), *dep.hash) {
+        match existing_match(e, metas_with_ident(cname, cmetas), *dep.hash) {
           some(local_cnum) => {
             debug!{"already have it"};
             // We've already seen this crate
index 1a536ca1bdd2df7f8e453ae4bc0c125b63bec345..627d7a326d006691c59c031fb2e30233e60a700b 100644 (file)
@@ -57,7 +57,7 @@ fn lookup_defs(cstore: cstore::cstore, cnum: ast::crate_num,
 fn lookup_method_purity(cstore: cstore::cstore, did: ast::def_id)
     -> ast::purity {
     let cdata = cstore::get_crate_data(cstore, did.crate).data;
-    alt check decoder::lookup_def(did.crate, cdata, did) {
+    match check decoder::lookup_def(did.crate, cdata, did) {
       ast::def_fn(_, p) => p
     }
 }
index a177b264e5bf44648a7c8a98e681530ae8e55b73..75c7c8dd9fe4bcd63e5baa3b742d949063ba8fc9 100644 (file)
@@ -64,7 +64,7 @@ enum cstore { private(cstore_private), }
 
 // Internal method to retrieve the data from the cstore
 pure fn p(cstore: cstore) -> cstore_private {
-    alt cstore { private(p) => p }
+    match cstore { private(p) => p }
 }
 
 fn mk_cstore() -> cstore {
index 2e4a670c84117f64d68a40019f4938254aa5e7f6..2fae50785aff42ff882d984e802fc657cd1e9e71 100644 (file)
@@ -99,7 +99,7 @@ fn find_item(item_id: int, items: ebml::doc) -> ebml::doc {
 // to the item data.
 fn lookup_item(item_id: int, data: @~[u8]) -> ebml::doc {
     let items = ebml::get_doc(ebml::doc(data), tag_items);
-    alt maybe_find_item(item_id, items) {
+    match maybe_find_item(item_id, items) {
        none => fail(fmt!{"lookup_item: id not found: %d", item_id}),
        some(d) => d
     }
@@ -135,7 +135,7 @@ fn field_mutability(d: ebml::doc) -> ast::class_mutability {
         ebml::maybe_get_doc(d, tag_class_mut),
         ast::class_immutable,
         |d| {
-            alt ebml::doc_as_u8(d) as char {
+            match ebml::doc_as_u8(d) as char {
               'm' => ast::class_mutable,
               _   => ast::class_immutable
             }
@@ -184,7 +184,7 @@ fn item_ty_param_bounds(item: ebml::doc, tcx: ty::ctxt, cdata: cmd)
 }
 
 fn item_ty_region_param(item: ebml::doc) -> bool {
-    alt ebml::maybe_get_doc(item, tag_region_param) {
+    match ebml::maybe_get_doc(item, tag_region_param) {
       some(_) => true,
       none => false
     }
@@ -275,7 +275,7 @@ fn lookup_item_name(data: @~[u8], id: ast::node_id) -> ast::ident {
 fn item_to_def_like(item: ebml::doc, did: ast::def_id, cnum: ast::crate_num)
         -> def_like {
     let fam_ch = item_family(item);
-    alt fam_ch {
+    match fam_ch {
       'c' => dl_def(ast::def_const(did)),
       'C' => dl_def(ast::def_class(did, true)),
       'S' => dl_def(ast::def_class(did, false)),
@@ -349,7 +349,7 @@ fn get_class_method(cdata: cmd, id: ast::node_id,
                     name: ast::ident) -> ast::def_id {
     let items = ebml::get_doc(ebml::doc(cdata.data), tag_items);
     let mut found = none;
-    let cls_items = alt maybe_find_item(id, items) {
+    let cls_items = match maybe_find_item(id, items) {
       some(it) => it,
       none => fail (fmt!{"get_class_method: class id not found \
                               when looking up method %s", *name})
@@ -360,7 +360,7 @@ fn get_class_method(cdata: cmd, id: ast::node_id,
             found = some(m_did);
         }
     }
-    alt found {
+    match found {
       some(found) => found,
       none => fail (fmt!{"get_class_method: no method named %s", *name})
     }
@@ -369,7 +369,7 @@ fn get_class_method(cdata: cmd, id: ast::node_id,
 fn class_dtor(cdata: cmd, id: ast::node_id) -> option<ast::def_id> {
     let items = ebml::get_doc(ebml::doc(cdata.data), tag_items);
     let mut found = none;
-    let cls_items = alt maybe_find_item(id, items) {
+    let cls_items = match maybe_find_item(id, items) {
             some(it) => it,
             none     => fail (fmt!{"class_dtor: class id not found \
               when looking up dtor for %d", id})
@@ -394,7 +394,7 @@ enum def_like {
 }
 
 fn def_like_to_def(def_like: def_like) -> ast::def {
-    alt def_like {
+    match def_like {
         dl_def(def) => return def,
         dl_impl(*) => fail ~"found impl in def_like_to_def",
         dl_field => fail ~"found field in def_like_to_def"
@@ -467,7 +467,7 @@ fn g(cdata: cmd, items: ebml::doc, path_doc: ebml::doc, &broken: bool,
             let def_id = class_member_id(path_doc, cdata);
 
             // Get the item.
-            alt maybe_find_item(def_id.node, items) {
+            match maybe_find_item(def_id.node, items) {
                 none => {
                     debug!{"(each_path) ignoring implicit item: %s",
                             *path};
@@ -515,14 +515,14 @@ fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
     debug!{"Looking up item: %d", id};
     let item_doc = lookup_item(id, cdata.data);
     let path = vec::init(item_path(item_doc));
-    alt decode_inlined_item(cdata, tcx, path, item_doc) {
+    match decode_inlined_item(cdata, tcx, path, item_doc) {
       some(ii) => csearch::found(ii),
       none => {
-        alt item_parent_item(item_doc) {
+        match item_parent_item(item_doc) {
           some(did) => {
             let did = translate_def_id(cdata, did);
             let parent_item = lookup_item(did.node, cdata.data);
-            alt decode_inlined_item(cdata, tcx, path,
+            match decode_inlined_item(cdata, tcx, path,
                                                parent_item) {
               some(ii) => csearch::found_parent(did, ii),
               none => csearch::not_found
@@ -548,13 +548,13 @@ fn get_enum_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
                                 tcx, cdata);
         let name = item_name(item);
         let mut arg_tys: ~[ty::t] = ~[];
-        alt ty::get(ctor_ty).struct {
+        match ty::get(ctor_ty).struct {
           ty::ty_fn(f) => {
             for f.inputs.each |a| { vec::push(arg_tys, a.ty); }
           }
           _ => { /* Nullary enum variant. */ }
         }
-        alt variant_disr_val(item) {
+        match variant_disr_val(item) {
           some(val) => { disr_val = val; }
           _         => { /* empty */ }
         }
@@ -577,7 +577,7 @@ fn get_enum_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
 
 fn get_self_ty(item: ebml::doc) -> ast::self_ty_ {
     fn get_mutability(ch: u8) -> ast::mutability {
-        alt ch as char {
+        match ch as char {
             'i' => { ast::m_imm }
             'm' => { ast::m_mutbl }
             'c' => { ast::m_const }
@@ -591,7 +591,7 @@ fn get_mutability(ch: u8) -> ast::mutability {
     let string = ebml::doc_as_str(self_type_doc);
 
     let self_ty_kind = string[0];
-    alt self_ty_kind as char {
+    match self_ty_kind as char {
         'r' => { return ast::sty_by_ref; }
         'v' => { return ast::sty_value; }
         '@' => { return ast::sty_box(get_mutability(string[1])); }
@@ -654,7 +654,7 @@ fn get_impls_for_mod(cdata: cmd,
         let impl_data = impl_cdata.data;
         let item = lookup_item(local_did.node, impl_data);
         let nm = item_name(item);
-        if alt name { some(n) => { n == nm } none => { true } } {
+        if match name { some(n) => { n == nm } none => { true } } {
            let base_tps = item_ty_param_count(item);
            vec::push(result, @{
                 did: local_did, ident: nm,
@@ -675,7 +675,7 @@ fn get_trait_methods(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
         let bounds = item_ty_param_bounds(mth, tcx, cdata);
         let name = item_name(mth);
         let ty = doc_type(mth, tcx, cdata);
-        let fty = alt ty::get(ty).struct {
+        let fty = match ty::get(ty).struct {
           ty::ty_fn(f) => f,
           _ => {
             tcx.diag.handler().bug(
@@ -684,7 +684,7 @@ fn get_trait_methods(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
         let self_ty = get_self_ty(mth);
         vec::push(result, {ident: name, tps: bounds, fty: fty,
                     self_ty: self_ty,
-                    purity: alt check item_family(mth) {
+                    purity: match check item_family(mth) {
                       'u' => ast::unsafe_fn,
                       'f' => ast::impure_fn,
                       'p' => ast::pure_fn
@@ -742,7 +742,7 @@ fn get_class_members(cdata: cmd, id: ast::node_id,
 }
 
 pure fn family_to_visibility(family: char) -> ast::visibility {
-    alt family {
+    match family {
       'g' => ast::public,
       'j' => ast::private,
       'N' => ast::inherited,
@@ -756,7 +756,7 @@ fn get_class_fields(cdata: cmd, id: ast::node_id) -> ~[ty::field_ty] {
 }
 
 fn family_has_type_params(fam_ch: char) -> bool {
-    alt check fam_ch {
+    match check fam_ch {
       'c' | 'T' | 'm' | 'n' | 'g' | 'h' | 'j' => false,
       'f' | 'u' | 'p' | 'F' | 'U' | 'P' | 'y' | 't' | 'v' | 'i' | 'I' | 'C'
           | 'a' | 'S'
@@ -765,7 +765,7 @@ fn family_has_type_params(fam_ch: char) -> bool {
 }
 
 fn family_names_type(fam_ch: char) -> bool {
-    alt fam_ch { 'y' | 't' | 'I' => true, _ => false }
+    match fam_ch { 'y' | 't' | 'I' => true, _ => false }
 }
 
 fn read_path(d: ebml::doc) -> {path: ~str, pos: uint} {
@@ -778,7 +778,7 @@ fn read_path(d: ebml::doc) -> {path: ~str, pos: uint} {
 
 fn describe_def(items: ebml::doc, id: ast::def_id) -> ~str {
     if id.crate != ast::local_crate { return ~"external"; }
-    let it = alt maybe_find_item(id.node, items) {
+    let it = match maybe_find_item(id.node, items) {
         some(it) => it,
         none => fail (fmt!{"describe_def: item not found %?", id})
     };
@@ -786,7 +786,7 @@ fn describe_def(items: ebml::doc, id: ast::def_id) -> ~str {
 }
 
 fn item_family_to_str(fam: char) -> ~str {
-    alt check fam {
+    match check fam {
       'c' => return ~"const",
       'f' => return ~"fn",
       'u' => return ~"unsafe fn",
@@ -837,7 +837,7 @@ fn get_meta_items(md: ebml::doc) -> ~[@ast::meta_item] {
 
 fn get_attributes(md: ebml::doc) -> ~[ast::attribute] {
     let mut attrs: ~[ast::attribute] = ~[];
-    alt ebml::maybe_get_doc(md, tag_attributes) {
+    match ebml::maybe_get_doc(md, tag_attributes) {
       option::some(attrs_d) => {
         for ebml::tagged_docs(attrs_d, tag_attribute) |attr_doc| {
             let meta_items = get_meta_items(attr_doc);
@@ -916,7 +916,7 @@ fn get_crate_hash(data: @~[u8]) -> @~str {
 
 fn get_crate_vers(data: @~[u8]) -> @~str {
     let attrs = decoder::get_crate_attributes(data);
-    return alt attr::last_meta_item_value_str_by_name(
+    return match attr::last_meta_item_value_str_by_name(
         attr::find_linkage_metas(attrs), ~"vers") {
       some(ver) => ver,
       none => @~"0.0"
@@ -997,7 +997,7 @@ fn translate_def_id(cdata: cmd, did: ast::def_id) -> ast::def_id {
         return {crate: cdata.cnum, node: did.node};
     }
 
-    alt cdata.cnum_map.find(did.crate) {
+    match cdata.cnum_map.find(did.crate) {
       option::some(n) => return {crate: n, node: did.node},
       option::none => fail ~"didn't find a crate in the cnum_map"
     }
index fc23c8b351cfe0cdfaddc6e579c9a1f43f96aba3..39057647b7fc83f856ad4ea64f7dd36f7a6b72e8 100644 (file)
@@ -101,7 +101,7 @@ fn encode_named_def_id(ebml_w: ebml::writer, name: ident, id: def_id) {
 
 fn encode_mutability(ebml_w: ebml::writer, mt: class_mutability) {
     do ebml_w.wr_tag(tag_class_mut) {
-        let val = alt mt {
+        let val = match mt {
           class_immutable => 'i',
           class_mutable => 'm'
         };
@@ -145,10 +145,10 @@ fn encode_foreign_module_item_paths(ebml_w: ebml::writer, nmod: foreign_mod,
 fn encode_class_item_paths(ebml_w: ebml::writer,
      items: ~[@class_member], path: ~[ident], &index: ~[entry<~str>]) {
     for items.each |it| {
-     alt ast_util::class_member_visibility(it) {
+     match ast_util::class_member_visibility(it) {
           private => again,
           public | inherited => {
-              let (id, ident) = alt it.node {
+              let (id, ident) = match it.node {
                  instance_var(v, _, _, vid, _) => (vid, v),
                  class_method(it) => (it.id, it.ident)
               };
@@ -168,7 +168,7 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt,
         if !ast_util::is_item_impl(it) {
             add_to_index(ebml_w, path, index, it.ident);
         }
-        alt it.node {
+        match it.node {
           item_const(_, _) => {
             encode_named_def_id(ebml_w, it.ident, local_def(it.id));
           }
@@ -205,7 +205,7 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt,
                 // class and for its ctor
                 add_to_index(ebml_w, path, index, it.ident);
 
-                alt m_ctor {
+                match m_ctor {
                     none => {
                         // Nothing to do.
                     }
@@ -317,7 +317,7 @@ fn encode_type(ecx: @encode_ctxt, ebml_w: ebml::writer, typ: ty::t) {
 
 fn encode_symbol(ecx: @encode_ctxt, ebml_w: ebml::writer, id: node_id) {
     ebml_w.start_tag(tag_items_data_item_symbol);
-    let sym = alt ecx.item_symbols.find(id) {
+    let sym = match ecx.item_symbols.find(id) {
       some(x) => x,
       none => {
         ecx.diag.handler().bug(
@@ -382,7 +382,7 @@ fn encode_path(ebml_w: ebml::writer,
                path: ast_map::path,
                name: ast_map::path_elt) {
     fn encode_path_elt(ebml_w: ebml::writer, elt: ast_map::path_elt) {
-        let (tag, name) = alt elt {
+        let (tag, name) = match elt {
           ast_map::path_mod(name) => (tag_path_elt_mod, name),
           ast_map::path_name(name) => (tag_path_elt_name, name)
         };
@@ -416,7 +416,7 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: ebml::writer, md: _mod,
                ast_util::is_exported(ident, md)};
 
         ebml_w.start_tag(tag_mod_impl);
-        alt ecx.tcx.items.find(did.node) {
+        match ecx.tcx.items.find(did.node) {
           some(ast_map::node_item(it@@{node: cl@item_class(*),_},_)) => {
         /* If did stands for a trait
         ref, we need to map it to its parent class */
@@ -436,7 +436,7 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: ebml::writer, md: _mod,
 }
 
 fn encode_visibility(ebml_w: ebml::writer, visibility: visibility) {
-    encode_family(ebml_w, alt visibility {
+    encode_family(ebml_w, match visibility {
         public => 'g',
         private => 'j',
         inherited => 'N'
@@ -444,7 +444,7 @@ fn encode_visibility(ebml_w: ebml::writer, visibility: visibility) {
 }
 
 fn encode_region(ebml_w: ebml::writer, region: region) {
-    alt region.node {
+    match region.node {
         re_anon => {
             ebml_w.wr_tagged_str(tag_item_trait_method_self_ty, ~"");
         }
@@ -459,7 +459,7 @@ fn encode_self_type(ebml_w: ebml::writer, self_type: ast::self_ty_) {
 
     // Encode the base self type.
     let ch;
-    alt self_type {
+    match self_type {
         sty_by_ref =>       { ch = 'r' as u8; }
         sty_value =>        { ch = 'v' as u8; }
         sty_region(_, _) => { ch = '&' as u8; }
@@ -469,7 +469,7 @@ fn encode_self_type(ebml_w: ebml::writer, self_type: ast::self_ty_) {
     ebml_w.writer.write(&[ ch ]);
 
     // Encode mutability.
-    alt self_type {
+    match self_type {
         sty_by_ref | sty_value => { /* No-op. */ }
         sty_region(_, m_imm) | sty_box(m_imm) | sty_uniq(m_imm) => {
             ebml_w.writer.write(&[ 'i' as u8 ]);
@@ -483,7 +483,7 @@ fn encode_self_type(ebml_w: ebml::writer, self_type: ast::self_ty_) {
     }
 
     // Encode the region.
-    alt self_type {
+    match self_type {
         sty_region(region, _) => {
             encode_region(ebml_w, *region);
         }
@@ -508,7 +508,7 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer,
     for items.each |ci| {
      /* We encode both private and public fields -- need to include
         private fields to get the offsets right */
-      alt ci.node {
+      match ci.node {
         instance_var(nm, _, mt, id, vis) => {
           vec::push(*index, {val: id, pos: ebml_w.writer.tell()});
           vec::push(*global_index, {val: id, pos: ebml_w.writer.tell()});
@@ -523,7 +523,7 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer,
           ebml_w.end_tag();
         }
         class_method(m) => {
-           alt m.vis {
+           match m.vis {
               public | inherited => {
                 vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()});
                 vec::push(*global_index,
@@ -557,7 +557,7 @@ fn encode_info_for_fn(ecx: @encode_ctxt, ebml_w: ebml::writer,
                util::ppaux::ty_to_str(ecx.tcx, its_ty), id};
         encode_type(ecx, ebml_w, its_ty);
         encode_path(ebml_w, path, ast_map::path_name(ident));
-        alt item {
+        match item {
            some(it) => {
              ecx.encode_inlined_item(ecx, ebml_w, path, it);
            }
@@ -592,7 +592,7 @@ fn encode_info_for_method(ecx: @encode_ctxt, ebml_w: ebml::writer,
 }
 
 fn purity_fn_family(p: purity) -> char {
-    alt p {
+    match p {
       unsafe_fn => 'u',
       pure_fn => 'p',
       impure_fn => 'f',
@@ -602,7 +602,7 @@ fn purity_fn_family(p: purity) -> char {
 
 
 fn should_inline(attrs: ~[attribute]) -> bool {
-    alt attr::find_inline_attr(attrs) {
+    match attr::find_inline_attr(attrs) {
         attr::ia_none | attr::ia_never  => false,
         attr::ia_hint | attr::ia_always => true
     }
@@ -614,7 +614,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
 
     let tcx = ecx.tcx;
     let must_write =
-        alt item.node {
+        match item.node {
           item_enum(_, _) | item_impl(*)
           | item_trait(*) | item_class(*) => true,
           _ => false
@@ -627,7 +627,7 @@ fn add_to_index_(item: @item, ebml_w: ebml::writer,
     }
     let add_to_index = |copy ebml_w| add_to_index_(item, ebml_w, index);
 
-    alt item.node {
+    match item.node {
       item_const(_, _) => {
         add_to_index();
         ebml_w.start_tag(tag_items_data_item);
@@ -719,7 +719,7 @@ fn add_to_index_(item: @item, ebml_w: ebml::writer,
         ebml_w.start_tag(tag_items_data_item);
         encode_def_id(ebml_w, local_def(item.id));
 
-        alt ctor {
+        match ctor {
             none => encode_family(ebml_w, 'S'),
             some(_) => encode_family(ebml_w, 'C')
         }
@@ -752,7 +752,7 @@ fn add_to_index_(item: @item, ebml_w: ebml::writer,
            ebml_w.end_tag();
         }
         for ms.each |m| {
-           alt m.vis {
+           match m.vis {
               private => { /* do nothing */ }
               public | inherited => {
                 /* Write the info that's needed when viewing this class
@@ -823,7 +823,7 @@ fn add_to_index_(item: @item, ebml_w: ebml::writer,
         encode_attributes(ebml_w, item.attrs);
         let mut i = 0u;
         for vec::each(*ty::trait_methods(tcx, local_def(item.id))) |mty| {
-            alt ms[i] {
+            match ms[i] {
               required(ty_m) => {
                 ebml_w.start_tag(tag_item_trait_method);
                 encode_name(ebml_w, mty.ident);
@@ -859,7 +859,7 @@ fn encode_info_for_foreign_item(ecx: @encode_ctxt, ebml_w: ebml::writer,
     vec::push(*index, {val: nitem.id, pos: ebml_w.writer.tell()});
 
     ebml_w.start_tag(tag_items_data_item);
-    alt nitem.node {
+    match nitem.node {
       foreign_item_fn(fn_decl, tps) => {
         encode_def_id(ebml_w, local_def(nitem.id));
         encode_family(ebml_w, purity_fn_family(fn_decl.purity));
@@ -888,11 +888,11 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
         visit_expr: |_e, _cx, _v| { },
         visit_item: |i, cx, v, copy ebml_w| {
             visit::visit_item(i, cx, v);
-            alt check ecx.tcx.items.get(i.id) {
+            match check ecx.tcx.items.get(i.id) {
               ast_map::node_item(_, pt) => {
                 encode_info_for_item(ecx, ebml_w, i, index, *pt);
                 /* encode ctor, then encode items */
-                alt i.node {
+                match i.node {
                    item_class(tps, _, _, some(ctor), m_dtor) => {
                        debug!{"encoding info for ctor %s %d", *i.ident,
                               ctor.node.id};
@@ -913,7 +913,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
         },
         visit_foreign_item: |ni, cx, v, copy ebml_w| {
             visit::visit_foreign_item(ni, cx, v);
-            alt check ecx.tcx.items.get(ni.id) {
+            match check ecx.tcx.items.get(ni.id) {
               ast_map::node_foreign_item(_, abi, pt) => {
                 encode_info_for_foreign_item(ecx, ebml_w, ni,
                                              index, *pt, abi);
@@ -981,7 +981,7 @@ fn write_int(writer: io::writer, &&n: int) {
 }
 
 fn encode_meta_item(ebml_w: ebml::writer, mi: meta_item) {
-    alt mi.node {
+    match mi.node {
       meta_word(name) => {
         ebml_w.start_tag(tag_meta_item_word);
         ebml_w.start_tag(tag_meta_item_name);
@@ -990,7 +990,7 @@ fn encode_meta_item(ebml_w: ebml::writer, mi: meta_item) {
         ebml_w.end_tag();
       }
       meta_name_value(name, value) => {
-        alt value.node {
+        match value.node {
           lit_str(value) => {
             ebml_w.start_tag(tag_meta_item_name_value);
             ebml_w.start_tag(tag_meta_item_name);
@@ -1064,7 +1064,7 @@ fn synthesize_link_attr(ecx: @encode_ctxt, items: ~[@meta_item]) ->
             if *attr::get_attr_name(attr) != ~"link" {
                 attr
             } else {
-                alt attr.node.value.node {
+                match attr.node.value.node {
                   meta_list(n, l) => {
                     found_link_attr = true;;
                     synthesize_link_attr(ecx, l)
index 656aa4a0ae29cd9ad66a3c6a5ecc20c0f6e9f095..54aef6e858f9c9c994d52eebaf9a3410e1cf8206 100644 (file)
@@ -43,11 +43,11 @@ fn lib_search_paths() -> ~[path] {
 
             vec::push(paths,
                       make_target_lib_path(self.sysroot, self.target_triple));
-            alt get_cargo_lib_path_nearest() {
+            match get_cargo_lib_path_nearest() {
               result::ok(p) => vec::push(paths, p),
               result::err(p) => ()
             }
-            alt get_cargo_lib_path() {
+            match get_cargo_lib_path() {
               result::ok(p) => vec::push(paths, p),
               result::err(p) => ()
             }
@@ -101,14 +101,14 @@ fn make_target_lib_path(sysroot: path,
 }
 
 fn get_default_sysroot() -> path {
-    alt os::self_exe_path() {
+    match os::self_exe_path() {
       option::some(p) => path::normalize(path::connect(p, ~"..")),
       option::none => fail ~"can't determine value for sysroot"
     }
 }
 
 fn get_sysroot(maybe_sysroot: option<path>) -> path {
-    alt maybe_sysroot {
+    match maybe_sysroot {
       option::some(sr) => sr,
       option::none => get_default_sysroot()
     }
@@ -120,9 +120,9 @@ fn get_cargo_sysroot() -> result<path, ~str> {
 }
 
 fn get_cargo_root() -> result<path, ~str> {
-    alt os::getenv(~"CARGO_ROOT") {
+    match os::getenv(~"CARGO_ROOT") {
         some(_p) => result::ok(_p),
-        none => alt os::homedir() {
+        none => match os::homedir() {
           some(_q) => result::ok(path::connect(_q, ~".cargo")),
           none => result::err(~"no CARGO_ROOT or home directory")
         }
index e45fdeb06b8388aa2b4c680ed17310e9a9923184..e5a2e0848e9225e3365c4261bf973a72ed6fcd22 100644 (file)
@@ -37,7 +37,7 @@ enum os {
 };
 
 fn load_library_crate(cx: ctxt) -> {ident: ~str, data: @~[u8]} {
-    alt find_library_crate(cx) {
+    match find_library_crate(cx) {
       some(t) => return t,
       none => {
         cx.diag.span_fatal(
@@ -53,7 +53,7 @@ fn find_library_crate(cx: ctxt) -> option<{ident: ~str, data: @~[u8]}> {
 
 fn libname(cx: ctxt) -> {prefix: ~str, suffix: ~str} {
     if cx.static { return {prefix: ~"lib", suffix: ~".rlib"}; }
-    alt cx.os {
+    match cx.os {
       os_win32 => return {prefix: ~"", suffix: ~".dll"},
       os_macos => return {prefix: ~"lib", suffix: ~".dylib"},
       os_linux => return {prefix: ~"lib", suffix: ~".so"},
@@ -79,7 +79,7 @@ fn find_library_crate_aux(cx: ctxt,
             option::none::<()>
         } else {
             debug!{"%s is a candidate", path};
-            alt get_metadata_section(cx.os, path) {
+            match get_metadata_section(cx.os, path) {
               option::some(cvec) => {
                 if !crate_matches(cvec, cx.metas, cx.hash) {
                     debug!{"skipping %s, metadata doesn't match", path};
@@ -118,9 +118,9 @@ fn find_library_crate_aux(cx: ctxt,
 
 fn crate_name_from_metas(metas: ~[@ast::meta_item]) -> @~str {
     let name_items = attr::find_meta_items_by_name(metas, ~"name");
-    alt vec::last_opt(name_items) {
+    match vec::last_opt(name_items) {
       some(i) => {
-        alt attr::get_meta_item_value_str(i) {
+        match attr::get_meta_item_value_str(i) {
           some(n) => n,
           // FIXME (#2406): Probably want a warning here since the user
           // is using the wrong type of meta item.
@@ -175,7 +175,7 @@ fn get_metadata_section(os: os,
         llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf)
                                    });
     if mb as int == 0 { return option::none::<@~[u8]>; }
-    let of = alt mk_object_file(mb) {
+    let of = match mk_object_file(mb) {
         option::some(of) => of,
         _ => return option::none::<@~[u8]>
     };
@@ -197,7 +197,7 @@ fn get_metadata_section(os: os,
 }
 
 fn meta_section_name(os: os) -> ~str {
-    alt os {
+    match os {
       os_macos => ~"__DATA,__note.rustc",
       os_win32 => ~".note.rustc",
       os_linux => ~".note.rustc",
@@ -207,7 +207,7 @@ fn meta_section_name(os: os) -> ~str {
 
 // A diagnostic function for dumping crate metadata to an output stream
 fn list_file_metadata(os: os, path: ~str, out: io::writer) {
-    alt get_metadata_section(os, path) {
+    match get_metadata_section(os, path) {
       option::some(bytes) => decoder::list_crate_metadata(bytes, out),
       option::none => {
         out.write_str(~"could not find metadata in " + path + ~".\n");
index fee68f5592ddb2f6f2fa0350b5e9e33269503b7c..a834147af96103f98b911fee15913821916cc968 100644 (file)
@@ -57,7 +57,7 @@ fn parse_ty_data(data: @~[u8], crate_num: int, pos: uint, tcx: ty::ctxt,
 }
 
 fn parse_ret_ty(st: @pstate, conv: conv_did) -> (ast::ret_style, ty::t) {
-    alt peek(st) {
+    match peek(st) {
       '!' => { next(st); (ast::noreturn, ty::mk_bot(st.tcx)) }
       _ => (ast::return_val, parse_ty(st, conv))
     }
@@ -68,7 +68,7 @@ fn parse_path(st: @pstate) -> @ast::path {
     fn is_last(c: char) -> bool { return c == '(' || c == ':'; }
     vec::push(idents, parse_ident_(st, is_last));
     loop {
-        alt peek(st) {
+        match peek(st) {
           ':' => { next(st); next(st); }
           c => {
             if c == '(' {
@@ -86,7 +86,7 @@ fn parse_ty_rust_fn(st: @pstate, conv: conv_did) -> ty::t {
 }
 
 fn parse_proto(c: char) -> ast::proto {
-    alt c {
+    match c {
       '~' => ast::proto_uniq,
       '@' => ast::proto_box,
       '&' => ast::proto_block,
@@ -105,7 +105,7 @@ fn parse_vstore(st: @pstate) -> ty::vstore {
         return ty::vstore_fixed(n);
     }
 
-    alt check next(st) {
+    match check next(st) {
       '~' => ty::vstore_uniq,
       '@' => ty::vstore_box,
       '&' => ty::vstore_slice(parse_region(st))
@@ -128,7 +128,7 @@ fn parse_substs(st: @pstate, conv: conv_did) -> ty::substs {
 }
 
 fn parse_bound_region(st: @pstate) -> ty::bound_region {
-    alt check next(st) {
+    match check next(st) {
       's' => ty::br_self,
       'a' => ty::br_anon,
       '[' => ty::br_named(@parse_str(st, ']')),
@@ -141,7 +141,7 @@ fn parse_bound_region(st: @pstate) -> ty::bound_region {
 }
 
 fn parse_region(st: @pstate) -> ty::region {
-    alt check next(st) {
+    match check next(st) {
       'b' => {
         ty::re_bound(parse_bound_region(st))
       }
@@ -165,7 +165,7 @@ fn parse_region(st: @pstate) -> ty::region {
 }
 
 fn parse_opt<T>(st: @pstate, f: fn() -> T) -> option<T> {
-    alt check next(st) {
+    match check next(st) {
       'n' => none,
       's' => some(f())
     }
@@ -181,7 +181,7 @@ fn parse_str(st: @pstate, term: char) -> ~str {
 }
 
 fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
-    alt check next(st) {
+    match check next(st) {
       'n' => return ty::mk_nil(st.tcx),
       'z' => return ty::mk_bot(st.tcx),
       'b' => return ty::mk_bool(st.tcx),
@@ -189,7 +189,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
       'u' => return ty::mk_uint(st.tcx),
       'l' => return ty::mk_float(st.tcx),
       'M' => {
-        alt check next(st) {
+        match check next(st) {
           'b' => return ty::mk_mach_uint(st.tcx, ast::ty_u8),
           'w' => return ty::mk_mach_uint(st.tcx, ast::ty_u16),
           'l' => return ty::mk_mach_uint(st.tcx, ast::ty_u32),
@@ -267,7 +267,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
       }
       'Y' => return ty::mk_type(st.tcx),
       'C' => {
-        let ck = alt check next(st) {
+        let ck = match check next(st) {
           '&' => ty::ck_block,
           '@' => ty::ck_box,
           '~' => ty::ck_uniq
@@ -279,7 +279,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
         assert (next(st) == ':');
         let len = parse_hex(st);
         assert (next(st) == '#');
-        alt st.tcx.rcache.find({cnum: st.crate, pos: pos, len: len}) {
+        match st.tcx.rcache.find({cnum: st.crate, pos: pos, len: len}) {
           some(tt) => return tt,
           none => {
             let ps = @{pos: pos with *st};
@@ -311,7 +311,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
 
 fn parse_mt(st: @pstate, conv: conv_did) -> ty::mt {
     let mut m;
-    alt peek(st) {
+    match peek(st) {
       'm' => { next(st); m = ast::m_mutbl; }
       '?' => { next(st); m = ast::m_const; }
       _ => { m = ast::m_imm; }
@@ -351,7 +351,7 @@ fn parse_hex(st: @pstate) -> uint {
 }
 
 fn parse_purity(c: char) -> purity {
-    alt check c {
+    match check c {
       'u' => unsafe_fn,
       'p' => pure_fn,
       'i' => impure_fn,
@@ -365,7 +365,7 @@ fn parse_ty_fn(st: @pstate, conv: conv_did) -> ty::fn_ty {
     assert (next(st) == '[');
     let mut inputs: ~[ty::arg] = ~[];
     while peek(st) != ']' {
-        let mode = alt check peek(st) {
+        let mode = match check peek(st) {
           '&' => ast::by_mutbl_ref,
           '-' => ast::by_move,
           '+' => ast::by_copy,
@@ -394,12 +394,12 @@ fn parse_def_id(buf: &[u8]) -> ast::def_id {
     let crate_part = vec::slice(buf, 0u, colon_idx);
     let def_part = vec::slice(buf, colon_idx + 1u, len);
 
-    let crate_num = alt uint::parse_buf(crate_part, 10u) {
+    let crate_num = match uint::parse_buf(crate_part, 10u) {
        some(cn) => cn as int,
        none => fail (fmt!{"internal error: parse_def_id: crate number \
                                expected, but found %?", crate_part})
     };
-    let def_num = alt uint::parse_buf(def_part, 10u) {
+    let def_num = match uint::parse_buf(def_part, 10u) {
        some(dn) => dn as int,
        none => fail (fmt!{"internal error: parse_def_id: id expected, but \
                                found %?", def_part})
@@ -417,7 +417,7 @@ fn parse_bounds_data(data: @~[u8], start: uint,
 fn parse_bounds(st: @pstate, conv: conv_did) -> @~[ty::param_bound] {
     let mut bounds = ~[];
     loop {
-        vec::push(bounds, alt check next(st) {
+        vec::push(bounds, match check next(st) {
           'S' => ty::bound_send,
           'C' => ty::bound_copy,
           'K' => ty::bound_const,
index a9685dabba70c051a57d6033b694b74a1dccf7b2..458dc149802c60fbea01c52ba16704b6eb8625af 100644 (file)
 enum abbrev_ctxt { ac_no_abbrevs, ac_use_abbrevs(hashmap<ty::t, ty_abbrev>), }
 
 fn cx_uses_abbrevs(cx: @ctxt) -> bool {
-    alt cx.abbrevs {
+    match cx.abbrevs {
       ac_no_abbrevs => return false,
       ac_use_abbrevs(_) => return true
     }
 }
 
 fn enc_ty(w: io::writer, cx: @ctxt, t: ty::t) {
-    alt cx.abbrevs {
+    match cx.abbrevs {
       ac_no_abbrevs => {
-        let result_str = alt cx.tcx.short_names_cache.find(t) {
+        let result_str = match cx.tcx.short_names_cache.find(t) {
           some(s) => *s,
           none => {
             let buf = io::mem_buffer();
@@ -55,11 +55,11 @@ fn enc_ty(w: io::writer, cx: @ctxt, t: ty::t) {
         w.write_str(result_str);
       }
       ac_use_abbrevs(abbrevs) => {
-        alt abbrevs.find(t) {
+        match abbrevs.find(t) {
           some(a) => { w.write_str(*a.s); return; }
           none => {
             let pos = w.tell();
-            alt ty::type_def_id(t) {
+            match ty::type_def_id(t) {
               some(def_id) => {
                 // Do not emit node ids that map to unexported names.  Those
                 // are not helpful.
@@ -96,7 +96,7 @@ fn estimate_sz(u: uint) -> uint {
     }
 }
 fn enc_mt(w: io::writer, cx: @ctxt, mt: ty::mt) {
-    alt mt.mutbl {
+    match mt.mutbl {
       m_imm => (),
       m_mutbl => w.write_char('m'),
       m_const => w.write_char('?')
@@ -105,7 +105,7 @@ fn enc_mt(w: io::writer, cx: @ctxt, mt: ty::mt) {
 }
 
 fn enc_opt<T>(w: io::writer, t: option<T>, enc_f: fn(T)) {
-    alt t {
+    match t {
       none => w.write_char('n'),
       some(v) => {
         w.write_char('s');
@@ -123,7 +123,7 @@ fn enc_substs(w: io::writer, cx: @ctxt, substs: ty::substs) {
 }
 
 fn enc_region(w: io::writer, cx: @ctxt, r: ty::region) {
-    alt r {
+    match r {
       ty::re_bound(br) => {
         w.write_char('b');
         enc_bound_region(w, br);
@@ -152,7 +152,7 @@ fn enc_region(w: io::writer, cx: @ctxt, r: ty::region) {
 }
 
 fn enc_bound_region(w: io::writer, br: ty::bound_region) {
-    alt br {
+    match br {
       ty::br_self => w.write_char('s'),
       ty::br_anon => w.write_char('a'),
       ty::br_named(s) => {
@@ -171,7 +171,7 @@ fn enc_bound_region(w: io::writer, br: ty::bound_region) {
 
 fn enc_vstore(w: io::writer, cx: @ctxt, v: ty::vstore) {
     w.write_char('/');
-    alt v {
+    match v {
       ty::vstore_fixed(u) => {
         w.write_uint(u);
         w.write_char('|');
@@ -190,12 +190,12 @@ fn enc_vstore(w: io::writer, cx: @ctxt, v: ty::vstore) {
 }
 
 fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
-    alt st {
+    match st {
       ty::ty_nil => w.write_char('n'),
       ty::ty_bot => w.write_char('z'),
       ty::ty_bool => w.write_char('b'),
       ty::ty_int(t) => {
-        alt t {
+        match t {
           ty_i => w.write_char('i'),
           ty_char => w.write_char('c'),
           ty_i8 => w.write_str(&"MB"),
@@ -205,7 +205,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
         }
       }
       ty::ty_uint(t) => {
-        alt t {
+        match t {
           ty_u => w.write_char('u'),
           ty_u8 => w.write_str(&"Mb"),
           ty_u16 => w.write_str(&"Mw"),
@@ -214,7 +214,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
         }
       }
       ty::ty_float(t) => {
-        alt t {
+        match t {
           ty_f => w.write_char('l'),
           ty_f32 => w.write_str(&"Mf"),
           ty_f64 => w.write_str(&"MF"),
@@ -307,7 +307,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
     }
 }
 fn enc_proto(w: io::writer, proto: proto) {
-    alt proto {
+    match proto {
       proto_uniq => w.write_str(&"f~"),
       proto_box => w.write_str(&"f@"),
       proto_block => w.write_str(~"f&"),
@@ -316,7 +316,7 @@ fn enc_proto(w: io::writer, proto: proto) {
 }
 
 fn enc_mode(w: io::writer, cx: @ctxt, m: mode) {
-    alt ty::resolved_mode(cx.tcx, m) {
+    match ty::resolved_mode(cx.tcx, m) {
       by_mutbl_ref => w.write_char('&'),
       by_move => w.write_char('-'),
       by_copy => w.write_char('+'),
@@ -326,7 +326,7 @@ fn enc_mode(w: io::writer, cx: @ctxt, m: mode) {
 }
 
 fn enc_purity(w: io::writer, p: purity) {
-    alt p {
+    match p {
       pure_fn => w.write_char('p'),
       impure_fn => w.write_char('i'),
       unsafe_fn => w.write_char('u'),
@@ -343,7 +343,7 @@ fn enc_ty_fn(w: io::writer, cx: @ctxt, ft: ty::fn_ty) {
         enc_ty(w, cx, arg.ty);
     }
     w.write_char(']');
-    alt ft.ret_style {
+    match ft.ret_style {
       noreturn => w.write_char('!'),
       _ => enc_ty(w, cx, ft.output)
     }
@@ -351,7 +351,7 @@ fn enc_ty_fn(w: io::writer, cx: @ctxt, ft: ty::fn_ty) {
 
 fn enc_bounds(w: io::writer, cx: @ctxt, bs: @~[ty::param_bound]) {
     for vec::each(*bs) |bound| {
-        alt bound {
+        match bound {
           ty::bound_send => w.write_char('S'),
           ty::bound_copy => w.write_char('C'),
           ty::bound_const => w.write_char('K'),
index 054c51bfe362f13878a58f733dcfeca777e22e31..b1b548169983dedf1afdf6155f7b1e2377fe1286 100644 (file)
@@ -111,7 +111,7 @@ fn decode_inlined_item(cdata: cstore::crate_metadata,
                        path: ast_map::path,
                        par_doc: ebml::doc) -> option<ast::inlined_item> {
     let dcx = @{cdata: cdata, tcx: tcx, maps: maps};
-    alt par_doc.opt_child(c::tag_ast) {
+    match par_doc.opt_child(c::tag_ast) {
       none => none,
       some(ast_doc) => {
         debug!{"> Decoding inlined fn: %s::?", ast_map::path_to_str(path)};
@@ -129,7 +129,7 @@ fn decode_inlined_item(cdata: cstore::crate_metadata,
         decode_side_tables(xcx, ast_doc);
         debug!{"< Decoded inlined fn: %s::%s",
                ast_map::path_to_str(path), *ii.ident()};
-        alt ii {
+        match ii {
           ast::ii_item(i) => {
             debug!{">>> DECODED ITEM >>>\n%s\n<<< DECODED ITEM <<<",
                    syntax::print::pprust::item_to_str(i)};
@@ -245,7 +245,7 @@ fn encode_ast(ebml_w: ebml::writer, item: ast::inlined_item) {
 fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
     fn drop_nested_items(blk: ast::blk_, fld: fold::ast_fold) -> ast::blk_ {
         let stmts_sans_items = do vec::filter(blk.stmts) |stmt| {
-            alt stmt.node {
+            match stmt.node {
               ast::stmt_expr(_, _) | ast::stmt_semi(_, _) |
               ast::stmt_decl(@{node: ast::decl_local(_), span: _}, _) => true,
               ast::stmt_decl(@{node: ast::decl_item(_), span: _}, _) => false
@@ -260,7 +260,7 @@ fn drop_nested_items(blk: ast::blk_, fld: fold::ast_fold) -> ast::blk_ {
         with *fold::default_ast_fold()
     });
 
-    alt ii {
+    match ii {
       ast::ii_item(i) => {
         ast::ii_item(fld.fold_item(i).get()) //hack: we're not dropping items
       }
@@ -300,7 +300,7 @@ fn renumber_ast(xcx: extended_decode_ctxt, ii: ast::inlined_item)
         with *fold::default_ast_fold()
     });
 
-    alt ii {
+    match ii {
       ast::ii_item(i) => {
         ast::ii_item(fld.fold_item(i).get())
       }
@@ -352,7 +352,7 @@ fn decode_def(xcx: extended_decode_ctxt, doc: ebml::doc) -> ast::def {
 
 impl of tr for ast::def {
     fn tr(xcx: extended_decode_ctxt) -> ast::def {
-        alt self {
+        match self {
           ast::def_fn(did, p) => ast::def_fn(did.tr(xcx), p),
           ast::def_self(nid) => ast::def_self(xcx.tr_id(nid)),
           ast::def_mod(did) => ast::def_mod(did.tr(xcx)),
@@ -422,7 +422,7 @@ fn read_method_map_entry(xcx: extended_decode_ctxt) -> method_map_entry {
 
 impl of tr for method_origin {
     fn tr(xcx: extended_decode_ctxt) -> method_origin {
-        alt self {
+        match self {
           typeck::method_static(did) => {
             typeck::method_static(did.tr(xcx))
           }
@@ -455,7 +455,7 @@ fn encode_vtable_origin(ecx: @e::encode_ctxt,
                       ebml_w: ebml::writer,
                       vtable_origin: typeck::vtable_origin) {
     do ebml_w.emit_enum(~"vtable_origin") {
-        alt vtable_origin {
+        match vtable_origin {
           typeck::vtable_static(def_id, tys, vtable_res) => {
             do ebml_w.emit_enum_variant(~"vtable_static", 0u, 3u) {
                 do ebml_w.emit_enum_variant_arg(0u) {
@@ -508,7 +508,7 @@ fn read_vtable_origin(xcx: extended_decode_ctxt)
         -> typeck::vtable_origin {
         do self.read_enum(~"vtable_origin") {
             do self.read_enum_variant |i| {
-                alt check i {
+                match check i {
                   0u => {
                     typeck::vtable_static(
                         do self.read_enum_variant_arg(0u) {
@@ -992,7 +992,7 @@ fn new_int_alist<B: copy>() -> alist<int, B> {
             return {eq_fn: eq_int, mut data: ~[]};
         }
     });
-    alt (item_out, item_exp) {
+    match (item_out, item_exp) {
       (ast::ii_item(item_out), ast::ii_item(item_exp)) => {
         assert pprust::item_to_str(item_out) == pprust::item_to_str(item_exp);
       }
index 3f7ddd94eed17635ec5d0f9c6c046db0c386c86f..2896ad32d6ae8cd0fd2a4b93bd12e224fa962ce6 100644 (file)
@@ -13,7 +13,7 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) {
 
 fn visit_expr(ex: @expr, cx: ctx, v: visit::vt<ctx>) {
     if !cx.allow_block {
-        alt ty::get(ty::expr_ty(cx.tcx, ex)).struct {
+        match ty::get(ty::expr_ty(cx.tcx, ex)).struct {
           ty::ty_fn({proto: p, _}) if is_blockish(p) => {
             cx.tcx.sess.span_err(ex.span,
                ~"expressions with stack closure type \
@@ -23,7 +23,7 @@ fn visit_expr(ex: @expr, cx: ctx, v: visit::vt<ctx>) {
         }
     }
     let outer = cx.allow_block;
-    alt ex.node {
+    match ex.node {
       expr_call(f, args, _) => {
         cx.allow_block = true;
         v.visit_expr(f, cx, v);
index 4e9f770232f12baa0c7db993cfd0e423427cb8fc..3df0cb3b25e515bfa400380a9df39c9dd3288ff7 100644 (file)
@@ -91,7 +91,7 @@
 but its type can change:
 
     let mut x = some(5);
-    alt x {
+    match x {
       some(ref y) => { ... }
       none => { ... }
     }
 like the following:
 
     let mut x = ~some(5);
-    alt x {
+    match x {
       ~some(ref y) => { ... }
       ~none => { ... }
     }
@@ -343,7 +343,7 @@ enum categorization {
     cat_stack_upvar(cmt),           // upvar in stack closure
     cat_deref(cmt, uint, ptr_kind), // deref of a ptr
     cat_comp(cmt, comp_kind),       // adjust to locate an internal component
-    cat_discr(cmt, ast::node_id),   // alt discriminant (see preserve())
+    cat_discr(cmt, ast::node_id),   // match discriminant (see preserve())
 }
 
 // different kinds of pointers:
@@ -456,7 +456,7 @@ fn ty<N: ast_node>(node: N) -> ty::t {
 
 impl error_methods for borrowck_ctxt {
     fn report_if_err(bres: bckres<()>) {
-        alt bres {
+        match bres {
           ok(()) => (),
           err(e) => self.report(e)
         }
@@ -478,7 +478,7 @@ fn span_note(s: span, m: ~str) {
     }
 
     fn add_to_mutbl_map(cmt: cmt) {
-        alt cmt.cat {
+        match cmt.cat {
           cat_local(id) | cat_arg(id) => {
             self.mutbl_map.insert(id, ());
           }
@@ -492,7 +492,7 @@ fn add_to_mutbl_map(cmt: cmt) {
 
 impl to_str_methods for borrowck_ctxt {
     fn cat_to_repr(cat: categorization) -> ~str {
-        alt cat {
+        match cat {
           cat_special(sk_method) => ~"method",
           cat_special(sk_static_item) => ~"static_item",
           cat_special(sk_self) => ~"self",
@@ -514,7 +514,7 @@ fn cat_to_repr(cat: categorization) -> ~str {
     }
 
     fn mut_to_str(mutbl: ast::mutability) -> ~str {
-        alt mutbl {
+        match mutbl {
           m_mutbl => ~"mutable",
           m_const => ~"const",
           m_imm => ~"immutable"
@@ -522,7 +522,7 @@ fn mut_to_str(mutbl: ast::mutability) -> ~str {
     }
 
     fn ptr_sigil(ptr: ptr_kind) -> ~str {
-        alt ptr {
+        match ptr {
           uniq_ptr => ~"~",
           gc_ptr => ~"@",
           region_ptr(_) => ~"&",
@@ -531,7 +531,7 @@ fn ptr_sigil(ptr: ptr_kind) -> ~str {
     }
 
     fn comp_to_repr(comp: comp_kind) -> ~str {
-        alt comp {
+        match comp {
           comp_field(fld, _) => *fld,
           comp_index(*) => ~"[]",
           comp_tuple => ~"()",
@@ -540,7 +540,7 @@ fn comp_to_repr(comp: comp_kind) -> ~str {
     }
 
     fn lp_to_str(lp: @loan_path) -> ~str {
-        alt *lp {
+        match *lp {
           lp_local(node_id) => {
             fmt!{"local(%d)", node_id}
           }
@@ -569,7 +569,7 @@ fn cmt_to_repr(cmt: cmt) -> ~str {
 
     fn cmt_to_str(cmt: cmt) -> ~str {
         let mut_str = self.mut_to_str(cmt.mutbl);
-        alt cmt.cat {
+        match cmt.cat {
           cat_special(sk_method) => ~"method",
           cat_special(sk_static_item) => ~"static item",
           cat_special(sk_self) => ~"self reference",
@@ -589,7 +589,7 @@ fn cmt_to_str(cmt: cmt) -> ~str {
           cat_comp(_, comp_tuple) => ~"tuple content",
           cat_comp(_, comp_variant(_)) => ~"enum content",
           cat_comp(_, comp_index(t, _)) => {
-            alt ty::get(t).struct {
+            match ty::get(t).struct {
               ty::ty_evec(*) => mut_str + ~" vec content",
               ty::ty_estr(*) => mut_str + ~" str content",
               _ => mut_str + ~" indexed content"
@@ -602,7 +602,7 @@ fn cmt_to_str(cmt: cmt) -> ~str {
     }
 
     fn bckerr_code_to_str(code: bckerr_code) -> ~str {
-        alt code {
+        match code {
           err_mutbl(req, act) => {
             fmt!{"creating %s alias to aliasable, %s memory",
                  self.mut_to_str(req), self.mut_to_str(act)}
@@ -644,7 +644,7 @@ fn region_to_str(r: ty::region) -> ~str {
 // mutability can be "overridden" if the component is embedded in a
 // mutable structure.
 fn inherent_mutability(ck: comp_kind) -> mutability {
-    alt ck {
+    match ck {
       comp_tuple | comp_variant(_)        => m_imm,
       comp_field(_, m) | comp_index(_, m) => m
     }
index f3d39aa91efb40ede12528055cde7d86e2f19774..e113c957c15baa90db411547047535b2539393fb 100644 (file)
@@ -43,7 +43,7 @@
 // derefable (we model an index as the combination of a deref and then a
 // pointer adjustment).
 fn opt_deref_kind(t: ty::t) -> option<deref_kind> {
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_uniq(*) |
       ty::ty_evec(_, ty::vstore_uniq) |
       ty::ty_estr(ty::vstore_uniq) => {
@@ -83,7 +83,7 @@ fn opt_deref_kind(t: ty::t) -> option<deref_kind> {
 }
 
 fn deref_kind(tcx: ty::ctxt, t: ty::t) -> deref_kind {
-    alt opt_deref_kind(t) {
+    match opt_deref_kind(t) {
       some(k) => k,
       none => {
         tcx.sess.bug(
@@ -97,7 +97,7 @@ impl public_methods for borrowck_ctxt {
     fn cat_borrow_of_expr(expr: @ast::expr) -> cmt {
         // a borrowed expression must be either an @, ~, or a @vec, ~vec
         let expr_ty = ty::expr_ty(self.tcx, expr);
-        alt ty::get(expr_ty).struct {
+        match ty::get(expr_ty).struct {
           ty::ty_evec(*) | ty::ty_estr(*) => {
             self.cat_index(expr, expr)
           }
@@ -128,14 +128,14 @@ fn cat_expr(expr: @ast::expr) -> cmt {
 
         let tcx = self.tcx;
         let expr_ty = tcx.ty(expr);
-        alt expr.node {
+        match expr.node {
           ast::expr_unary(ast::deref, e_base) => {
             if self.method_map.contains_key(expr.id) {
                 return self.cat_rvalue(expr, expr_ty);
             }
 
             let base_cmt = self.cat_expr(e_base);
-            alt self.cat_deref(expr, base_cmt, 0u, true) {
+            match self.cat_deref(expr, base_cmt, 0u, true) {
               some(cmt) => return cmt,
               none => {
                 tcx.sess.span_bug(
@@ -190,7 +190,7 @@ fn cat_def(id: ast::node_id,
                span: span,
                expr_ty: ty::t,
                def: ast::def) -> cmt {
-        alt def {
+        match def {
           ast::def_fn(*) | ast::def_mod(_) |
           ast::def_foreign_mod(_) | ast::def_const(_) |
           ast::def_use(_) | ast::def_variant(*) |
@@ -208,7 +208,7 @@ fn cat_def(id: ast::node_id,
 
             // m: mutability of the argument
             // lp: loan path, must be none for aliasable things
-            let {m,lp} = alt ty::resolved_mode(self.tcx, mode) {
+            let {m,lp} = match ty::resolved_mode(self.tcx, mode) {
               ast::by_mutbl_ref => {
                 {m: m_mutbl, lp: none}
               }
@@ -241,7 +241,7 @@ fn cat_def(id: ast::node_id,
           ast::def_upvar(upvid, inner, fn_node_id) => {
             let ty = ty::node_id_to_type(self.tcx, fn_node_id);
             let proto = ty::ty_fn_proto(ty);
-            alt proto {
+            match proto {
               ast::proto_block => {
                 let upcmt = self.cat_def(id, span, expr_ty, *inner);
                 @{id:id, span:span,
@@ -311,7 +311,7 @@ fn cat_discr(cmt: cmt, alt_id: ast::node_id) -> cmt {
     /// or if the container is mutable.
     fn inherited_mutability(base_m: ast::mutability,
                           comp_m: ast::mutability) -> ast::mutability {
-        alt comp_m {
+        match comp_m {
           m_imm => {base_m}  // imm: as mutable as the container
           m_mutbl | m_const => {comp_m}
         }
@@ -319,7 +319,7 @@ fn inherited_mutability(base_m: ast::mutability,
 
     fn cat_field<N:ast_node>(node: N, base_cmt: cmt,
                              f_name: ast::ident) -> cmt {
-        let f_mutbl = alt field_mutbl(self.tcx, base_cmt.ty, f_name) {
+        let f_mutbl = match field_mutbl(self.tcx, base_cmt.ty, f_name) {
           some(f_mutbl) => f_mutbl,
           none => {
             self.tcx.sess.span_bug(
@@ -339,7 +339,7 @@ fn cat_field<N:ast_node>(node: N, base_cmt: cmt,
     fn cat_deref<N:ast_node>(node: N, base_cmt: cmt, derefs: uint,
                              expl: bool) -> option<cmt> {
         do ty::deref(self.tcx, base_cmt.ty, expl).map |mt| {
-            alt deref_kind(self.tcx, base_cmt.ty) {
+            match deref_kind(self.tcx, base_cmt.ty) {
               deref_ptr(ptr) => {
                 let lp = do base_cmt.lp.chain |l| {
                     // Given that the ptr itself is loanable, we can
@@ -347,7 +347,7 @@ fn cat_deref<N:ast_node>(node: N, base_cmt: cmt, derefs: uint,
                     // the only way to reach the data they point at.
                     // Other ptr types admit aliases and are therefore
                     // not loanable.
-                    alt ptr {
+                    match ptr {
                       uniq_ptr => {some(@lp_deref(l, ptr))}
                       gc_ptr | region_ptr(_) | unsafe_ptr => {none}
                     }
@@ -355,7 +355,7 @@ fn cat_deref<N:ast_node>(node: N, base_cmt: cmt, derefs: uint,
 
                 // for unique ptrs, we inherit mutability from the
                 // owning reference.
-                let m = alt ptr {
+                let m = match ptr {
                   uniq_ptr => {
                     self.inherited_mutability(base_cmt.mutbl, mt.mutbl)
                   }
@@ -383,7 +383,7 @@ fn cat_deref<N:ast_node>(node: N, base_cmt: cmt, derefs: uint,
     fn cat_index(expr: @ast::expr, base: @ast::expr) -> cmt {
         let base_cmt = self.cat_autoderef(base);
 
-        let mt = alt ty::index(self.tcx, base_cmt.ty) {
+        let mt = match ty::index(self.tcx, base_cmt.ty) {
           some(mt) => mt,
           none => {
             self.tcx.sess.span_bug(
@@ -393,18 +393,18 @@ fn cat_index(expr: @ast::expr, base: @ast::expr) -> cmt {
           }
         };
 
-        return alt deref_kind(self.tcx, base_cmt.ty) {
+        return match deref_kind(self.tcx, base_cmt.ty) {
           deref_ptr(ptr) => {
             // (a) the contents are loanable if the base is loanable
             // and this is a *unique* vector
-            let deref_lp = alt ptr {
+            let deref_lp = match ptr {
               uniq_ptr => {base_cmt.lp.map(|lp| @lp_deref(lp, uniq_ptr))}
               _ => {none}
             };
 
             // (b) for unique ptrs, we inherit mutability from the
             // owning reference.
-            let m = alt ptr {
+            let m = match ptr {
               uniq_ptr => {
                 self.inherited_mutability(base_cmt.mutbl, mt.mutbl)
               }
@@ -465,7 +465,7 @@ fn cat_autoderef(base: @ast::expr) -> cmt {
         let mut ctr = 0u;
         loop {
             ctr += 1u;
-            alt self.cat_deref(base, cmt, ctr, false) {
+            match self.cat_deref(base, cmt, ctr, false) {
               none => return cmt,
               some(cmt1) => cmt = cmt1
             }
@@ -477,7 +477,7 @@ fn field_mutbl(tcx: ty::ctxt,
                base_ty: ty::t,
                f_name: ast::ident) -> option<ast::mutability> {
     // Need to refactor so that records/class fields can be treated uniformly.
-    alt ty::get(base_ty).struct {
+    match ty::get(base_ty).struct {
       ty::ty_rec(fields) => {
         for fields.each |f| {
             if f.ident == f_name {
@@ -488,7 +488,7 @@ fn field_mutbl(tcx: ty::ctxt,
       ty::ty_class(did, substs) => {
         for ty::lookup_class_fields(tcx, did).each |fld| {
             if fld.ident == f_name {
-                let m = alt fld.mutability {
+                let m = match fld.mutability {
                   ast::class_mutable => ast::m_mutbl,
                   ast::class_immutable => ast::m_imm
                 };
index f84fca5c19748dce9a559cb6c363eed96756ae4c..9b7d0e037c1264db55d6302e9130ed2169a541e6 100644 (file)
@@ -64,14 +64,14 @@ impl methods for assignment_type {
     fn checked_by_liveness() -> bool {
         // the liveness pass guarantees that immutable local variables
         // are only assigned once; but it doesn't consider &mut
-        alt self {
+        match self {
           at_straight_up => true,
           at_swap => true,
           at_mutbl_ref => false
         }
     }
     fn ing_form(desc: ~str) -> ~str {
-        alt self {
+        match self {
           at_straight_up => ~"assigning to " + desc,
           at_swap => ~"swapping to and from " + desc,
           at_mutbl_ref => ~"taking mut reference to " + desc
@@ -83,7 +83,7 @@ impl methods for check_loan_ctxt {
     fn tcx() -> ty::ctxt { self.bccx.tcx }
 
     fn purity(scope_id: ast::node_id) -> option<purity_cause> {
-        let default_purity = alt self.declared_purity {
+        let default_purity = match self.declared_purity {
           // an unsafe declaration overrides all
           ast::unsafe_fn => return none,
 
@@ -101,12 +101,12 @@ fn purity(scope_id: ast::node_id) -> option<purity_cause> {
         let region_map = self.tcx().region_map;
         let pure_map = self.req_maps.pure_map;
         loop {
-            alt pure_map.find(scope_id) {
+            match pure_map.find(scope_id) {
               none => (),
               some(e) => return some(pc_cmt(e))
             }
 
-            alt region_map.find(scope_id) {
+            match region_map.find(scope_id) {
               none => return default_purity,
               some(next_scope_id) => scope_id = next_scope_id
             }
@@ -128,7 +128,7 @@ fn walk_loans(scope_id: ast::node_id,
                 }
             }
 
-            alt region_map.find(scope_id) {
+            match region_map.find(scope_id) {
               none => return,
               some(next_scope_id) => scope_id = next_scope_id,
             }
@@ -173,9 +173,9 @@ fn check_pure_callee_or_arg(pc: purity_cause,
         // (c) B is a pure fn;
         // (d) B is not a fn.
 
-        alt opt_expr {
+        match opt_expr {
           some(expr) => {
-            alt expr.node {
+            match expr.node {
               ast::expr_path(_) if pc == pc_pure_fn => {
                 let def = self.tcx().def_map.get(expr.id);
                 let did = ast_util::def_id_of_def(def);
@@ -198,9 +198,9 @@ fn check_pure_callee_or_arg(pc: purity_cause,
         }
 
         let callee_ty = ty::node_id_to_type(tcx, callee_id);
-        alt ty::get(callee_ty).struct {
+        match ty::get(callee_ty).struct {
           ty::ty_fn(fn_ty) => {
-            alt fn_ty.purity {
+            match fn_ty.purity {
               ast::pure_fn => return, // case (c) above
               ast::impure_fn | ast::unsafe_fn | ast::extern_fn => {
                 self.report_purity_error(
@@ -219,14 +219,14 @@ fn check_pure_callee_or_arg(pc: purity_cause,
     fn is_stack_closure(id: ast::node_id) -> bool {
         let fn_ty = ty::node_id_to_type(self.tcx(), id);
         let proto = ty::ty_fn_proto(fn_ty);
-        alt proto {
+        match proto {
           ast::proto_block => true,
           ast::proto_bare | ast::proto_uniq | ast::proto_box => false
         }
     }
 
     fn is_allowed_pure_arg(expr: @ast::expr) -> bool {
-        return alt expr.node {
+        return match expr.node {
           ast::expr_path(_) => {
             let def = self.tcx().def_map.get(expr.id);
             let did = ast_util::def_id_of_def(def);
@@ -241,7 +241,7 @@ fn is_allowed_pure_arg(expr: @ast::expr) -> bool {
     }
 
     fn check_for_conflicting_loans(scope_id: ast::node_id) {
-        let new_loanss = alt self.req_maps.req_loan_map.find(scope_id) {
+        let new_loanss = match self.req_maps.req_loan_map.find(scope_id) {
             none => return,
             some(loanss) => loanss
         };
@@ -251,7 +251,7 @@ fn check_for_conflicting_loans(scope_id: ast::node_id) {
             for (*new_loanss).each |new_loans| {
                 for (*new_loans).each |new_loan| {
                     if old_loan.lp != new_loan.lp { again; }
-                    alt (old_loan.mutbl, new_loan.mutbl) {
+                    match (old_loan.mutbl, new_loan.mutbl) {
                       (m_const, _) | (_, m_const) |
                       (m_mutbl, m_mutbl) | (m_imm, m_imm) => {
                         /*ok*/
@@ -276,16 +276,16 @@ fn check_for_conflicting_loans(scope_id: ast::node_id) {
     }
 
     fn is_local_variable(cmt: cmt) -> bool {
-        alt cmt.cat {
+        match cmt.cat {
           cat_local(_) => true,
           _ => false
         }
     }
 
     fn is_self_field(cmt: cmt) -> bool {
-        alt cmt.cat {
+        match cmt.cat {
           cat_comp(cmt_base, comp_field(*)) => {
-            alt cmt_base.cat {
+            match cmt_base.cat {
               cat_special(sk_self) => true,
               _ => false
             }
@@ -307,7 +307,7 @@ fn check_assignment(at: assignment_type, ex: @ast::expr) {
             // liveness guarantees that immutable local variables
             // are only assigned once
         } else {
-            alt cmt.mutbl {
+            match cmt.mutbl {
               m_mutbl => { /*ok*/ }
               m_const | m_imm => {
                 self.bccx.span_err(
@@ -321,7 +321,7 @@ fn check_assignment(at: assignment_type, ex: @ast::expr) {
         // if this is a pure function, only loan-able state can be
         // assigned, because it is uniquely tied to this function and
         // is not visible from the outside
-        alt self.purity(ex.id) {
+        match self.purity(ex.id) {
           none => (),
           some(pc) => {
             if cmt.lp.is_none() {
@@ -352,7 +352,7 @@ fn check_for_loan_conflicting_with_assignment(
         lp: @loan_path) {
 
         for self.walk_loans_of(ex.id, lp) |loan| {
-            alt loan.mutbl {
+            match loan.mutbl {
               m_mutbl | m_const => { /*ok*/ }
               m_imm => {
                 self.bccx.span_err(
@@ -375,7 +375,7 @@ fn check_for_loan_conflicting_with_assignment(
         //    let mut x = {f: some(3)};
         //    let y = &x; // x loaned out as immutable
         //    x.f = none; // changes type of y.f, which appears to be imm
-        alt *lp {
+        match *lp {
           lp_comp(lp_base, ck) if inherent_mutability(ck) != m_mutbl => {
             self.check_for_loan_conflicting_with_assignment(
                 at, ex, cmt, lp_base);
@@ -385,7 +385,7 @@ fn check_for_loan_conflicting_with_assignment(
     }
 
     fn report_purity_error(pc: purity_cause, sp: span, msg: ~str) {
-        alt pc {
+        match pc {
           pc_pure_fn => {
             self.tcx().sess.span_err(
                 sp,
@@ -414,7 +414,7 @@ fn check_move_out_from_cmt(cmt: cmt) {
         debug!{"check_move_out_from_cmt(cmt=%s)",
                self.bccx.cmt_to_repr(cmt)};
 
-        alt cmt.cat {
+        match cmt.cat {
           // Rvalues, locals, and arguments can be moved:
           cat_rvalue | cat_local(_) | cat_arg(_) => {}
 
@@ -437,7 +437,7 @@ fn check_move_out_from_cmt(cmt: cmt) {
         self.bccx.add_to_mutbl_map(cmt);
 
         // check for a conflicting loan:
-        let lp = alt cmt.lp {
+        let lp = match cmt.lp {
           none => return,
           some(lp) => lp
         };
@@ -459,7 +459,7 @@ fn check_move_out_from_cmt(cmt: cmt) {
     // safe to consider the use a last_use.
     fn check_last_use(expr: @ast::expr) {
         let cmt = self.bccx.cat_expr(expr);
-        let lp = alt cmt.lp {
+        let lp = match cmt.lp {
           none => return,
           some(lp) => lp
         };
@@ -476,7 +476,7 @@ fn check_call(expr: @ast::expr,
                   callee_id: ast::node_id,
                   callee_span: span,
                   args: ~[@ast::expr]) {
-        alt self.purity(expr.id) {
+        match self.purity(expr.id) {
           none => {}
           some(pc) => {
             self.check_pure_callee_or_arg(
@@ -491,7 +491,7 @@ fn check_call(expr: @ast::expr,
             ty::ty_fn_args(
                 ty::node_id_to_type(self.tcx(), callee_id));
         do vec::iter2(args, arg_tys) |arg, arg_ty| {
-            alt ty::resolved_mode(self.tcx(), arg_ty.mode) {
+            match ty::resolved_mode(self.tcx(), arg_ty.mode) {
               ast::by_move => {
                 self.check_move_out(arg);
               }
@@ -521,7 +521,7 @@ fn check_loans_in_fn(fk: visit::fn_kind, decl: ast::fn_decl, body: ast::blk,
                 // of otherwise immutable fields and typestate wouldn't be
                 // able to "see" into those functions anyway, so it
                 // wouldn't be very helpful.
-                alt fk {
+                match fk {
                   visit::fk_ctor(*) => {
                     self.in_ctor = true;
                     self.declared_purity = decl.purity;
@@ -551,7 +551,7 @@ fn check_loans_in_fn(fk: visit::fn_kind, decl: ast::fn_decl, body: ast::blk,
 fn check_loans_in_local(local: @ast::local,
                         &&self: check_loan_ctxt,
                         vt: visit::vt<check_loan_ctxt>) {
-    alt local.node.init {
+    match local.node.init {
       some({op: ast::init_move, expr: expr}) => {
         self.check_move_out(expr);
       }
@@ -565,7 +565,7 @@ fn check_loans_in_expr(expr: @ast::expr,
                        vt: visit::vt<check_loan_ctxt>) {
     self.check_for_conflicting_loans(expr.id);
 
-    alt expr.node {
+    match expr.node {
       ast::expr_path(*) if self.bccx.last_use_map.contains_key(expr.id) => {
         self.check_last_use(expr);
       }
@@ -601,7 +601,7 @@ fn check_loans_in_expr(expr: @ast::expr,
         }
       }
       ast::expr_addr_of(mutbl, base) => {
-        alt mutbl {
+        match mutbl {
           m_const => { /*all memory is const*/ }
           m_mutbl => {
             // If we are taking an &mut ptr, make sure the memory
@@ -645,7 +645,7 @@ fn check_loans_in_block(blk: ast::blk,
     do save_and_restore(self.declared_purity) {
         self.check_for_conflicting_loans(blk.node.id);
 
-        alt blk.node.rules {
+        match blk.node.rules {
           ast::default_blk => {
           }
           ast::unchecked_blk => {
index 88e329f63c0d79a2ead3bc5dff397bccc9fa56fc..86455652faa087b2262178a05ecf39625c87b840 100644 (file)
@@ -70,7 +70,7 @@ fn req_loans_in_fn(fk: visit::fn_kind,
     let old_root_ub = self.root_ub;
     self.root_ub = body.node.id;
 
-    alt fk {
+    match fk {
       visit::fk_anon(*) | visit::fk_fn_block(*) => {}
       visit::fk_item_fn(*) | visit::fk_method(*) |
       visit::fk_ctor(*) | visit::fk_dtor(*) => {
@@ -99,14 +99,14 @@ fn req_loans_in_expr(ex: @ast::expr,
     }
 
     // Special checks for various kinds of expressions:
-    alt ex.node {
+    match ex.node {
       ast::expr_addr_of(mutbl, base) => {
         let base_cmt = self.bccx.cat_expr(base);
 
         // make sure that the thing we are pointing out stays valid
         // for the lifetime `scope_r` of the resulting ptr:
         let scope_r =
-            alt check ty::get(tcx.ty(ex)).struct {
+            match check ty::get(tcx.ty(ex)).struct {
               ty::ty_rptr(r, _) => r
             };
         self.guarantee_valid(base_cmt, mutbl, scope_r);
@@ -117,7 +117,7 @@ fn req_loans_in_expr(ex: @ast::expr,
         let arg_tys = ty::ty_fn_args(ty::expr_ty(self.tcx(), f));
         let scope_r = ty::re_scope(ex.id);
         do vec::iter2(args, arg_tys) |arg, arg_ty| {
-            alt ty::resolved_mode(self.tcx(), arg_ty.mode) {
+            match ty::resolved_mode(self.tcx(), arg_ty.mode) {
               ast::by_mutbl_ref => {
                 let arg_cmt = self.bccx.cat_expr(arg);
                 self.guarantee_valid(arg_cmt, m_mutbl, scope_r);
@@ -151,7 +151,7 @@ fn req_loans_in_expr(ex: @ast::expr,
                 // immutable (whereas something like {f:int} would be
                 // fine).
                 //
-                alt opt_deref_kind(arg_ty.ty) {
+                match opt_deref_kind(arg_ty.ty) {
                   some(deref_ptr(region_ptr(_))) |
                   some(deref_ptr(unsafe_ptr)) => {
                     /* region pointers are (by induction) guaranteed */
@@ -265,7 +265,7 @@ fn guarantee_valid(cmt: cmt,
                region_to_str(self.tcx(), scope_r)};
         let _i = indenter();
 
-        alt cmt.lp {
+        match cmt.lp {
           // If this expression is a loanable path, we MUST take out a
           // loan.  This is somewhat non-obvious.  You might think,
           // for example, that if we have an immutable local variable
@@ -277,11 +277,11 @@ fn guarantee_valid(cmt: cmt,
           // it within that scope, the loan will be detected and an
           // error will be reported.
           some(_) => {
-            alt self.bccx.loan(cmt, scope_r, req_mutbl) {
+            match self.bccx.loan(cmt, scope_r, req_mutbl) {
               err(e) => { self.bccx.report(e); }
               ok(loans) if loans.len() == 0 => {}
               ok(loans) => {
-                alt scope_r {
+                match scope_r {
                   ty::re_scope(scope_id) => {
                     self.add_loans(scope_id, loans);
 
@@ -325,7 +325,7 @@ fn guarantee_valid(cmt: cmt,
                 }
             };
 
-            alt result {
+            match result {
               ok(pc_ok) => {
                 // we were able guarantee the validity of the ptr,
                 // perhaps by rooting or because it is immutably
@@ -335,7 +335,7 @@ fn guarantee_valid(cmt: cmt,
               ok(pc_if_pure(e)) => {
                 // we are only able to guarantee the validity if
                 // the scope is pure
-                alt scope_r {
+                match scope_r {
                   ty::re_scope(pure_id) => {
                     // if the scope is some block/expr in the fn,
                     // then just require that this scope be pure
@@ -374,7 +374,7 @@ fn guarantee_valid(cmt: cmt,
     // mutable memory.
     fn check_mutbl(req_mutbl: ast::mutability,
                    cmt: cmt) -> bckres<preserve_condition> {
-        alt (req_mutbl, cmt.mutbl) {
+        match (req_mutbl, cmt.mutbl) {
           (m_const, _) |
           (m_imm, m_imm) |
           (m_mutbl, m_mutbl) => {
@@ -397,7 +397,7 @@ fn check_mutbl(req_mutbl: ast::mutability,
     }
 
     fn add_loans(scope_id: ast::node_id, loans: @dvec<loan>) {
-        alt self.req_maps.req_loan_map.find(scope_id) {
+        match self.req_maps.req_loan_map.find(scope_id) {
           some(l) => {
             (*l).push(loans);
           }
@@ -432,7 +432,7 @@ fn gather_pat(cmt: cmt, pat: @ast::pat,
         // To see what I mean about ids etc, consider:
         //
         //     let x = @@3;
-        //     alt x {
+        //     match x {
         //       @@y { ... }
         //     }
         //
@@ -450,7 +450,7 @@ fn gather_pat(cmt: cmt, pat: @ast::pat,
         let _i = indenter();
 
         let tcx = self.tcx();
-        alt pat.node {
+        match pat.node {
           ast::pat_wild => {
             // _
           }
@@ -460,7 +460,7 @@ fn gather_pat(cmt: cmt, pat: @ast::pat,
           }
           ast::pat_enum(_, some(subpats)) => {
             // variant(x, y, z)
-            let enum_did = alt self.bccx.tcx.def_map
+            let enum_did = match self.bccx.tcx.def_map
 .find(pat.id) {
               some(ast::def_variant(enum_did, _)) => enum_did,
               e => tcx.sess.span_bug(pat.span,
@@ -523,7 +523,7 @@ fn gather_pat(cmt: cmt, pat: @ast::pat,
 
           ast::pat_box(subpat) | ast::pat_uniq(subpat) => {
             // @p1, ~p1
-            alt self.bccx.cat_deref(subpat, cmt, 0u, true) {
+            match self.bccx.cat_deref(subpat, cmt, 0u, true) {
               some(subcmt) => {
                 self.gather_pat(subcmt, subpat, arm_id, alt_id);
               }
index 5479afd10b764e179babadcdb644d21e487ff5cf..59e3cd183fc578da888171e666b718b3723bb57b 100644 (file)
@@ -12,7 +12,7 @@ fn loan(cmt: cmt,
         let lc = loan_ctxt_(@{bccx: self,
                               scope_region: scope_region,
                               loans: @dvec()});
-        alt lc.loan(cmt, mutbl) {
+        match lc.loan(cmt, mutbl) {
           ok(()) => {ok(lc.loans)}
           err(e) => {err(e)}
         }
@@ -70,7 +70,7 @@ fn loan(cmt: cmt, req_mutbl: ast::mutability) -> bckres<()> {
                 ~"loan() called with non-lendable value");
         }
 
-        alt cmt.cat {
+        match cmt.cat {
           cat_binding(_) | cat_rvalue | cat_special(_) => {
             // should never be loanable
             self.bccx.tcx.sess.span_bug(
@@ -131,7 +131,7 @@ fn loan(cmt: cmt, req_mutbl: ast::mutability) -> bckres<()> {
     fn loan_stable_comp(cmt: cmt,
                         cmt_base: cmt,
                         req_mutbl: ast::mutability) -> bckres<()> {
-        let base_mutbl = alt req_mutbl {
+        let base_mutbl = match req_mutbl {
           m_imm => m_imm,
           m_const | m_mutbl => m_const
         };
index 568030c85b5c71491b583479f67a02440a265674..a586aca24f3de3c383a05dc89e4a46d27ced4e44 100644 (file)
@@ -14,7 +14,7 @@ impl public_methods for preserve_condition {
     // combines two preservation conditions such that if either of
     // them requires purity, the result requires purity
     fn combine(pc: preserve_condition) -> preserve_condition {
-        alt self {
+        match self {
           pc_ok => {pc}
           pc_if_pure(e) => {self}
         }
@@ -63,7 +63,7 @@ fn preserve(cmt: cmt) -> bckres<preserve_condition> {
                self.root_managed_data};
         let _i = indenter();
 
-        alt cmt.cat {
+        match cmt.cat {
           cat_special(sk_self) | cat_special(sk_heap_upvar) => {
             self.compare_scope(cmt, ty::re_scope(self.item_ub))
           }
@@ -160,7 +160,7 @@ fn preserve(cmt: cmt) -> bckres<preserve_condition> {
             if base.mutbl == m_imm {
                 let non_rooting_ctxt =
                     preserve_ctxt({root_managed_data: false with **self});
-                alt (&non_rooting_ctxt).preserve(base) {
+                match (&non_rooting_ctxt).preserve(base) {
                   ok(pc_ok) => {
                     ok(pc_ok)
                   }
@@ -191,7 +191,7 @@ fn preserve(cmt: cmt) -> bckres<preserve_condition> {
             // As an example, consider this scenario:
             //
             //    let mut x = @some(3);
-            //    alt *x { some(y) {...} none {...} }
+            //    match *x { some(y) {...} none {...} }
             //
             // Technically, the value `x` need only be rooted
             // in the `some` arm.  However, we evaluate `x` in trans
@@ -201,7 +201,7 @@ fn preserve(cmt: cmt) -> bckres<preserve_condition> {
             // As a second example, consider *this* scenario:
             //
             //    let x = @mut @some(3);
-            //    alt x { @@some(y) {...} @@none {...} }
+            //    match x { @@some(y) {...} @@none {...} }
             //
             // Here again, `x` need only be rooted in the `some` arm.
             // In this case, the value which needs to be rooted is
@@ -220,7 +220,7 @@ fn preserve(cmt: cmt) -> bckres<preserve_condition> {
             // also yielded suboptimal results for patterns like:
             //
             //    let x = @mut @...;
-            //    alt x { @@some_variant(y) | @@some_other_variant(y) {...} }
+            //    match x { @@some_variant(y) | @@some_other_variant(y) =>
             //
             // The reason is that we would root the value once for
             // each pattern and not once per arm.  This is also easily
@@ -234,7 +234,7 @@ fn preserve(cmt: cmt) -> bckres<preserve_condition> {
 
             // current scope must be the arm, which is always a child of alt:
             assert {
-                alt check self.scope_region {
+                match check self.scope_region {
                   ty::re_scope(arm_id) => {
                     self.tcx().region_map.get(arm_id) == alt_id
                   }
@@ -259,11 +259,11 @@ fn require_imm(cmt: cmt,
                    code: bckerr_code) -> bckres<preserve_condition> {
         // Variant contents and unique pointers: must be immutably
         // rooted to a preserved address.
-        alt self.preserve(cmt_base) {
+        match self.preserve(cmt_base) {
           // the base is preserved, but if we are not mutable then
           // purity is required
           ok(pc_ok) => {
-            alt cmt_base.mutbl {
+            match cmt_base.mutbl {
               m_mutbl | m_const => {
                 ok(pc_if_pure({cmt:cmt, code:code}))
               }
@@ -322,7 +322,7 @@ fn attempt_root(cmt: cmt, base: cmt,
         }
 
         let root_region = ty::re_scope(self.root_ub);
-        alt self.scope_region {
+        match self.scope_region {
           // we can only root values if the desired region is some concrete
           // scope within the fn body
           ty::re_scope(scope_id) => {
index 1af377e1ba26b4b49162336eb37e036642eaa7ed..266c31b2805da12c3786e96f51409c1db55c8e8e 100644 (file)
@@ -101,14 +101,14 @@ fn compute_capture_vars(tcx: ty::ctxt,
     // now go through anything that is referenced but was not explicitly
     // named and add that
 
-    let implicit_mode = alt fn_proto {
+    let implicit_mode = match fn_proto {
       ast::proto_block => cap_ref,
       ast::proto_bare | ast::proto_box | ast::proto_uniq => cap_copy
     };
 
     do vec::iter(*freevars) |fvar| {
         let fvar_def_id = ast_util::def_id_of_def(fvar.def).node;
-        alt cap_map.find(fvar_def_id) {
+        match cap_map.find(fvar_def_id) {
           option::some(_) => { /* was explicitly named, do nothing */ }
           option::none => {
             cap_map.insert(fvar_def_id, {def:fvar.def,
index 28fbfacb78ccae53ab6c289678dcd58e9b2dc55d..7ccccbbcc07c3c0e104a92e9ae3cc8f18df08dc0 100644 (file)
@@ -22,7 +22,7 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) {
 
 fn check_expr(tcx: ty::ctxt, ex: @expr, &&s: (), v: visit::vt<()>) {
     visit::visit_expr(ex, s, v);
-    alt ex.node {
+    match ex.node {
       expr_alt(scrut, arms, mode) => {
         check_arms(tcx, arms);
         /* Check for exhaustiveness */
@@ -33,7 +33,7 @@ fn check_expr(tcx: ty::ctxt, ex: @expr, &&s: (), v: visit::vt<()>) {
                // Vacuously exhaustive
                return;
            }
-       alt ty::get(pat_ty).struct {
+       match ty::get(pat_ty).struct {
           ty_enum(did, _) => {
               if (*enum_variants(tcx, did)).is_empty() && arms.is_empty() {
 
@@ -58,7 +58,7 @@ fn check_arms(tcx: ty::ctxt, arms: ~[arm]) {
     for arms.each |arm| {
         for arm.pats.each |pat| {
             let v = ~[pat];
-            alt is_useful(tcx, seen, v) {
+            match is_useful(tcx, seen, v) {
               not_useful => {
                 tcx.sess.span_err(pat.span, ~"unreachable pattern");
               }
@@ -70,7 +70,7 @@ fn check_arms(tcx: ty::ctxt, arms: ~[arm]) {
 }
 
 fn raw_pat(p: @pat) -> @pat {
-    alt p.node {
+    match p.node {
       pat_ident(_, _, some(s)) => { raw_pat(s) }
       _ => { p }
     }
@@ -78,20 +78,20 @@ fn raw_pat(p: @pat) -> @pat {
 
 fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: ~[@pat]) {
     assert(pats.is_not_empty());
-    let ext = alt is_useful(tcx, vec::map(pats, |p| ~[p]), ~[wild()]) {
+    let ext = match is_useful(tcx, vec::map(pats, |p| ~[p]), ~[wild()]) {
       not_useful => return, // This is good, wildcard pattern isn't reachable
       useful_ => none,
       useful(ty, ctor) => {
-        alt ty::get(ty).struct {
+        match ty::get(ty).struct {
           ty::ty_bool => {
-            alt check ctor {
+            match check ctor {
               val(const_int(1i64)) => some(@~"true"),
               val(const_int(0i64)) => some(@~"false")
             }
           }
           ty::ty_enum(id, _) => {
-            let vid = alt check ctor { variant(id) => id };
-            alt check vec::find(*ty::enum_variants(tcx, id),
+            let vid = match check ctor { variant(id) => id };
+            match check vec::find(*ty::enum_variants(tcx, id),
                                 |v| v.id == vid) {
               some(v) => some(v.name)
             }
@@ -100,7 +100,7 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: ~[@pat]) {
         }
       }
     };
-    let msg = ~"non-exhaustive patterns" + alt ext {
+    let msg = ~"non-exhaustive patterns" + match ext {
       some(s) => ~": " + *s + ~" not covered",
       none => ~""
     };
@@ -134,19 +134,19 @@ enum ctor {
 fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful {
     if m.len() == 0u { return useful_; }
     if m[0].len() == 0u { return not_useful; }
-    let real_pat = alt vec::find(m, |r| r[0].id != 0) {
+    let real_pat = match vec::find(m, |r| r[0].id != 0) {
       some(r) => r[0], none => v[0]
     };
     let left_ty = if real_pat.id == 0 { ty::mk_nil(tcx) }
                   else { ty::node_id_to_type(tcx, real_pat.id) };
 
-    alt pat_ctor_id(tcx, v[0]) {
+    match pat_ctor_id(tcx, v[0]) {
       none => {
-        alt missing_ctor(tcx, m, left_ty) {
+        match missing_ctor(tcx, m, left_ty) {
           none => {
-            alt ty::get(left_ty).struct {
+            match ty::get(left_ty).struct {
               ty::ty_bool => {
-                alt is_useful_specialized(tcx, m, v, val(const_int(1i64)),
+                match is_useful_specialized(tcx, m, v, val(const_int(1i64)),
                                           0u, left_ty){
                   not_useful => {
                     is_useful_specialized(tcx, m, v, val(const_int(0i64)),
@@ -157,7 +157,7 @@ fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful {
               }
               ty::ty_enum(eid, _) => {
                 for (*ty::enum_variants(tcx, eid)).each |va| {
-                    alt is_useful_specialized(tcx, m, v, variant(va.id),
+                    match is_useful_specialized(tcx, m, v, variant(va.id),
                                               va.args.len(), left_ty) {
                       not_useful => (),
                       u => return u
@@ -172,7 +172,7 @@ fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful {
             }
           }
           some(ctor) => {
-            alt is_useful(tcx, vec::filter_map(m, |r| default(tcx, r) ),
+            match is_useful(tcx, vec::filter_map(m, |r| default(tcx, r) ),
                           vec::tail(v)) {
               useful_ => useful(left_ty, ctor),
               u => u
@@ -190,7 +190,9 @@ fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful {
 fn is_useful_specialized(tcx: ty::ctxt, m: matrix, v: ~[@pat], ctor: ctor,
                           arity: uint, lty: ty::t) -> useful {
     let ms = vec::filter_map(m, |r| specialize(tcx, r, ctor, arity, lty) );
-    alt is_useful(tcx, ms, option::get(specialize(tcx, v, ctor, arity, lty))){
+    let could_be_useful = is_useful(
+        tcx, ms, option::get(specialize(tcx, v, ctor, arity, lty)));
+    match could_be_useful {
       useful_ => useful(lty, ctor),
       u => u
     }
@@ -198,10 +200,10 @@ fn is_useful_specialized(tcx: ty::ctxt, m: matrix, v: ~[@pat], ctor: ctor,
 
 fn pat_ctor_id(tcx: ty::ctxt, p: @pat) -> option<ctor> {
     let pat = raw_pat(p);
-    alt pat.node {
+    match pat.node {
       pat_wild => { none }
       pat_ident(_, _, _) | pat_enum(_, _) => {
-        alt tcx.def_map.find(pat.id) {
+        match tcx.def_map.find(pat.id) {
           some(def_variant(_, id)) => some(variant(id)),
           _ => none
         }
@@ -218,10 +220,10 @@ fn pat_ctor_id(tcx: ty::ctxt, p: @pat) -> option<ctor> {
 
 fn is_wild(tcx: ty::ctxt, p: @pat) -> bool {
     let pat = raw_pat(p);
-    alt pat.node {
+    match pat.node {
       pat_wild => { true }
       pat_ident(_, _, _) => {
-        alt tcx.def_map.find(pat.id) {
+        match tcx.def_map.find(pat.id) {
           some(def_variant(_, _)) => { false }
           _ => { true }
         }
@@ -231,7 +233,7 @@ fn is_wild(tcx: ty::ctxt, p: @pat) -> bool {
 }
 
 fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> option<ctor> {
-    alt ty::get(left_ty).struct {
+    match ty::get(left_ty).struct {
       ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_tup(_) | ty::ty_rec(_) => {
         for m.each |r| {
             if !is_wild(tcx, r[0]) { return none; }
@@ -259,7 +261,7 @@ fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> option<ctor> {
       ty::ty_bool => {
         let mut true_found = false, false_found = false;
         for m.each |r| {
-            alt check pat_ctor_id(tcx, r[0]) {
+            match check pat_ctor_id(tcx, r[0]) {
               none => (),
               some(val(const_int(1i64))) => true_found = true,
               some(val(const_int(0i64))) => false_found = true
@@ -274,13 +276,13 @@ fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> option<ctor> {
 }
 
 fn ctor_arity(tcx: ty::ctxt, ctor: ctor, ty: ty::t) -> uint {
-    alt ty::get(ty).struct {
+    match ty::get(ty).struct {
       ty::ty_tup(fs) => fs.len(),
       ty::ty_rec(fs) => fs.len(),
       ty::ty_box(_) | ty::ty_uniq(_) => 1u,
       ty::ty_enum(eid, _) => {
-        let id = alt check ctor { variant(id) => id };
-        alt check vec::find(*ty::enum_variants(tcx, eid), |v| v.id == id ) {
+        let id = match check ctor { variant(id) => id };
+        match check vec::find(*ty::enum_variants(tcx, eid), |v| v.id == id ) {
           some(v) => v.args.len()
         }
       }
@@ -295,11 +297,11 @@ fn wild() -> @pat {
 fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
               left_ty: ty::t) -> option<~[@pat]> {
     let r0 = raw_pat(r[0]);
-    alt r0.node {
+    match r0.node {
       pat_wild => some(vec::append(vec::from_elem(arity, wild()),
                                    vec::tail(r))),
       pat_ident(_, _, _) => {
-        alt tcx.def_map.find(r0.id) {
+        match tcx.def_map.find(r0.id) {
           some(def_variant(_, id)) => {
             if variant(id) == ctor_id { some(vec::tail(r)) }
             else { none }
@@ -308,9 +310,9 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
         }
       }
       pat_enum(_, args) => {
-        alt check tcx.def_map.get(r0.id) {
+        match check tcx.def_map.get(r0.id) {
           def_variant(_, id) if variant(id) == ctor_id => {
-            let args = alt args {
+            let args = match args {
               some(args) => args,
               none => vec::from_elem(arity, wild())
             };
@@ -320,11 +322,11 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
         }
       }
       pat_rec(flds, _) => {
-        let ty_flds = alt check ty::get(left_ty).struct {
+        let ty_flds = match check ty::get(left_ty).struct {
           ty::ty_rec(flds) => flds
         };
         let args = vec::map(ty_flds, |ty_f| {
-            alt vec::find(flds, |f| f.ident == ty_f.ident ) {
+            match vec::find(flds, |f| f.ident == ty_f.ident ) {
               some(f) => f.pat, _ => wild()
             }
         });
@@ -334,7 +336,7 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
       pat_box(a) | pat_uniq(a) => some(vec::append(~[a], vec::tail(r))),
       pat_lit(expr) => {
         let e_v = eval_const_expr(tcx, expr);
-        let match_ = alt check ctor_id {
+        let match_ = match check ctor_id {
           val(v) => compare_const_vals(e_v, v) == 0,
           range(c_lo, c_hi) => {
             compare_const_vals(c_lo, e_v) >= 0 &&
@@ -345,7 +347,7 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
         if match_ { some(vec::tail(r)) } else { none }
       }
       pat_range(lo, hi) => {
-        let (c_lo, c_hi) = alt check ctor_id {
+        let (c_lo, c_hi) = match check ctor_id {
           val(v) => (v, v),
           range(lo, hi) => (lo, hi),
           single => return some(vec::tail(r)),
@@ -373,14 +375,14 @@ fn check_local(tcx: ty::ctxt, loc: @local, &&s: (), v: visit::vt<()>) {
 }
 
 fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
-    alt tcx.def_map.find(pat.id) {
+    match tcx.def_map.find(pat.id) {
       some(def_variant(enum_id, var_id)) => {
         if vec::len(*ty::enum_variants(tcx, enum_id)) != 1u { return true; }
       }
       _ => ()
     }
 
-    alt pat.node {
+    match pat.node {
       pat_box(sub) | pat_uniq(sub) | pat_ident(_, _, some(sub)) => {
         is_refutable(tcx, sub)
       }
index 4d2ffa4b3e9484d06a2d18f5314f9cc66e631b7a..36b0908f435161de31cee6c25c5c08b1fcbfc952 100644 (file)
@@ -20,7 +20,7 @@ fn check_crate(sess: session, crate: @crate, ast_map: ast_map::map,
 fn check_item(sess: session, ast_map: ast_map::map,
               def_map: resolve3::DefMap,
               it: @item, &&_is_const: bool, v: visit::vt<bool>) {
-    alt it.node {
+    match it.node {
       item_const(_, ex) => {
         v.visit_expr(ex, true, v);
         check_item_recursion(sess, ast_map, def_map, it);
@@ -38,13 +38,13 @@ fn check_item(sess: session, ast_map: ast_map::map,
 
 fn check_pat(p: @pat, &&_is_const: bool, v: visit::vt<bool>) {
     fn is_str(e: @expr) -> bool {
-        alt e.node {
+        match e.node {
           expr_vstore(@{node: expr_lit(@{node: lit_str(_), _}), _},
                       vstore_uniq) => true,
           _ => false
         }
     }
-    alt p.node {
+    match p.node {
       // Let through plain ~-string literals here
       pat_lit(a) => if !is_str(a) { v.visit_expr(a, true, v); }
       pat_range(a, b) => {
@@ -59,7 +59,7 @@ fn check_expr(sess: session, def_map: resolve3::DefMap,
               method_map: typeck::method_map, tcx: ty::ctxt,
               e: @expr, &&is_const: bool, v: visit::vt<bool>) {
     if is_const {
-        alt e.node {
+        match e.node {
           expr_unary(box(_), _) | expr_unary(uniq(_), _) |
           expr_unary(deref, _) => {
             sess.span_err(e.span,
@@ -83,7 +83,7 @@ fn check_expr(sess: session, def_map: resolve3::DefMap,
             }
           }
           expr_path(_) => {
-            alt def_map.find(e.id) {
+            match def_map.find(e.id) {
               some(def_const(def_id)) => {
                 if !ast_util::is_local(def_id) {
                     sess.span_err(
@@ -117,7 +117,7 @@ fn check_expr(sess: session, def_map: resolve3::DefMap,
           }
         }
     }
-    alt e.node {
+    match e.node {
       expr_lit(@{node: lit_int(v, t), _}) => {
         if t != ty_char {
             if (v as u64) > ast_util::int_ty_max(
@@ -175,11 +175,11 @@ fn visit_item(it: @item, &&env: env, v: visit::vt<env>) {
     }
 
     fn visit_expr(e: @expr, &&env: env, v: visit::vt<env>) {
-        alt e.node {
+        match e.node {
           expr_path(path) => {
-            alt env.def_map.find(e.id) {
+            match env.def_map.find(e.id) {
               some(def_const(def_id)) => {
-                alt check env.ast_map.get(def_id.node) {
+                match check env.ast_map.get(def_id.node) {
                   ast_map::node_item(it, _) => {
                     v.visit_item(it, env, v);
                   }
index 0ac3caa633bb1b08e0fc9ccdb6cdf9565594962a..8f3de8c8aa2d071f0f8b004630f4c4515fc73373 100644 (file)
@@ -10,7 +10,7 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) {
             visit::visit_item(i, {in_loop: false, can_ret: true}, v);
         },
         visit_expr: |e: @expr, cx: ctx, v: visit::vt<ctx>| {
-            alt e.node {
+            match e.node {
               expr_while(e, b) => {
                 v.visit_expr(e, cx, v);
                 v.visit_block(b, {in_loop: true with cx}, v);
index 66c19a14e6f5fa2974dea1022f5984aa0c2971ac..e15ef58604243143792c36a1b54fa364d7664726 100644 (file)
@@ -41,7 +41,7 @@ enum constness {
 }
 
 fn join(a: constness, b: constness) -> constness {
-    alt (a,b) {
+    match (a,b) {
       (integral_const, integral_const) => integral_const,
       (integral_const, general_const)
       | (general_const, integral_const)
@@ -58,13 +58,13 @@ fn classify(e: @expr,
             def_map: resolve3::DefMap,
             tcx: ty::ctxt) -> constness {
     let did = ast_util::local_def(e.id);
-    alt tcx.ccache.find(did) {
+    match tcx.ccache.find(did) {
       some(x) => x,
       none => {
         let cn =
-            alt e.node {
+            match e.node {
               ast::expr_lit(lit) => {
-                alt lit.node {
+                match lit.node {
                   ast::lit_str(*) |
                   ast::lit_float(*) => general_const,
                   _ => integral_const
@@ -87,7 +87,7 @@ fn classify(e: @expr,
               }
 
               ast::expr_vstore(e, vstore) => {
-                alt vstore {
+                match vstore {
                   ast::vstore_fixed(_) |
                   ast::vstore_slice(_) => classify(e, def_map, tcx),
                   ast::vstore_uniq |
@@ -134,7 +134,7 @@ fn classify(e: @expr,
               // FIXME: #1272, we can probably do something CCI-ish
               // surrounding nonlocal constants. But we don't yet.
               ast::expr_path(_) => {
-                alt def_map.find(e.id) {
+                match def_map.find(e.id) {
                   some(ast::def_const(def_id)) => {
                     if ast_util::is_local(def_id) {
                         let ty = ty::expr_ty(tcx, e);
@@ -191,24 +191,24 @@ enum const_val {
 fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val {
     import middle::ty;
     fn fromb(b: bool) -> const_val { const_int(b as i64) }
-    alt check e.node {
+    match check e.node {
       expr_unary(neg, inner) => {
-        alt check eval_const_expr(tcx, inner) {
+        match check eval_const_expr(tcx, inner) {
           const_float(f) => const_float(-f),
           const_int(i) => const_int(-i),
           const_uint(i) => const_uint(-i)
         }
       }
       expr_unary(not, inner) => {
-        alt check eval_const_expr(tcx, inner) {
+        match check eval_const_expr(tcx, inner) {
           const_int(i) => const_int(!i),
           const_uint(i) => const_uint(!i)
         }
       }
       expr_binary(op, a, b) => {
-        alt check (eval_const_expr(tcx, a), eval_const_expr(tcx, b)) {
+        match check (eval_const_expr(tcx, a), eval_const_expr(tcx, b)) {
           (const_float(a), const_float(b)) => {
-            alt check op {
+            match check op {
               add => const_float(a + b),
               subtract => const_float(a - b),
               mul => const_float(a * b),
@@ -223,7 +223,7 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
             }
           }
           (const_int(a), const_int(b)) => {
-            alt check op {
+            match check op {
               add => const_int(a + b),
               subtract => const_int(a - b),
               mul => const_int(a * b),
@@ -243,7 +243,7 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
             }
           }
           (const_uint(a), const_uint(b)) => {
-            alt check op {
+            match check op {
               add => const_uint(a + b),
               subtract => const_uint(a - b),
               mul => const_uint(a * b),
@@ -264,13 +264,13 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
           }
           // shifts can have any integral type as their rhs
           (const_int(a), const_uint(b)) => {
-            alt check op {
+            match check op {
               shl => const_int(a << b),
               shr => const_int(a >> b)
             }
           }
           (const_uint(a), const_int(b)) => {
-            alt check op {
+            match check op {
               shl => const_uint(a << b),
               shr => const_uint(a >> b)
             }
@@ -280,23 +280,23 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
       expr_cast(base, _) => {
         let ety = ty::expr_ty(tcx, e);
         let base = eval_const_expr(tcx, base);
-        alt check ty::get(ety).struct {
+        match check ty::get(ety).struct {
           ty::ty_float(_) => {
-            alt check base {
+            match check base {
               const_uint(u) => const_float(u as f64),
               const_int(i) => const_float(i as f64),
               const_float(_) => base
             }
           }
           ty::ty_uint(_) => {
-            alt check base {
+            match check base {
               const_uint(_) => base,
               const_int(i) => const_uint(i as u64),
               const_float(f) => const_uint(f as u64)
             }
           }
           ty::ty_int(_) | ty::ty_bool => {
-            alt check base {
+            match check base {
               const_uint(u) => const_int(u as i64),
               const_int(_) => base,
               const_float(f) => const_int(f as i64)
@@ -311,7 +311,7 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
 }
 
 fn lit_to_const(lit: @lit) -> const_val {
-    alt lit.node {
+    match lit.node {
       lit_str(s) => const_str(*s),
       lit_int(n, _) => const_int(n),
       lit_uint(n, _) => const_uint(n),
@@ -323,7 +323,7 @@ fn lit_to_const(lit: @lit) -> const_val {
 }
 
 fn compare_const_vals(a: const_val, b: const_val) -> int {
-  alt (a, b) {
+  match (a, b) {
     (const_int(a), const_int(b)) => {
         if a == b {
             0
index 7c8e807a085d916f882a168e6248ecdeca790855..4c81ec303929de30a516e701a3bfa89f3770353c 100644 (file)
@@ -38,7 +38,7 @@ fn collect_freevars(def_map: resolve3::DefMap, blk: ast::blk)
     fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { }
 
     let walk_expr = fn@(expr: @ast::expr, &&depth: int, v: visit::vt<int>) {
-            alt expr.node {
+            match expr.node {
               ast::expr_fn(proto, decl, _, _) => {
                 if proto != ast::proto_bare {
                     visit::visit_expr(expr, depth + 1, v);
@@ -49,12 +49,12 @@ fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { }
               }
               ast::expr_path(path) => {
                   let mut i = 0;
-                  alt def_map.find(expr.id) {
+                  match def_map.find(expr.id) {
                     none => fail (~"Not found: " + path_to_str(path)),
                     some(df) => {
                       let mut def = df;
                       while i < depth {
-                        alt copy def {
+                        match copy def {
                           ast::def_upvar(_, inner, _) => { def = *inner; }
                           _ => break
                         }
@@ -104,7 +104,7 @@ fn annotate_freevars(def_map: resolve3::DefMap, crate: @ast::crate) ->
 }
 
 fn get_freevars(tcx: ty::ctxt, fid: ast::node_id) -> freevar_info {
-    alt tcx.freevars.find(fid) {
+    match tcx.freevars.find(fid) {
       none => fail ~"get_freevars: " + int::str(fid) + ~" has no freevars",
       some(d) => return d
     }
index e855e23b12b9acc581a57c35d3d0e17e5284852f..408b0ef691694c5e75fc86f9aba9d16999bcc745 100644 (file)
@@ -144,7 +144,7 @@ fn check_for_bare(cx: ctx, _id: node_id, _fv: option<@freevar_entry>,
     }
 
     let fty = ty::node_id_to_type(cx.tcx, id);
-    alt ty::ty_fn_proto(fty) {
+    match ty::ty_fn_proto(fty) {
       proto_uniq => b(check_for_uniq),
       proto_box => b(check_for_box),
       proto_bare => b(check_for_bare),
@@ -166,7 +166,7 @@ fn check_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span,
         // errors and produce a list of the def id's for all capture
         // variables.  This list is used below to avoid checking and reporting
         // on a given variable twice.
-        let cap_clause = alt fk {
+        let cap_clause = match fk {
           visit::fk_anon(_, cc) | visit::fk_fn_block(cc) => cc,
           visit::fk_item_fn(*) | visit::fk_method(*) |
           visit::fk_ctor(*) | visit::fk_dtor(*) => @~[]
@@ -190,7 +190,7 @@ fn check_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span,
             // if this is the last use of the variable, then it will be
             // a move and not a copy
             let is_move = {
-                alt check cx.last_use_map.find(fn_id) {
+                match check cx.last_use_map.find(fn_id) {
                   some(vars) => (*vars).contains(id),
                   none => false
                 }
@@ -205,7 +205,7 @@ fn check_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span,
 }
 
 fn check_block(b: blk, cx: ctx, v: visit::vt<ctx>) {
-    alt b.node.expr {
+    match b.node.expr {
       some(ex) => maybe_copy(cx, ex),
       _ => ()
     }
@@ -214,7 +214,7 @@ fn check_block(b: blk, cx: ctx, v: visit::vt<ctx>) {
 
 fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
     debug!{"kind::check_expr(%s)", expr_to_str(e)};
-    alt e.node {
+    match e.node {
       expr_assign(_, ex) |
       expr_unary(box(_), ex) | expr_unary(uniq(_), ex) |
       expr_ret(some(ex)) => {
@@ -233,11 +233,11 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
       }
       expr_rec(fields, def) => {
         for fields.each |field| { maybe_copy(cx, field.node.expr); }
-        alt def {
+        match def {
           some(ex) => {
             // All noncopyable fields must be overridden
             let t = ty::expr_ty(cx.tcx, ex);
-            let ty_fields = alt ty::get(t).struct {
+            let ty_fields = match ty::get(t).struct {
               ty::ty_rec(f) => f,
               _ => cx.tcx.sess.span_bug(ex.span, ~"bad expr type in record")
             };
@@ -258,7 +258,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
       expr_call(f, args, _) => {
         let mut i = 0u;
         for ty::ty_fn_args(ty::expr_ty(cx.tcx, f)).each |arg_t| {
-            alt ty::arg_mode(cx.tcx, arg_t) {
+            match ty::arg_mode(cx.tcx, arg_t) {
               by_copy => maybe_copy(cx, args[i]),
               by_ref | by_val | by_mutbl_ref | by_move => ()
             }
@@ -267,13 +267,13 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
       }
       expr_path(_) | expr_field(_, _, _) => {
         do option::iter(cx.tcx.node_type_substs.find(e.id)) |ts| {
-            let bounds = alt check e.node {
+            let bounds = match check e.node {
               expr_path(_) => {
                 let did = ast_util::def_id_of_def(cx.tcx.def_map.get(e.id));
                 ty::lookup_item_type(cx.tcx, did).bounds
               }
               expr_field(base, _, _) => {
-                alt cx.method_map.get(e.id).origin {
+                match cx.method_map.get(e.id).origin {
                   typeck::method_static(did) => {
                     // n.b.: When we encode class/impl methods, the bounds
                     // that we encode include both the class/impl bounds
@@ -312,10 +312,10 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
 }
 
 fn check_stmt(stmt: @stmt, cx: ctx, v: visit::vt<ctx>) {
-    alt stmt.node {
+    match stmt.node {
       stmt_decl(@{node: decl_local(locals), _}, _) => {
         for locals.each |local| {
-            alt local.node.init {
+            match local.node.init {
               some({op: init_assign, expr}) => maybe_copy(cx, expr),
               _ => {}
             }
@@ -327,7 +327,7 @@ fn check_stmt(stmt: @stmt, cx: ctx, v: visit::vt<ctx>) {
 }
 
 fn check_ty(aty: @ty, cx: ctx, v: visit::vt<ctx>) {
-    alt aty.node {
+    match aty.node {
       ty_path(_, id) => {
         do option::iter(cx.tcx.node_type_substs.find(id)) |ts| {
             let did = ast_util::def_id_of_def(cx.tcx.def_map.get(id));
@@ -373,9 +373,9 @@ fn maybe_copy(cx: ctx, ex: @expr) {
 }
 
 fn is_nullary_variant(cx: ctx, ex: @expr) -> bool {
-    alt ex.node {
+    match ex.node {
       expr_path(_) => {
-        alt cx.tcx.def_map.get(ex.id) {
+        match cx.tcx.def_map.get(ex.id) {
           def_variant(edid, vdid) => {
             vec::len(ty::enum_variant_with_id(cx.tcx, edid, vdid).args) == 0u
           }
@@ -398,14 +398,14 @@ fn check_copy_ex(cx: ctx, ex: @expr, implicit_copy: bool) {
 fn check_imm_free_var(cx: ctx, def: def, sp: span) {
     let msg = ~"mutable variables cannot be implicitly captured; \
                use a capture clause";
-    alt def {
+    match def {
       def_local(_, is_mutbl) => {
         if is_mutbl {
             cx.tcx.sess.span_err(sp, msg);
         }
       }
       def_arg(_, mode) => {
-        alt ty::resolved_mode(cx.tcx, mode) {
+        match ty::resolved_mode(cx.tcx, mode) {
           by_ref | by_val | by_move | by_copy => { /* ok */ }
           by_mutbl_ref => {
             cx.tcx.sess.span_err(sp, msg);
@@ -449,7 +449,7 @@ fn check_send(cx: ctx, ty: ty::t, sp: span) -> bool {
 // note: also used from middle::typeck::regionck!
 fn check_owned(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool {
     if !ty::kind_is_owned(ty::type_kind(tcx, ty)) {
-        alt ty::get(ty).struct {
+        match ty::get(ty).struct {
           ty::ty_param(*) => {
             tcx.sess.span_err(sp, ~"value may contain borrowed \
                                     pointers; use `owned` bound");
@@ -496,7 +496,7 @@ fn check_cast_for_escaping_regions(
     // Determine what type we are casting to; if it is not an trait, then no
     // worries.
     let target_ty = ty::expr_ty(cx.tcx, target);
-    let target_substs = alt ty::get(target_ty).struct {
+    let target_substs = match ty::get(target_ty).struct {
       ty::ty_trait(_, substs) => {substs}
       _ => { return; /* not a cast to a trait */ }
     };
@@ -504,7 +504,7 @@ fn check_cast_for_escaping_regions(
     // Check, based on the region associated with the trait, whether it can
     // possibly escape the enclosing fn item (note that all type parameters
     // must have been declared on the enclosing fn item):
-    alt target_substs.self_r {
+    match target_substs.self_r {
       some(ty::re_scope(*)) => { return; /* case (1) */ }
       none | some(ty::re_static) | some(ty::re_free(*)) => {}
       some(ty::re_bound(*)) | some(ty::re_var(*)) => {
@@ -519,7 +519,7 @@ fn check_cast_for_escaping_regions(
     let target_params = ty::param_tys_in_type(target_ty);
     let source_ty = ty::expr_ty(cx.tcx, source);
     do ty::walk_ty(source_ty) |ty| {
-        alt ty::get(ty).struct {
+        match ty::get(ty).struct {
           ty::ty_param(source_param) => {
             if target_params.contains(source_param) {
                 /* case (2) */
index 5abc64a3b0d4922c125f9ef7d802993f1b08b999..877dfd5f90c20c950d8cc82baf2d1e596c6ac99f 100644 (file)
@@ -98,9 +98,9 @@
     fn match_and_collect_meta_item(item_def_id: def_id,
                                    meta_item: meta_item) {
 
-        alt meta_item.node {
+        match meta_item.node {
             meta_name_value(key, literal) => {
-                alt literal.node {
+                match literal.node {
                     lit_str(value) => {
                         self.match_and_collect_item(item_def_id,
                                                     *key,
@@ -122,13 +122,13 @@ fn match_and_collect_item(item_def_id: def_id, key: ~str, value: ~str) {
             return;    // Didn't match.
         }
 
-        alt self.item_refs.find(value) {
+        match self.item_refs.find(value) {
             none => {
                 // Didn't match.
             }
             some(item_ref) => {
                 // Check for duplicates.
-                alt copy *item_ref {
+                match copy *item_ref {
                     some(original_def_id)
                             if original_def_id != item_def_id => {
 
@@ -168,7 +168,7 @@ fn collect_external_language_items() {
         do iter_crate_data(crate_store) |crate_number, _crate_metadata| {
             for each_path(crate_store, crate_number) |path_entry| {
                 let def_id;
-                alt path_entry.def_like {
+                match path_entry.def_like {
                     dl_def(def_ty(did)) => {
                         def_id = did;
                     }
@@ -189,7 +189,7 @@ fn collect_external_language_items() {
 
     fn check_completeness() {
         for self.item_refs.each |key, item_ref| {
-            alt copy *item_ref {
+            match copy *item_ref {
                 none => {
                     self.session.err(fmt!{"no item found for `%s`", key});
                 }
index 61299171eae4b4575997727e9c428a2cf3278d3a..4de9bf8e17ddd79101497af539bf6aa1cd91d6fd 100644 (file)
@@ -55,7 +55,7 @@ enum lint {
 // This is pretty unfortunate. We really want some sort of "deriving Enum"
 // type of thing.
 fn int_to_lint(i: int) -> lint {
-    alt check i {
+    match check i {
       0 => ctypes,
       1 => unused_imports,
       2 => while_true,
@@ -70,7 +70,7 @@ fn int_to_lint(i: int) -> lint {
 }
 
 fn level_to_str(lv: level) -> ~str {
-    alt lv {
+    match lv {
       allow => ~"allow",
       warn => ~"warn",
       deny => ~"deny",
@@ -166,7 +166,7 @@ fn mk_lint_settings() -> lint_settings {
 }
 
 fn get_lint_level(modes: lint_modes, lint: lint) -> level {
-    alt modes.find(lint as uint) {
+    match modes.find(lint as uint) {
       some(c) => c,
       none => allow
     }
@@ -176,7 +176,7 @@ fn get_lint_settings_level(settings: lint_settings,
                               lint_mode: lint,
                               _expr_id: ast::node_id,
                               item_id: ast::node_id) -> level {
-    alt settings.settings_map.find(item_id) {
+    match settings.settings_map.find(item_id) {
       some(modes) => get_lint_level(modes, lint_mode),
       none => get_lint_level(settings.default_settings, lint_mode)
     }
@@ -230,10 +230,10 @@ fn with_lint_attrs(attrs: ~[ast::attribute], f: fn(ctxt)) {
                 attr::attr_metas(attr::find_attrs_by_name(attrs,
                                                           level_name));
             for metas.each |meta| {
-                alt meta.node {
+                match meta.node {
                   ast::meta_list(_, metas) => {
                     for metas.each |meta| {
-                        alt meta.node {
+                        match meta.node {
                           ast::meta_word(lintname) => {
                             vec::push(triples, (meta, level, lintname));
                           }
@@ -255,7 +255,7 @@ fn with_lint_attrs(attrs: ~[ast::attribute], f: fn(ctxt)) {
 
         for triples.each |pair| {
             let (meta, level, lintname) = pair;
-            alt self.dict.find(*lintname) {
+            match self.dict.find(*lintname) {
               none => {
                 self.span_lint(
                     new_ctxt.get_level(unrecognized_lint),
@@ -354,9 +354,9 @@ fn item_stopping_visitor<E>(v: visit::vt<E>) -> visit::vt<E> {
 fn check_item_while_true(cx: ty::ctxt, it: @ast::item) {
     let visit = item_stopping_visitor(visit::mk_simple_visitor(@{
         visit_expr: fn@(e: @ast::expr) {
-           alt e.node {
+           match e.node {
              ast::expr_while(cond, _) => {
-                alt cond.node {
+                match cond.node {
                     ast::expr_lit(@{node: ast::lit_bool(true),_}) => {
                             cx.sess.span_lint(
                                 while_true, e.id, it.id,
@@ -380,9 +380,9 @@ fn check_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id,
                        decl: ast::fn_decl) {
         let tys = vec::map(decl.inputs, |a| a.ty );
         for vec::each(vec::append_one(tys, decl.output)) |ty| {
-            alt ty.node {
+            match ty.node {
               ast::ty_path(_, id) => {
-                alt cx.def_map.get(id) {
+                match cx.def_map.get(id) {
                   ast::def_prim_ty(ast::ty_int(ast::ty_i)) => {
                     cx.sess.span_lint(
                         ctypes, id, fn_id,
@@ -405,11 +405,11 @@ fn check_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id,
         }
     }
 
-    alt it.node {
+    match it.node {
       ast::item_foreign_mod(nmod) if attr::foreign_abi(it.attrs) !=
       either::right(ast::foreign_abi_rust_intrinsic) => {
         for nmod.items.each |ni| {
-            alt ni.node {
+            match ni.node {
               ast::foreign_item_fn(decl, tps) => {
                 check_foreign_fn(cx, it.id, decl);
               }
@@ -423,7 +423,7 @@ fn check_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id,
 fn check_item_path_statement(cx: ty::ctxt, it: @ast::item) {
     let visit = item_stopping_visitor(visit::mk_simple_visitor(@{
         visit_stmt: fn@(s: @ast::stmt) {
-            alt s.node {
+            match s.node {
               ast::stmt_semi(@{id: id,
                                callee_id: _,
                                node: ast::expr_path(@path),
@@ -458,7 +458,7 @@ fn check_case(cx: ty::ctxt, ident: ast::ident,
         }
     }
 
-    alt it.node {
+    match it.node {
       ast::item_ty(*) | ast::item_class(*) |
       ast::item_trait(*) | ast::item_impl(*) => {
         check_case(cx, it.ident, it.id, it.id, it.span)
@@ -480,13 +480,13 @@ fn check_fn(tcx: ty::ctxt, fk: visit::fn_kind, decl: ast::fn_decl,
 
     // don't complain about blocks, since they tend to get their modes
     // specified from the outside
-    alt fk {
+    match fk {
       visit::fk_fn_block(*) => { return; }
       _ => {}
     }
 
     let fn_ty = ty::node_id_to_type(tcx, id);
-    alt check ty::get(fn_ty).struct {
+    match check ty::get(fn_ty).struct {
       ty::ty_fn(fn_ty) => {
         let mut counter = 0;
         do vec::iter2(fn_ty.inputs, decl.inputs) |arg_ty, arg_ast| {
@@ -495,7 +495,7 @@ fn check_fn(tcx: ty::ctxt, fk: visit::fn_kind, decl: ast::fn_decl,
                    counter,
                    ty_to_str(tcx, arg_ty.ty),
                    mode_to_str(arg_ast.mode)};
-            alt arg_ast.mode {
+            match arg_ast.mode {
               ast::expl(ast::by_copy) => {
                 /* always allow by-copy */
               }
index 38942b407507c6857bb1339e02fa0f46000dd402..6cad5e19e960942e9d27259697f5df50c5f1df1d 100644 (file)
@@ -201,7 +201,7 @@ enum var_kind {
 }
 
 fn relevant_def(def: def) -> option<relevant_def> {
-    alt def {
+    match def {
       def_self(_) => some(rdef_self),
       def_arg(nid, _) | def_local(nid, _) => some(rdef_var(nid)),
       _ => none
@@ -260,7 +260,7 @@ fn add_variable(vk: var_kind) -> variable {
         vec::push(self.var_kinds, vk);
         self.num_vars += 1u;
 
-        alt vk {
+        match vk {
           vk_local(node_id, _) | vk_arg(node_id, _, _) => {
             self.variable_map.insert(node_id, v);
           }
@@ -277,7 +277,7 @@ fn add_variable(vk: var_kind) -> variable {
     }
 
     fn variable(node_id: node_id, span: span) -> variable {
-        alt self.variable_map.find(node_id) {
+        match self.variable_map.find(node_id) {
           some(var) => var,
           none => {
             self.tcx.sess.span_bug(
@@ -287,7 +287,7 @@ fn variable(node_id: node_id, span: span) -> variable {
     }
 
     fn variable_name(var: variable) -> ident {
-        alt self.var_kinds[*var] {
+        match self.var_kinds[*var] {
           vk_local(_, name) | vk_arg(_, name, _) => name,
           vk_field(name) => @(~"self." + *name),
           vk_self => @~"self",
@@ -300,7 +300,7 @@ fn set_captures(node_id: node_id, +cs: ~[capture_info]) {
     }
 
     fn captures(expr: @expr) -> @~[capture_info] {
-        alt self.capture_map.find(expr.id) {
+        match self.capture_map.find(expr.id) {
           some(caps) => caps,
           none => {
             self.tcx.sess.span_bug(expr.span, ~"no registered caps");
@@ -315,11 +315,11 @@ fn lnk(ln: live_node) -> live_node_kind {
     fn add_last_use(expr_id: node_id, var: variable) {
         let vk = self.var_kinds[*var];
         debug!{"Node %d is a last use of variable %?", expr_id, vk};
-        alt vk {
+        match vk {
           vk_arg(id, name, by_move) |
           vk_arg(id, name, by_copy) |
           vk_local(id, name) => {
-            let v = alt self.last_use_map.find(expr_id) {
+            let v = match self.last_use_map.find(expr_id) {
               some(v) => v,
               none => {
                 let v = @dvec();
@@ -359,7 +359,7 @@ fn visit_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
     // and so forth:
     visit::visit_fn(fk, decl, body, sp, id, fn_maps, v);
 
-    alt fk {
+    match fk {
       visit::fk_ctor(_, _, _, _, class_did) => {
         add_class_fields(fn_maps, class_did);
       }
@@ -414,7 +414,7 @@ fn visit_local(local: @local, &&self: @ir_maps, vt: vt<@ir_maps>) {
 }
 
 fn visit_expr(expr: @expr, &&self: @ir_maps, vt: vt<@ir_maps>) {
-    alt expr.node {
+    match expr.node {
       // live nodes required for uses or definitions of variables:
       expr_path(_) => {
         let def = self.tcx.def_map.get(expr.id);
@@ -435,10 +435,10 @@ fn visit_expr(expr: @expr, &&self: @ir_maps, vt: vt<@ir_maps>) {
                                                 proto, cap_clause);
         let mut call_caps = ~[];
         for cvs.each |cv| {
-            alt relevant_def(cv.def) {
+            match relevant_def(cv.def) {
               some(rv) => {
                 let cv_ln = (*self).add_live_node(lnk_freevar(cv.span));
-                let is_move = alt cv.mode {
+                let is_move = match cv.mode {
                   cap_move | cap_drop => true, // var must be dead afterwards
                   cap_copy | cap_ref => false // var can still be used
                 };
@@ -533,7 +533,7 @@ fn invalid_users() -> users {
     // _______________________________________________________________________
 
     fn live_node(node_id: node_id, span: span) -> live_node {
-        alt self.ir.live_node_map.find(node_id) {
+        match self.ir.live_node_map.find(node_id) {
           some(ln) => ln,
           none => {
             // This must be a mismatch between the ir_map construction
@@ -548,14 +548,14 @@ fn live_node(node_id: node_id, span: span) -> live_node {
     }
 
     fn variable_from_rdef(rv: relevant_def, span: span) -> variable {
-        alt rv {
+        match rv {
           rdef_self => self.s.self_var,
           rdef_var(nid) => self.variable(nid, span)
         }
     }
 
     fn variable_from_path(expr: @expr) -> option<variable> {
-        alt expr.node {
+        match expr.node {
           expr_path(_) => {
             let def = self.tcx.def_map.get(expr.id);
             relevant_def(def).map(
@@ -572,7 +572,7 @@ fn variable(node_id: node_id, span: span) -> variable {
 
     fn variable_from_def_map(node_id: node_id,
                              span: span) -> option<variable> {
-        alt self.tcx.def_map.find(node_id) {
+        match self.tcx.def_map.find(node_id) {
           some(def) => {
             relevant_def(def).map(
                 |rdef| self.variable_from_rdef(rdef, span)
@@ -794,7 +794,7 @@ fn compute(decl: fn_decl, body: blk) -> live_node {
     fn propagate_through_fn_block(decl: fn_decl, blk: blk) -> live_node {
         // inputs passed by & mode should be considered live on exit:
         for decl.inputs.each |arg| {
-            alt ty::resolved_mode(self.tcx, arg.mode) {
+            match ty::resolved_mode(self.tcx, arg.mode) {
               by_mutbl_ref | by_ref | by_val => {
                 // These are "non-owned" modes, so register a read at
                 // the end.  This will prevent us from moving out of
@@ -836,7 +836,7 @@ fn propagate_through_block(blk: blk, succ: live_node) -> live_node {
     }
 
     fn propagate_through_stmt(stmt: @stmt, succ: live_node) -> live_node {
-        alt stmt.node {
+        match stmt.node {
           stmt_decl(decl, _) => {
             return self.propagate_through_decl(decl, succ);
           }
@@ -848,7 +848,7 @@ fn propagate_through_stmt(stmt: @stmt, succ: live_node) -> live_node {
     }
 
     fn propagate_through_decl(decl: @decl, succ: live_node) -> live_node {
-        alt decl.node {
+        match decl.node {
           decl_local(locals) => {
             do locals.foldr(succ) |local, succ| {
                 self.propagate_through_local(local, succ)
@@ -900,7 +900,7 @@ fn propagate_through_opt_expr(opt_expr: option<@expr>,
     }
 
     fn propagate_through_expr(expr: @expr, succ: live_node) -> live_node {
-        alt expr.node {
+        match expr.node {
           // Interesting cases with control flow or which gen/kill
 
           expr_path(_) => {
@@ -912,7 +912,7 @@ fn propagate_through_expr(expr: @expr, succ: live_node) -> live_node {
             // then we treat it as a read of that variable.
             // Otherwise, we ignore it and just propagate down to
             // process `e`.
-            alt self.as_self_field(e, nm) {
+            match self.as_self_field(e, nm) {
               some((ln, var)) => {
                 self.init_from_succ(ln, succ);
                 self.acc(ln, var, ACC_READ | ACC_USE);
@@ -1185,9 +1185,9 @@ fn propagate_through_lvalue_components(expr: @expr,
         // these errors are detected in the later pass borrowck.  We
         // just ignore such cases and treat them as reads.
 
-        alt expr.node {
+        match expr.node {
           expr_path(_) => succ,
-          expr_field(e, nm, _) => alt self.as_self_field(e, nm) {
+          expr_field(e, nm, _) => match self.as_self_field(e, nm) {
             some(_) => succ,
             none => self.propagate_through_expr(e, succ)
           }
@@ -1199,9 +1199,9 @@ fn propagate_through_lvalue_components(expr: @expr,
     fn write_lvalue(expr: @expr,
                     succ: live_node,
                     acc: uint) -> live_node {
-        alt expr.node {
+        match expr.node {
           expr_path(_) => self.access_path(expr, succ, acc),
-          expr_field(e, nm, _) => alt self.as_self_field(e, nm) {
+          expr_field(e, nm, _) => match self.as_self_field(e, nm) {
             some((ln, var)) => {
                 self.init_from_succ(ln, succ);
                 self.acc(ln, var, acc);
@@ -1220,7 +1220,7 @@ fn write_lvalue(expr: @expr,
 
     fn access_path(expr: @expr, succ: live_node, acc: uint) -> live_node {
         let def = self.tcx.def_map.get(expr.id);
-        alt relevant_def(def) {
+        match relevant_def(def) {
           some(rdef_self) => {
             // Accessing `self` is like accessing every field of
             // the current object. This allows something like
@@ -1259,10 +1259,10 @@ fn as_self_field(expr: @expr,
         // If we checking a constructor, then we treat self.f as a
         // variable.  we use the live_node id that will be assigned to
         // the reference to self but the variable id for `f`.
-        alt expr.node {
+        match expr.node {
           expr_path(_) => {
             let def = self.tcx.def_map.get(expr.id);
-            alt def {
+            match def {
               def_self(_) => {
                 // Note: the field_map is empty unless we are in a ctor
                 return self.ir.field_map.find(fld).map(|var| {
@@ -1345,12 +1345,12 @@ fn with_loop_nodes<R>(break_ln: live_node,
 // Checking for error conditions
 
 fn check_local(local: @local, &&self: @liveness, vt: vt<@liveness>) {
-    alt local.node.init {
+    match local.node.init {
       some({op: op, expr: expr}) => {
 
         // Initializer:
 
-        alt op {
+        match op {
           init_move => self.check_move_from_expr(expr, vt),
           init_assign => ()
         }
@@ -1367,7 +1367,7 @@ fn check_local(local: @local, &&self: @liveness, vt: vt<@liveness>) {
         debug!{"check_local() with no initializer"};
         do (*self).pat_bindings(local.node.pat) |ln, var, sp| {
             if !self.warn_about_unused(sp, ln, var) {
-                alt (*self).live_on_exit(ln, var) {
+                match (*self).live_on_exit(ln, var) {
                   none => { /* not live: good */ }
                   some(lnk) => {
                     self.report_illegal_read(
@@ -1384,7 +1384,7 @@ fn check_local(local: @local, &&self: @liveness, vt: vt<@liveness>) {
 }
 
 fn check_expr(expr: @expr, &&self: @liveness, vt: vt<@liveness>) {
-    alt expr.node {
+    match expr.node {
       expr_path(_) => {
         for (*self).variable_from_def_map(expr.id, expr.span).each |var| {
             let ln = (*self).live_node(expr.id, expr.span);
@@ -1437,7 +1437,7 @@ fn check_expr(expr: @expr, &&self: @liveness, vt: vt<@liveness>) {
         let targs = ty::ty_fn_args(ty::expr_ty(self.tcx, f));
         vt.visit_expr(f, self, vt);
         do vec::iter2(args, targs) |arg_expr, arg_ty| {
-            alt ty::resolved_mode(self.tcx, arg_ty.mode) {
+            match ty::resolved_mode(self.tcx, arg_ty.mode) {
               by_val | by_copy | by_ref | by_mutbl_ref => {
                 vt.visit_expr(arg_expr, self, vt);
               }
@@ -1480,7 +1480,7 @@ enum read_kind {
 impl check_methods for @liveness {
     fn check_fields(sp: span, entry_ln: live_node) {
         for self.ir.field_map.each |nm, var| {
-            alt (*self).live_on_entry(entry_ln, var) {
+            match (*self).live_on_entry(entry_ln, var) {
               none => { /* ok */ }
               some(lnk_exit) => {
                 self.tcx.sess.span_err(
@@ -1508,7 +1508,7 @@ fn check_ret(id: node_id, sp: span, fk: visit::fn_kind,
                 self.tcx.sess.span_err(
                     sp, ~"some control paths may return");
             } else {
-                alt fk {
+                match fk {
                   visit::fk_ctor(*) => {
                     // ctors are written as though they are unit.
                   }
@@ -1525,14 +1525,14 @@ fn check_move_from_var(span: span, ln: live_node, var: variable) {
         debug!{"check_move_from_var(%s, %s)",
                ln.to_str(), var.to_str()};
 
-        alt (*self).live_on_exit(ln, var) {
+        match (*self).live_on_exit(ln, var) {
           none => {}
           some(lnk) => self.report_illegal_move(span, lnk, var)
         }
     }
 
     fn consider_last_use(expr: @expr, ln: live_node, var: variable) {
-        alt (*self).live_on_exit(ln, var) {
+        match (*self).live_on_exit(ln, var) {
           some(_) => {}
           none => (*self.ir).add_last_use(expr.id, var)
        }
@@ -1547,9 +1547,9 @@ fn check_move_from_expr(expr: @expr, vt: vt<@liveness>) {
             return vt.visit_expr(expr, self, vt);
         }
 
-        alt expr.node {
+        match expr.node {
           expr_path(_) => {
-            alt (*self).variable_from_path(expr) {
+            match (*self).variable_from_path(expr) {
               some(var) => {
                 let ln = (*self).live_node(expr.id, expr.span);
                 self.check_move_from_var(expr.span, ln, var);
@@ -1582,9 +1582,9 @@ fn check_move_from_expr(expr: @expr, vt: vt<@liveness>) {
     }
 
     fn check_lvalue(expr: @expr, vt: vt<@liveness>) {
-        alt expr.node {
+        match expr.node {
           expr_path(_) => {
-            alt self.tcx.def_map.get(expr.id) {
+            match self.tcx.def_map.get(expr.id) {
               def_local(nid, false) => {
                 // Assignment to an immutable variable or argument:
                 // only legal if there is no later assignment.
@@ -1594,7 +1594,7 @@ fn check_lvalue(expr: @expr, vt: vt<@liveness>) {
                 self.warn_about_dead_assign(expr.span, ln, var);
               }
               def => {
-                alt relevant_def(def) {
+                match relevant_def(def) {
                   some(rdef_var(nid)) => {
                     let ln = (*self).live_node(expr.id, expr.span);
                     let var = (*self).variable(nid, expr.span);
@@ -1623,7 +1623,7 @@ fn check_for_reassignments_in_pat(pat: @pat) {
 
     fn check_for_reassignment(ln: live_node, var: variable,
                               orig_span: span) {
-        alt (*self).assigned_on_exit(ln, var) {
+        match (*self).assigned_on_exit(ln, var) {
           some(lnk_expr(span)) => {
             self.tcx.sess.span_err(
                 span,
@@ -1651,7 +1651,7 @@ fn report_illegal_move(move_span: span,
         // we give a slightly different error message in those cases.
         if lnk == lnk_exit {
             let vk = self.ir.var_kinds[*var];
-            alt vk {
+            match vk {
               vk_arg(_, name, _) => {
                 self.tcx.sess.span_err(
                     move_span,
@@ -1691,7 +1691,7 @@ fn report_illegal_read(chk_span: span,
                            lnk: live_node_kind,
                            var: variable,
                            rk: read_kind) {
-        let msg = alt rk {
+        let msg = match rk {
           possibly_uninitialized_variable => {
             ~"possibly uninitialized variable"
           }
@@ -1699,7 +1699,7 @@ fn report_illegal_read(chk_span: span,
           moved_variable => ~"moved variable"
         };
         let name = (*self.ir).variable_name(var);
-        alt lnk {
+        match lnk {
           lnk_freevar(span) => {
             self.tcx.sess.span_err(
                 span,
@@ -1727,13 +1727,13 @@ fn should_warn(var: variable) -> option<ident> {
     fn warn_about_unused_args(sp: span, decl: fn_decl, entry_ln: live_node) {
         for decl.inputs.each |arg| {
             let var = (*self).variable(arg.id, arg.ty.span);
-            alt ty::resolved_mode(self.tcx, arg.mode) {
+            match ty::resolved_mode(self.tcx, arg.mode) {
               by_mutbl_ref => {
                 // for mutable reference arguments, something like
                 //    x = 1;
                 // is not worth warning about, as it has visible
                 // side effects outside the fn.
-                alt (*self).assigned_on_entry(entry_ln, var) {
+                match (*self).assigned_on_entry(entry_ln, var) {
                   some(_) => { /*ok*/ }
                   none => {
                     // but if it is not written, it ought to be used
index 405afe20a1c15f58bad9871d7fbd96c0d2088c67..f1f33e74e5391e311a746beb4134cb039d2bde66 100644 (file)
@@ -22,9 +22,9 @@ fn pat_id_map(dm: resolve3::DefMap, pat: @pat) -> pat_id_map {
 }
 
 fn pat_is_variant(dm: resolve3::DefMap, pat: @pat) -> bool {
-    alt pat.node {
+    match pat.node {
       pat_enum(_, _) => true,
-      pat_ident(_, _, none) => alt dm.find(pat.id) {
+      pat_ident(_, _, none) => match dm.find(pat.id) {
         some(def_variant(_, _)) => true,
         _ => false
       }
@@ -35,7 +35,7 @@ fn pat_is_variant(dm: resolve3::DefMap, pat: @pat) -> bool {
 fn pat_bindings(dm: resolve3::DefMap, pat: @pat,
                 it: fn(node_id, span, @path)) {
     do walk_pat(pat) |p| {
-        alt p.node {
+        match p.node {
           pat_ident(_, pth, _) if !pat_is_variant(dm, p) => {
             it(p.id, p.span, pth);
           }
index 9cece96b89241ce290ff8d750253fe950dec5f0e..362c4be7abe80c1166a1faee50ab2994b97b3d45 100644 (file)
@@ -88,7 +88,7 @@ fn scope_contains(region_map: region_map, superscope: ast::node_id,
                   subscope: ast::node_id) -> bool {
     let mut subscope = subscope;
     while superscope != subscope {
-        alt region_map.find(subscope) {
+        match region_map.find(subscope) {
             none => return false,
             some(scope) => subscope = scope
         }
@@ -103,7 +103,7 @@ fn subregion(region_map: region_map,
              super_region: ty::region,
              sub_region: ty::region) -> bool {
     super_region == sub_region ||
-        alt (super_region, sub_region) {
+        match (super_region, sub_region) {
           (ty::re_static, _) => {true}
 
           (ty::re_scope(super_scope), ty::re_scope(sub_scope)) |
@@ -128,7 +128,7 @@ fn ancestors_of(region_map: region_map, scope: ast::node_id)
         let mut result = ~[scope];
         let mut scope = scope;
         loop {
-            alt region_map.find(scope) {
+            match region_map.find(scope) {
                 none => return result,
                 some(superscope) => {
                     vec::push(result, superscope);
@@ -172,7 +172,7 @@ fn ancestors_of(region_map: region_map, scope: ast::node_id)
 
 /// Extracts that current parent from cx, failing if there is none.
 fn parent_id(cx: ctxt, span: span) -> ast::node_id {
-    alt cx.parent {
+    match cx.parent {
       none => {
         cx.sess.span_bug(span, ~"crate should not be parent here");
       }
@@ -184,7 +184,7 @@ fn parent_id(cx: ctxt, span: span) -> ast::node_id {
 
 /// Records the current parent (if any) as the parent of `child_id`.
 fn record_parent(cx: ctxt, child_id: ast::node_id) {
-    alt cx.parent {
+    match cx.parent {
       none => { /* no-op */ }
       some(parent_id) => {
         debug!{"parent of node %d is node %d", child_id, parent_id};
@@ -207,10 +207,10 @@ fn resolve_arm(arm: ast::arm, cx: ctxt, visitor: visit::vt<ctxt>) {
 }
 
 fn resolve_pat(pat: @ast::pat, cx: ctxt, visitor: visit::vt<ctxt>) {
-    alt pat.node {
+    match pat.node {
       ast::pat_ident(_, path, _) => {
         let defn_opt = cx.def_map.find(pat.id);
-        alt defn_opt {
+        match defn_opt {
           some(ast::def_variant(_,_)) => {
             /* Nothing to do; this names a variant. */
           }
@@ -230,7 +230,7 @@ fn resolve_expr(expr: @ast::expr, cx: ctxt, visitor: visit::vt<ctxt>) {
     record_parent(cx, expr.id);
 
     let mut new_cx = cx;
-    alt expr.node {
+    match expr.node {
       ast::expr_call(*) => {
         debug!{"node %d: %s", expr.id, pprust::expr_to_str(expr)};
         new_cx.parent = some(expr.id);
@@ -276,7 +276,7 @@ fn resolve_fn(fk: visit::fn_kind, decl: ast::fn_decl, body: ast::blk,
               sp: span, id: ast::node_id, cx: ctxt,
               visitor: visit::vt<ctxt>) {
 
-    let fn_cx = alt fk {
+    let fn_cx = match fk {
       visit::fk_item_fn(*) | visit::fk_method(*) |
       visit::fk_ctor(*) | visit::fk_dtor(*) => {
         // Top-level functions are a root scope.
@@ -380,7 +380,7 @@ fn add_dep(from: ast::node_id, to: ast::node_id) {
                from, to,
                ast_map::node_id_to_str(self.ast_map, from),
                ast_map::node_id_to_str(self.ast_map, to)};
-        let vec = alt self.dep_map.find(from) {
+        let vec = match self.dep_map.find(from) {
             some(vec) => {vec}
             none => {
                 let vec = @dvec();
@@ -424,7 +424,7 @@ fn add_dep(from: ast::node_id, to: ast::node_id) {
     // (anon_implies_rp) to true when we enter an item and setting
     // that flag to false when we enter a method.
     fn region_is_relevant(r: @ast::region) -> bool {
-        alt r.node {
+        match r.node {
           ast::re_anon => self.anon_implies_rp,
           ast::re_named(@~"self") => true,
           ast::re_named(_) => false
@@ -485,7 +485,7 @@ fn determine_rp_in_ty(ty: @ast::ty,
     // if this type directly references a region, either via a
     // region pointer like &r.ty or a region-parameterized path
     // like path/r, add to the worklist/set
-    alt ty.node {
+    match ty.node {
       ast::ty_rptr(r, _) |
       ast::ty_path(@{rp: some(r), _}, _) => {
         debug!{"referenced type with regions %s", pprust::ty_to_str(ty)};
@@ -501,9 +501,9 @@ fn determine_rp_in_ty(ty: @ast::ty,
     // to the dep_map.  If the type is not defined in this crate,
     // then check whether it is region-parameterized and consider
     // that as a direct dependency.
-    alt ty.node {
+    match ty.node {
       ast::ty_path(_, id) => {
-        alt cx.def_map.get(id) {
+        match cx.def_map.get(id) {
           ast::def_ty(did) | ast::def_class(did, _) => {
             if did.crate == ast::local_crate {
                 cx.add_dep(did.node, cx.item_id);
@@ -522,7 +522,7 @@ fn determine_rp_in_ty(ty: @ast::ty,
       _ => {}
     }
 
-    alt ty.node {
+    match ty.node {
       ast::ty_fn(*) => {
         do cx.with(cx.item_id, false) {
             visit::visit_ty(ty, cx, visitor);
@@ -561,7 +561,7 @@ fn determine_rp_in_crate(sess: session,
     while cx.worklist.len() != 0 {
         let id = cx.worklist.pop();
         debug!{"popped %d from worklist", id};
-        alt cx.dep_map.find(id) {
+        match cx.dep_map.find(id) {
           none => {}
           some(vec) => {
             for vec.each |to_id| {
index 9f17e38ba54078e41084bc6bb760c4835af266f8..11f329669c07e89c0cb3e7afb5524abafc40ef50 100644 (file)
@@ -247,7 +247,7 @@ fn Atom(n: uint) -> Atom {
     }
 
     fn intern(string: @~str) -> Atom {
-        alt self.atoms.find(string) {
+        match self.atoms.find(string) {
             none => { /* fall through */ }
             some(atom) => return atom
         }
@@ -367,7 +367,7 @@ fn atom_hashmap<V:copy>() -> hashmap<Atom,V> {
     }
 
     fn target_for_namespace(namespace: Namespace) -> option<Target> {
-        alt namespace {
+        match namespace {
             ModuleNS    => return copy self.module_target,
             TypeNS      => return copy self.type_target,
             ValueNS     => return copy self.value_target,
@@ -461,7 +461,7 @@ fn all_imports_resolved() -> bool {
 // requiring a T:copy.
 
 pure fn is_none<T>(x: option<T>) -> bool {
-    alt x {
+    match x {
         none => return true,
         some(_) => return false
     }
@@ -517,7 +517,7 @@ fn define_impl(implementation: @Impl) {
 
     /// Returns the module node if applicable.
     fn get_module_if_available() -> option<@Module> {
-        alt self.module_def {
+        match self.module_def {
             NoModuleDef         => return none,
             ModuleDef(module_)  => return some(module_)
         }
@@ -528,7 +528,7 @@ fn get_module_if_available() -> option<@Module> {
      * definition.
      */
     fn get_module() -> @Module {
-        alt self.module_def {
+        match self.module_def {
             NoModuleDef => {
                 fail
                     ~"get_module called on a node with no module definition!";
@@ -540,7 +540,7 @@ fn get_module() -> @Module {
     }
 
     fn defined_in_namespace(namespace: Namespace) -> bool {
-        alt namespace {
+        match namespace {
             ModuleNS    => return self.module_def != NoModuleDef,
             TypeNS      => return self.type_def != none,
             ValueNS     => return self.value_def != none,
@@ -549,12 +549,12 @@ fn defined_in_namespace(namespace: Namespace) -> bool {
     }
 
     fn def_for_namespace(namespace: Namespace) -> option<def> {
-        alt namespace {
+        match namespace {
           TypeNS => return self.type_def,
           ValueNS => return self.value_def,
-          ModuleNS => alt self.module_def {
+          ModuleNS => match self.module_def {
             NoModuleDef => return none,
-            ModuleDef(module_) => alt module_.def_id {
+            ModuleDef(module_) => match module_.def_id {
               none => return none,
               some(def_id) => return some(def_mod(def_id))
             }
@@ -750,7 +750,7 @@ fn build_reduced_graph(this: @Resolver) {
     /// Returns the current module tracked by the reduced graph parent.
     fn get_module_from_parent(reduced_graph_parent: ReducedGraphParent)
                            -> @Module {
-        alt reduced_graph_parent {
+        match reduced_graph_parent {
             ModuleReducedGraphParent(module_) => {
                 return module_;
             }
@@ -776,7 +776,7 @@ fn add_child(name: Atom,
         // module and add the child to that.
 
         let mut module_;
-        alt reduced_graph_parent {
+        match reduced_graph_parent {
             ModuleReducedGraphParent(parent_module) => {
                 module_ = parent_module;
             }
@@ -784,7 +784,7 @@ fn add_child(name: Atom,
 
         // Add or reuse the child.
         let new_parent = ModuleReducedGraphParent(module_);
-        alt module_.children.find(name) {
+        match module_.children.find(name) {
             none => {
                 let child = @NameBindings();
                 module_.children.insert(name, child);
@@ -804,9 +804,9 @@ fn block_needs_anonymous_module(block: blk) -> bool {
 
         // Check each statement.
         for block.node.stmts.each |statement| {
-            alt statement.node {
+            match statement.node {
                 stmt_decl(declaration, _) => {
-                    alt declaration.node {
+                    match declaration.node {
                         decl_item(_) => {
                             return true;
                         }
@@ -828,7 +828,7 @@ fn block_needs_anonymous_module(block: blk) -> bool {
     }
 
     fn get_parent_link(parent: ReducedGraphParent, name: Atom) -> ParentLink {
-        alt parent {
+        match parent {
             ModuleReducedGraphParent(module_) => {
                 return ModuleParentLink(module_, name);
             }
@@ -843,7 +843,7 @@ fn build_reduced_graph_for_item(item: @item,
         let atom = (*self.atom_table).intern(item.ident);
         let (name_bindings, new_parent) = self.add_child(atom, parent);
 
-        alt item.node {
+        match item.node {
             item_mod(module_) => {
                 let parent_link = self.get_parent_link(new_parent, atom);
                 let def_id = { crate: 0, node: item.id };
@@ -894,7 +894,7 @@ fn build_reduced_graph_for_item(item: @item,
             item_class(_, _, class_members, optional_ctor, _) => {
                 (*name_bindings).define_type(def_ty(local_def(item.id)));
 
-                alt optional_ctor {
+                match optional_ctor {
                     none => {
                         // Nothing to do.
                     }
@@ -913,7 +913,7 @@ fn build_reduced_graph_for_item(item: @item,
 
                 let mut method_infos = ~[];
                 for class_members.each |class_member| {
-                    alt class_member.node {
+                    match class_member.node {
                         class_method(method) => {
                             // XXX: Combine with impl method code below.
                             method_infos += ~[
@@ -979,7 +979,7 @@ fn build_reduced_graph_for_item(item: @item,
                 let method_names = @atom_hashmap();
                 for methods.each |method| {
                     let atom;
-                    alt method {
+                    match method {
                         required(required_method) => {
                             atom = (*self.atom_table).intern
                                 (required_method.ident);
@@ -1028,7 +1028,7 @@ fn build_reduced_graph_for_variant(variant: variant,
     fn build_reduced_graph_for_view_item(view_item: @view_item,
                                          parent: ReducedGraphParent,
                                          &&_visitor: vt<ReducedGraphParent>) {
-        alt view_item.node {
+        match view_item.node {
             view_item_import(view_paths) => {
                 for view_paths.each |view_path| {
                     // Extract and intern the module part of the path. For
@@ -1036,7 +1036,7 @@ fn build_reduced_graph_for_view_item(view_item: @view_item,
                     // for simple paths we have to munge the path a little.
 
                     let module_path = @dvec();
-                    alt view_path.node {
+                    match view_path.node {
                         view_path_simple(_, full_path, _) => {
                             let path_len = full_path.idents.len();
                             assert path_len != 0u;
@@ -1061,7 +1061,7 @@ fn build_reduced_graph_for_view_item(view_item: @view_item,
 
                     // Build up the import directives.
                     let module_ = self.get_module_from_parent(parent);
-                    alt view_path.node {
+                    match view_path.node {
                         view_path_simple(binding, full_path, _) => {
                             let target_atom =
                                 (*self.atom_table).intern(binding);
@@ -1099,7 +1099,7 @@ fn build_reduced_graph_for_view_item(view_item: @view_item,
             view_item_export(view_paths) => {
                 let module_ = self.get_module_from_parent(parent);
                 for view_paths.each |view_path| {
-                    alt view_path.node {
+                    match view_path.node {
                         view_path_simple(ident, full_path, ident_id) => {
                             let last_ident = full_path.idents.last();
                             if last_ident != ident {
@@ -1157,7 +1157,7 @@ fn build_reduced_graph_for_view_item(view_item: @view_item,
             }
 
             view_item_use(name, _, node_id) => {
-                alt find_use_stmt_cnum(self.session.cstore, node_id) {
+                match find_use_stmt_cnum(self.session.cstore, node_id) {
                     some(crate_id) => {
                         let atom = (*self.atom_table).intern(name);
                         let (child_name_bindings, new_parent) =
@@ -1189,7 +1189,7 @@ fn build_reduced_graph_for_foreign_item(foreign_item: @foreign_item,
         let name = (*self.atom_table).intern(foreign_item.ident);
         let (name_bindings, new_parent) = self.add_child(name, parent);
 
-        alt foreign_item.node {
+        match foreign_item.node {
             foreign_item_fn(fn_decl, type_parameters) => {
                 let def = def_fn(local_def(foreign_item.id), fn_decl.purity);
                 (*name_bindings).define_value(def);
@@ -1262,7 +1262,7 @@ fn build_reduced_graph_for_external_crate(root: @Module) {
                                    ModuleReducedGraphParent(current_module));
 
                 // Define or reuse the module node.
-                alt child_name_bindings.module_def {
+                match child_name_bindings.module_def {
                     NoModuleDef => {
                         debug!{"(building reduced graph for external crate) \
                                 autovivifying %s", ident};
@@ -1283,11 +1283,11 @@ fn build_reduced_graph_for_external_crate(root: @Module) {
                 self.add_child(atom,
                                ModuleReducedGraphParent(current_module));
 
-            alt path_entry.def_like {
+            match path_entry.def_like {
                 dl_def(def) => {
-                    alt def {
+                    match def {
                         def_mod(def_id) | def_foreign_mod(def_id) => {
-                            alt copy child_name_bindings.module_def {
+                            match copy child_name_bindings.module_def {
                                 NoModuleDef => {
                                     debug!{"(building reduced graph for \
                                             external crate) building module \
@@ -1296,7 +1296,7 @@ fn build_reduced_graph_for_external_crate(root: @Module) {
                                         self.get_parent_link(new_parent,
                                                              atom);
 
-                                    alt modules.find(def_id) {
+                                    match modules.find(def_id) {
                                         none => {
                                             (*child_name_bindings).
                                                 define_module(parent_link,
@@ -1315,7 +1315,9 @@ fn build_reduced_graph_for_external_crate(root: @Module) {
                                             resolution.
                                                 outstanding_references = 0;
 
-                                            alt existing_module.parent_link {
+                                            match existing_module
+                                                .parent_link {
+
                                                 NoParentLink |
                                                 BlockParentLink(*) => {
                                                     fail ~"can't happen";
@@ -1368,8 +1370,9 @@ fn build_reduced_graph_for_external_crate(root: @Module) {
                             // If this is a trait, add all the method names
                             // to the trait info.
 
-                            alt get_method_names_if_trait(self.session.cstore,
-                                                          def_id) {
+                            match get_method_names_if_trait(
+                                self.session.cstore, def_id) {
+
                                 none => {
                                     // Nothing to do.
                                 }
@@ -1437,7 +1440,7 @@ fn build_reduced_graph_for_impls_in_external_module_subtree(module_:
         self.build_reduced_graph_for_impls_in_external_module(module_);
 
         for module_.children.each |_name, child_node| {
-            alt (*child_node).get_module_if_available() {
+            match (*child_node).get_module_if_available() {
                 none => {
                     // Nothing to do.
                 }
@@ -1464,7 +1467,7 @@ fn build_reduced_graph_for_impls_in_external_module(module_: @Module) {
                self.module_to_str(module_),
                copy module_.def_id};
 
-        alt module_.def_id {
+        match module_.def_id {
             none => {
                 debug!{"(building reduced graph for impls in external \
                         module) no def ID for `%s`, skipping",
@@ -1516,9 +1519,9 @@ fn build_import_directive(module_: @Module,
         // Bump the reference count on the name. Or, if this is a glob, set
         // the appropriate flag.
 
-        alt *subclass {
+        match *subclass {
             SingleImport(target, _) => {
-                alt module_.import_resolutions.find(target) {
+                match module_.import_resolutions.find(target) {
                     some(resolution) => {
                         resolution.outstanding_references += 1u;
                     }
@@ -1588,7 +1591,7 @@ fn resolve_imports_for_module_subtree(module_: @Module) {
         self.resolve_imports_for_module(module_);
 
         for module_.children.each |_name, child_node| {
-            alt (*child_node).get_module_if_available() {
+            match (*child_node).get_module_if_available() {
                 none => {
                     // Nothing to do.
                 }
@@ -1616,7 +1619,7 @@ fn resolve_imports_for_module(module_: @Module) {
         while module_.resolved_import_count < import_count {
             let import_index = module_.resolved_import_count;
             let import_directive = module_.imports.get_elt(import_index);
-            alt self.resolve_import_for_module(module_, import_directive) {
+            match self.resolve_import_for_module(module_, import_directive) {
                 Failed => {
                     // We presumably emitted an error. Continue.
                     self.session.span_err(import_directive.span,
@@ -1663,7 +1666,7 @@ fn resolve_import_for_module(module_: @Module,
                                                        import_directive);
         } else {
             // First, resolve the module path for the directive, if necessary.
-            alt self.resolve_module_path_for_import(module_,
+            match self.resolve_module_path_for_import(module_,
                                                     module_path,
                                                     NoXray,
                                                     import_directive.span) {
@@ -1678,7 +1681,7 @@ fn resolve_import_for_module(module_: @Module,
                     // We found the module that the target is contained
                     // within. Attempt to resolve the import within it.
 
-                    alt *import_directive.subclass {
+                    match *import_directive.subclass {
                         SingleImport(target, source) => {
                             resolution_result =
                                 self.resolve_single_import(module_,
@@ -1699,7 +1702,7 @@ fn resolve_import_for_module(module_: @Module,
         }
 
         // Decrement the count of unresolved imports.
-        alt resolution_result {
+        match resolution_result {
             Success(()) => {
                 assert self.unresolved_imports >= 1u;
                 self.unresolved_imports -= 1u;
@@ -1715,7 +1718,7 @@ fn resolve_import_for_module(module_: @Module,
         // resolve_imports_for_module.)
 
         if resolution_result != Indeterminate {
-            alt *import_directive.subclass {
+            match *import_directive.subclass {
                 GlobImport => {
                     assert module_.glob_count >= 1u;
                     module_.glob_count -= 1u;
@@ -1757,7 +1760,7 @@ fn resolve_single_import(module_: @Module, containing_module: @Module,
         let mut impl_result = UnknownImplResult;
 
         // Search for direct children of the containing module.
-        alt containing_module.children.find(source) {
+        match containing_module.children.find(source) {
             none => {
                 // Continue.
             }
@@ -1786,7 +1789,7 @@ fn resolve_single_import(module_: @Module, containing_module: @Module,
         // Unless we managed to find a result in all four namespaces
         // (exceedingly unlikely), search imports as well.
 
-        alt (module_result, value_result, type_result, impl_result) {
+        match (module_result, value_result, type_result, impl_result) {
             (BoundResult(*), BoundResult(*), BoundResult(*),
              BoundImplResult(*)) => {
                 // Continue.
@@ -1805,7 +1808,7 @@ fn resolve_single_import(module_: @Module, containing_module: @Module,
                 // Now search the exported imports within the containing
                 // module.
 
-                alt containing_module.import_resolutions.find(source) {
+                match containing_module.import_resolutions.find(source) {
                     none => {
                         // The containing module definitely doesn't have an
                         // exported import with the name in question. We can
@@ -1833,7 +1836,7 @@ fn get_binding(import_resolution: @ImportResolution,
                                        namespace: Namespace)
                                     -> NamespaceResult {
 
-                            alt (*import_resolution).
+                            match (*import_resolution).
                                     target_for_namespace(namespace) {
                                 none => {
                                     return UnboundResult;
@@ -1892,7 +1895,7 @@ fn get_import_binding(import_resolution:
         assert module_.import_resolutions.contains_key(target);
         let import_resolution = module_.import_resolutions.get(target);
 
-        alt module_result {
+        match module_result {
             BoundResult(target_module, name_bindings) => {
                 debug!{"(resolving single import) found module binding"};
                 import_resolution.module_target =
@@ -1906,7 +1909,7 @@ fn get_import_binding(import_resolution:
                 fail ~"module result should be known at this point";
             }
         }
-        alt value_result {
+        match value_result {
             BoundResult(target_module, name_bindings) => {
                 import_resolution.value_target =
                     some(Target(target_module, name_bindings));
@@ -1916,7 +1919,7 @@ fn get_import_binding(import_resolution:
                 fail ~"value result should be known at this point";
             }
         }
-        alt type_result {
+        match type_result {
             BoundResult(target_module, name_bindings) => {
                 import_resolution.type_target =
                     some(Target(target_module, name_bindings));
@@ -1926,7 +1929,7 @@ fn get_import_binding(import_resolution:
                 fail ~"type result should be known at this point";
             }
         }
-        alt impl_result {
+        match impl_result {
             BoundImplResult(targets) => {
                 for (*targets).each |target| {
                     (*import_resolution.impl_target).push(target);
@@ -1939,7 +1942,8 @@ fn get_import_binding(import_resolution:
         }
 
         let i = import_resolution;
-        alt (i.module_target, i.value_target, i.type_target, i.impl_target) {
+        match (i.module_target, i.value_target,
+               i.type_target, i.impl_target) {
           /*
             If this name wasn't found in any of the four namespaces, it's
             definitely unresolved
@@ -1996,7 +2000,7 @@ fn resolve_glob_import(module_: @Module,
                    self.module_to_str(module_)};
 
             // Here we merge two import resolutions.
-            alt module_.import_resolutions.find(atom) {
+            match module_.import_resolutions.find(atom) {
                 none => {
                     // Simple: just copy the old import resolution.
                     let new_import_resolution =
@@ -2017,7 +2021,7 @@ fn resolve_glob_import(module_: @Module,
                     // Merge the two import resolutions at a finer-grained
                     // level.
 
-                    alt copy target_import_resolution.module_target {
+                    match copy target_import_resolution.module_target {
                         none => {
                             // Continue.
                         }
@@ -2026,7 +2030,7 @@ fn resolve_glob_import(module_: @Module,
                                 some(copy module_target);
                         }
                     }
-                    alt copy target_import_resolution.value_target {
+                    match copy target_import_resolution.value_target {
                         none => {
                             // Continue.
                         }
@@ -2035,7 +2039,7 @@ fn resolve_glob_import(module_: @Module,
                                 some(copy value_target);
                         }
                     }
-                    alt copy target_import_resolution.type_target {
+                    match copy target_import_resolution.type_target {
                         none => {
                             // Continue.
                         }
@@ -2068,7 +2072,7 @@ fn resolve_glob_import(module_: @Module,
             }
 
             let mut dest_import_resolution;
-            alt module_.import_resolutions.find(atom) {
+            match module_.import_resolutions.find(atom) {
                 none => {
                     // Create a new import resolution from this child.
                     dest_import_resolution = @ImportResolution(span);
@@ -2131,7 +2135,7 @@ fn resolve_module_path_from_root(module_: @Module,
 
         while index < module_path_len {
             let name = (*module_path).get_elt(index);
-            alt self.resolve_name_in_module(search_module, name, ModuleNS,
+            match self.resolve_name_in_module(search_module, name, ModuleNS,
                                             xray) {
 
                 Failed => {
@@ -2145,7 +2149,7 @@ fn resolve_module_path_from_root(module_: @Module,
                     return Indeterminate;
                 }
                 Success(target) => {
-                    alt target.bindings.module_def {
+                    match target.bindings.module_def {
                         NoModuleDef => {
                             // Not a module.
                             self.session.span_err(span,
@@ -2190,7 +2194,7 @@ fn resolve_module_path_for_import(module_: @Module,
 
         let first_element = (*module_path).get_elt(0u);
         let mut search_module;
-        alt self.resolve_module_in_lexical_scope(module_, first_element) {
+        match self.resolve_module_in_lexical_scope(module_, first_element) {
             Failed => {
                 self.session.span_err(span, ~"unresolved name");
                 return Failed;
@@ -2226,7 +2230,7 @@ fn resolve_item_in_lexical_scope(module_: @Module,
         // The current module node is handled specially. First, check for
         // its immediate children.
 
-        alt module_.children.find(name) {
+        match module_.children.find(name) {
             some(name_bindings)
                     if (*name_bindings).defined_in_namespace(namespace) => {
 
@@ -2240,12 +2244,12 @@ fn resolve_item_in_lexical_scope(module_: @Module,
         // adjacent import statements are processed as though they mutated the
         // current scope.
 
-        alt module_.import_resolutions.find(name) {
+        match module_.import_resolutions.find(name) {
             none => {
                 // Not found; continue.
             }
             some(import_resolution) => {
-                alt (*import_resolution).target_for_namespace(namespace) {
+                match (*import_resolution).target_for_namespace(namespace) {
                     none => {
                         // Not found; continue.
                         debug!{"(resolving item in lexical scope) found \
@@ -2264,7 +2268,7 @@ fn resolve_item_in_lexical_scope(module_: @Module,
         let mut search_module = module_;
         loop {
             // Go to the next parent.
-            alt search_module.parent_link {
+            match search_module.parent_link {
                 NoParentLink => {
                     // No more parents. This module was unresolved.
                     debug!{"(resolving item in lexical scope) unresolved \
@@ -2278,7 +2282,7 @@ fn resolve_item_in_lexical_scope(module_: @Module,
             }
 
             // Resolve the name in the parent module.
-            alt self.resolve_name_in_module(search_module, name, namespace,
+            match self.resolve_name_in_module(search_module, name, namespace,
                                             Xray) {
                 Failed => {
                     // Continue up the search chain.
@@ -2302,9 +2306,9 @@ fn resolve_item_in_lexical_scope(module_: @Module,
     fn resolve_module_in_lexical_scope(module_: @Module, name: Atom)
                                     -> ResolveResult<@Module> {
 
-        alt self.resolve_item_in_lexical_scope(module_, name, ModuleNS) {
+        match self.resolve_item_in_lexical_scope(module_, name, ModuleNS) {
             Success(target) => {
-                alt target.bindings.module_def {
+                match target.bindings.module_def {
                     NoModuleDef => {
                         error!{"!!! (resolving module in lexical scope) module
                                 wasn't actually a module!"};
@@ -2355,7 +2359,7 @@ fn resolve_name_in_module(module_: @Module,
         }
 
         // First, check the direct children of the module.
-        alt module_.children.find(name) {
+        match module_.children.find(name) {
             some(name_bindings)
                     if (*name_bindings).defined_in_namespace(namespace) => {
 
@@ -2376,7 +2380,7 @@ fn resolve_name_in_module(module_: @Module,
         }
 
         // Otherwise, we check the list of resolved imports.
-        alt module_.import_resolutions.find(name) {
+        match module_.import_resolutions.find(name) {
             some(import_resolution) => {
                 if import_resolution.outstanding_references != 0u {
                     debug!{"(resolving name in module) import unresolved; \
@@ -2384,7 +2388,7 @@ fn resolve_name_in_module(module_: @Module,
                     return Indeterminate;
                 }
 
-                alt (*import_resolution).target_for_namespace(namespace) {
+                match (*import_resolution).target_for_namespace(namespace) {
                     none => {
                         debug!{"(resolving name in module) name found, but \
                                 not in namespace %?",
@@ -2420,7 +2424,7 @@ fn resolve_one_level_renaming_import(module_: @Module,
 
         let mut target_name;
         let mut source_name;
-        alt *import_directive.subclass {
+        match *import_directive.subclass {
             SingleImport(target, source) => {
                 target_name = target;
                 source_name = source;
@@ -2442,7 +2446,7 @@ fn resolve_one_level_renaming_import(module_: @Module,
 
         let mut module_result;
         debug!{"(resolving one-level naming result) searching for module"};
-        alt self.resolve_item_in_lexical_scope(module_,
+        match self.resolve_item_in_lexical_scope(module_,
                                                source_name,
                                                ModuleNS) {
 
@@ -2465,7 +2469,7 @@ fn resolve_one_level_renaming_import(module_: @Module,
 
         let mut value_result;
         debug!{"(resolving one-level naming result) searching for value"};
-        alt self.resolve_item_in_lexical_scope(module_,
+        match self.resolve_item_in_lexical_scope(module_,
                                                source_name,
                                                ValueNS) {
 
@@ -2488,7 +2492,7 @@ fn resolve_one_level_renaming_import(module_: @Module,
 
         let mut type_result;
         debug!{"(resolving one-level naming result) searching for type"};
-        alt self.resolve_item_in_lexical_scope(module_,
+        match self.resolve_item_in_lexical_scope(module_,
                                                source_name,
                                                TypeNS) {
 
@@ -2528,7 +2532,7 @@ fn resolve_one_level_renaming_import(module_: @Module,
 
         let mut impl_result;
         debug!{"(resolving one-level naming result) searching for impl"};
-        alt self.resolve_item_in_lexical_scope(module_,
+        match self.resolve_item_in_lexical_scope(module_,
                                                source_name,
                                                ImplNS) {
 
@@ -2559,7 +2563,7 @@ fn resolve_one_level_renaming_import(module_: @Module,
         }
 
         // Otherwise, proceed and write in the bindings.
-        alt module_.import_resolutions.find(target_name) {
+        match module_.import_resolutions.find(target_name) {
             none => {
                 fail ~"(resolving one-level renaming import) reduced graph \
                       construction or glob importing should have created the \
@@ -2576,7 +2580,7 @@ fn resolve_one_level_renaming_import(module_: @Module,
                 import_resolution.value_target = value_result;
                 import_resolution.type_target = type_result;
 
-                alt impl_result {
+                match impl_result {
                     none => {
                         // Nothing to do.
                     }
@@ -2604,7 +2608,7 @@ fn report_unresolved_imports(module_: @Module) {
 
         // Descend into children and anonymous children.
         for module_.children.each |_name, child_node| {
-            alt (*child_node).get_module_if_available() {
+            match (*child_node).get_module_if_available() {
                 none => {
                     // Continue.
                 }
@@ -2637,7 +2641,7 @@ fn record_exports_for_module_subtree(module_: @Module) {
         // If this isn't a local crate, then bail out. We don't need to record
         // exports for local crates.
 
-        alt module_.def_id {
+        match module_.def_id {
             some(def_id) if def_id.crate == local_crate => {
                 // OK. Continue.
             }
@@ -2656,7 +2660,7 @@ fn record_exports_for_module_subtree(module_: @Module) {
         self.record_exports_for_module(module_);
 
         for module_.children.each |_atom, child_name_bindings| {
-            alt (*child_name_bindings).get_module_if_available() {
+            match (*child_name_bindings).get_module_if_available() {
                 none => {
                     // Nothing to do.
                 }
@@ -2682,7 +2686,7 @@ fn record_exports_for_module(module_: @Module) {
                     again;
                 }
 
-                alt self.resolve_definition_of_name_in_module(module_,
+                match self.resolve_definition_of_name_in_module(module_,
                                                               name,
                                                               namespace,
                                                               Xray) {
@@ -2723,7 +2727,7 @@ fn build_impl_scopes_for_module_subtree(module_: @Module) {
         // If this isn't a local crate, then bail out. We don't need to
         // resolve implementations for external crates.
 
-        alt module_.def_id {
+        match module_.def_id {
             some(def_id) if def_id.crate == local_crate => {
                 // OK. Continue.
             }
@@ -2742,7 +2746,7 @@ fn build_impl_scopes_for_module_subtree(module_: @Module) {
         self.build_impl_scope_for_module(module_);
 
         for module_.children.each |_atom, child_name_bindings| {
-            alt (*child_name_bindings).get_module_if_available() {
+            match (*child_name_bindings).get_module_if_available() {
                 none => {
                     // Nothing to do.
                 }
@@ -2788,7 +2792,7 @@ fn build_impl_scope_for_module(module_: @Module) {
 
         // Determine the parent's implementation scope.
         let mut parent_impl_scopes;
-        alt module_.parent_link {
+        match module_.parent_link {
             NoParentLink => {
                 parent_impl_scopes = @nil;
             }
@@ -2830,19 +2834,19 @@ fn with_scope(name: option<Atom>, f: fn()) {
         let orig_module = self.current_module;
 
         // Move down in the graph.
-        alt name {
+        match name {
             none => {
                 // Nothing to do.
             }
             some(name) => {
-                alt orig_module.children.find(name) {
+                match orig_module.children.find(name) {
                     none => {
                         debug!{"!!! (with scope) didn't find `%s` in `%s`",
                                *(*self.atom_table).atom_to_str(name),
                                self.module_to_str(orig_module)};
                     }
                     some(name_bindings) => {
-                        alt (*name_bindings).get_module_if_available() {
+                        match (*name_bindings).get_module_if_available() {
                             none => {
                                 debug!{"!!! (with scope) didn't find module \
                                         for `%s` in `%s`",
@@ -2873,7 +2877,7 @@ fn upvarify(ribs: @dvec<@Rib>, rib_index: uint, def_like: def_like,
         let mut def;
         let mut is_ty_param;
 
-        alt def_like {
+        match def_like {
             dl_def(d @ def_local(*)) | dl_def(d @ def_upvar(*)) |
             dl_def(d @ def_arg(*)) | dl_def(d @ def_binding(*)) => {
                 def = d;
@@ -2896,7 +2900,7 @@ fn upvarify(ribs: @dvec<@Rib>, rib_index: uint, def_like: def_like,
         let mut rib_index = rib_index + 1u;
         while rib_index < (*ribs).len() {
             let rib = (*ribs).get_elt(rib_index);
-            alt rib.kind {
+            match rib.kind {
                 NormalRibKind => {
                     // Nothing to do. Continue.
                 }
@@ -2910,7 +2914,7 @@ fn upvarify(ribs: @dvec<@Rib>, rib_index: uint, def_like: def_like,
                 MethodRibKind(item_id, method_id) => {
                   // If the def is a ty param, and came from the parent
                   // item, it's ok
-                  alt def {
+                  match def {
                     def_ty_param(did, _) if self.def_map.find(copy(did.node))
                       == some(def_typaram_binder(item_id)) => {
                       // ok
@@ -2976,7 +2980,7 @@ fn search_ribs(ribs: @dvec<@Rib>, name: Atom, span: span,
         while i != 0u {
             i -= 1u;
             let rib = (*ribs).get_elt(i);
-            alt rib.bindings.find(name) {
+            match rib.bindings.find(name) {
                 some(def_like) => {
                     return self.upvarify(ribs, i, def_like, span,
                                       allow_capturing_self);
@@ -3028,7 +3032,7 @@ fn resolve_item(item: @item, visitor: ResolveVisitor) {
             self.xray_context = Xray;
         }
 
-        alt item.node {
+        match item.node {
             item_enum(_, type_parameters) |
             item_ty(_, type_parameters) => {
                 do self.with_type_parameter_rib
@@ -3090,7 +3094,7 @@ fn resolve_item(item: @item, visitor: ResolveVisitor) {
                         //
                         // XXX: Do we need a node ID here?
 
-                        alt method {
+                        match method {
                           required(ty_m) => {
                             do self.with_type_parameter_rib
                                 (HasTypeParameters(&ty_m.tps,
@@ -3148,7 +3152,7 @@ fn resolve_item(item: @item, visitor: ResolveVisitor) {
                 let atom = (*self.atom_table).intern(item.ident);
                 do self.with_scope(some(atom)) {
                     for foreign_module.items.each |foreign_item| {
-                        alt foreign_item.node {
+                        match foreign_item.node {
                             foreign_item_fn(_, type_parameters) => {
                                 do self.with_type_parameter_rib
                                     (HasTypeParameters(&type_parameters,
@@ -3206,7 +3210,7 @@ fn resolve_item(item: @item, visitor: ResolveVisitor) {
     }
 
     fn with_type_parameter_rib(type_parameters: TypeParameters, f: fn()) {
-        alt type_parameters {
+        match type_parameters {
             HasTypeParameters(type_parameters, node_id, initial_index,
                               rib_kind) => {
 
@@ -3236,7 +3240,7 @@ fn with_type_parameter_rib(type_parameters: TypeParameters, f: fn()) {
 
         f();
 
-        alt type_parameters {
+        match type_parameters {
             HasTypeParameters(type_parameters, _, _, _) => {
                 (*self.type_ribs).pop();
             }
@@ -3256,14 +3260,14 @@ fn resolve_function(rib_kind: RibKind,
                         visitor: ResolveVisitor) {
 
         // Check each element of the capture clause.
-        alt capture_clause {
+        match capture_clause {
             NoCaptureClause => {
                 // Nothing to do.
             }
             HasCaptureClause(capture_clause) => {
                 // Resolve each captured item.
                 for (*capture_clause).each |capture_item| {
-                    alt self.resolve_identifier(capture_item.name,
+                    match self.resolve_identifier(capture_item.name,
                                                 ValueNS,
                                                 true,
                                                 capture_item.span) {
@@ -3287,7 +3291,7 @@ fn resolve_function(rib_kind: RibKind,
         // If this function has type parameters, add them now.
         do self.with_type_parameter_rib(type_parameters) {
             // Resolve the type parameters.
-            alt type_parameters {
+            match type_parameters {
                 NoTypeParameters => {
                     // Continue.
                 }
@@ -3297,7 +3301,7 @@ fn resolve_function(rib_kind: RibKind,
             }
 
             // Add self to the rib, if necessary.
-            alt self_binding {
+            match self_binding {
                 NoSelfBinding => {
                     // Nothing to do.
                 }
@@ -3309,7 +3313,7 @@ fn resolve_function(rib_kind: RibKind,
             }
 
             // Add each argument to the rib.
-            alt optional_declaration {
+            match optional_declaration {
                 none => {
                     // Nothing to do.
                 }
@@ -3344,7 +3348,7 @@ fn resolve_type_parameters(type_parameters: ~[ty_param],
 
         for type_parameters.each |type_parameter| {
             for (*type_parameter.bounds).each |bound| {
-                alt bound {
+                match bound {
                     bound_copy | bound_send | bound_const | bound_owned => {
                         // Nothing to do.
                     }
@@ -3379,7 +3383,7 @@ fn resolve_class(id: node_id,
 
             // Resolve implemented traits.
             for traits.each |trt| {
-                alt self.resolve_path(trt.path, TypeNS, true, visitor) {
+                match self.resolve_path(trt.path, TypeNS, true, visitor) {
                     none => {
                         self.session.span_err(trt.path.span,
                                               ~"attempt to implement a \
@@ -3404,7 +3408,7 @@ fn resolve_class(id: node_id,
 
             // Resolve methods.
             for class_members.each |class_member| {
-                alt class_member.node {
+                match class_member.node {
                     class_method(method) => {
                       self.resolve_method(MethodRibKind(id,
                                                Provided(method.id)),
@@ -3419,7 +3423,7 @@ fn resolve_class(id: node_id,
             }
 
             // Resolve the constructor, if applicable.
-            alt optional_constructor {
+            match optional_constructor {
                 none => {
                     // Nothing to do.
                 }
@@ -3436,7 +3440,7 @@ fn resolve_class(id: node_id,
             }
 
             // Resolve the destructor, if applicable.
-            alt optional_destructor {
+            match optional_destructor {
                 none => {
                     // Nothing to do.
                 }
@@ -3498,8 +3502,8 @@ fn resolve_implementation(id: node_id,
             if trait_references.len() >= 1 {
                 let mut new_trait_refs = @dvec();
                 for trait_references.each |trait_reference| {
-                    alt self.resolve_path(trait_reference.path, TypeNS, true,
-                                          visitor) {
+                    match self.resolve_path(
+                        trait_reference.path, TypeNS, true, visitor) {
                         none => {
                             self.session.span_err(span,
                                                   ~"attempt to implement an \
@@ -3566,7 +3570,7 @@ fn resolve_local(local: @local, visitor: ResolveVisitor) {
         self.resolve_type(local.node.ty, visitor);
 
         // Resolve the initializer, if necessary.
-        alt local.node.init {
+        match local.node.init {
             none => {
                 // Nothing to do.
             }
@@ -3639,7 +3643,7 @@ fn resolve_block(block: blk, visitor: ResolveVisitor) {
 
         // Move down in the graph, if there's an anonymous module rooted here.
         let orig_module = self.current_module;
-        alt self.current_module.anonymous_children.find(block.node.id) {
+        match self.current_module.anonymous_children.find(block.node.id) {
             none => { /* Nothing to do. */ }
             some(anonymous_module) => {
                 debug!{"(resolving block) found anonymous module, moving \
@@ -3659,7 +3663,7 @@ fn resolve_block(block: blk, visitor: ResolveVisitor) {
     }
 
     fn resolve_type(ty: @ty, visitor: ResolveVisitor) {
-        alt ty.node {
+        match ty.node {
             // Like path expressions, the interpretation of path types depends
             // on whether the path has multiple elements in it or not.
 
@@ -3668,7 +3672,7 @@ fn resolve_type(ty: @ty, visitor: ResolveVisitor) {
                 // scopes looking for it.
 
                 let mut result_def;
-                alt self.resolve_path(path, TypeNS, true, visitor) {
+                match self.resolve_path(path, TypeNS, true, visitor) {
                     some(def) => {
                         debug!{"(resolving type) resolved `%s` to type",
                                *path.idents.last()};
@@ -3679,7 +3683,7 @@ fn resolve_type(ty: @ty, visitor: ResolveVisitor) {
                     }
                 }
 
-                alt result_def {
+                match result_def {
                     some(_) => {
                         // Continue.
                     }
@@ -3689,7 +3693,7 @@ fn resolve_type(ty: @ty, visitor: ResolveVisitor) {
                             let name =
                                 (*self.atom_table).intern(path.idents.last());
 
-                            alt self.primitive_type_table
+                            match self.primitive_type_table
                                     .primitive_types
                                     .find(name) {
 
@@ -3705,7 +3709,7 @@ fn resolve_type(ty: @ty, visitor: ResolveVisitor) {
                     }
                 }
 
-                alt copy result_def {
+                match copy result_def {
                     some(def) => {
                         // Write the result into the def map.
                         debug!{"(resolving type) writing resolution for `%s` \
@@ -3740,7 +3744,7 @@ fn resolve_pattern(pattern: @pat,
 
         let pat_id = pattern.id;
         do walk_pat(pattern) |pattern| {
-            alt pattern.node {
+            match pattern.node {
                 pat_ident(binding_mode, path, _)
                         if !path.global && path.idents.len() == 1u => {
 
@@ -3754,7 +3758,7 @@ fn resolve_pattern(pattern: @pat,
 
                     let atom = (*self.atom_table).intern(path.idents[0]);
 
-                    alt self.resolve_enum_variant_or_const(atom) {
+                    match self.resolve_enum_variant_or_const(atom) {
                         FoundEnumVariant(def) if mode == RefutableMode => {
                             debug!{"(resolving pattern) resolving `%s` to \
                                     enum variant",
@@ -3783,7 +3787,7 @@ enum variant",
 
                             let is_mutable = mutability == Mutable;
 
-                            let def = alt mode {
+                            let def = match mode {
                                 RefutableMode => {
                                     // For pattern arms, we must use
                                     // `def_binding` definitions.
@@ -3808,7 +3812,7 @@ enum variant",
                             // because that breaks the assumptions later
                             // passes make about or-patterns.)
 
-                            alt bindings_list {
+                            match bindings_list {
                                 some(bindings_list)
                                 if !bindings_list.contains_key(atom) => {
                                     let last_rib = (*self.value_ribs).last();
@@ -3845,7 +3849,7 @@ enum variant",
 
                 pat_ident(_, path, _) | pat_enum(path, _) => {
                     // These two must be enum variants.
-                    alt self.resolve_path(path, ValueNS, false, visitor) {
+                    match self.resolve_path(path, ValueNS, false, visitor) {
                         some(def @ def_variant(*)) => {
                             self.record_def(pattern.id, def);
                         }
@@ -3886,12 +3890,12 @@ enum variant",
     fn resolve_enum_variant_or_const(name: Atom)
                                   -> EnumVariantOrConstResolution {
 
-        alt self.resolve_item_in_lexical_scope(self.current_module,
+        match self.resolve_item_in_lexical_scope(self.current_module,
                                                name,
                                                ValueNS) {
 
             Success(target) => {
-                alt target.bindings.value_def {
+                match target.bindings.value_def {
                     none => {
                         fail ~"resolved name in the value namespace to a set \
                               of name bindings with no def?!";
@@ -3956,7 +3960,7 @@ fn resolve_identifier(identifier: ident,
                        -> option<def> {
 
         if check_ribs {
-            alt self.resolve_identifier_in_local_ribs(identifier,
+            match self.resolve_identifier_in_local_ribs(identifier,
                                                       namespace,
                                                       span) {
                 some(def) => {
@@ -3987,9 +3991,9 @@ fn resolve_definition_of_name_in_module(containing_module: @Module,
         }
 
         // First, search children.
-        alt containing_module.children.find(name) {
+        match containing_module.children.find(name) {
             some(child_name_bindings) => {
-                alt (*child_name_bindings).def_for_namespace(namespace) {
+                match (*child_name_bindings).def_for_namespace(namespace) {
                     some(def) => {
                         // Found it. Stop the search here.
                         return ChildNameDefinition(def);
@@ -4005,11 +4009,12 @@ fn resolve_definition_of_name_in_module(containing_module: @Module,
         }
 
         // Next, search import resolutions.
-        alt containing_module.import_resolutions.find(name) {
+        match containing_module.import_resolutions.find(name) {
             some(import_resolution) => {
-                alt (*import_resolution).target_for_namespace(namespace) {
+                match (*import_resolution).target_for_namespace(namespace) {
                     some(target) => {
-                        alt (*target.bindings).def_for_namespace(namespace) {
+                        match (*target.bindings)
+                            .def_for_namespace(namespace) {
                             some(def) => {
                                 // Found it.
                                 import_resolution.used = true;
@@ -4055,7 +4060,7 @@ fn resolve_module_relative_path(path: @path,
         let module_path_atoms = self.intern_module_part_of_path(path);
 
         let mut containing_module;
-        alt self.resolve_module_path_for_import(self.current_module,
+        match self.resolve_module_path_for_import(self.current_module,
                                                 module_path_atoms,
                                                 xray,
                                                 path.span) {
@@ -4078,7 +4083,7 @@ fn resolve_module_relative_path(path: @path,
         }
 
         let name = (*self.atom_table).intern(path.idents.last());
-        alt self.resolve_definition_of_name_in_module(containing_module,
+        match self.resolve_definition_of_name_in_module(containing_module,
                                                       name,
                                                       namespace,
                                                       xray) {
@@ -4108,7 +4113,7 @@ fn resolve_crate_relative_path(path: @path,
         let root_module = (*self.graph_root).get_module();
 
         let mut containing_module;
-        alt self.resolve_module_path_from_root(root_module,
+        match self.resolve_module_path_from_root(root_module,
                                                module_path_atoms,
                                                0u,
                                                xray,
@@ -4132,7 +4137,7 @@ fn resolve_crate_relative_path(path: @path,
         }
 
         let name = (*self.atom_table).intern(path.idents.last());
-        alt self.resolve_definition_of_name_in_module(containing_module,
+        match self.resolve_definition_of_name_in_module(containing_module,
                                                       name,
                                                       namespace,
                                                       xray) {
@@ -4161,7 +4166,7 @@ fn resolve_identifier_in_local_ribs(identifier: ident,
 
         // Check the local set of ribs.
         let mut search_result;
-        alt namespace {
+        match namespace {
             ValueNS => {
                 search_result = self.search_ribs(self.value_ribs, name, span,
                                                  DontAllowCapturingSelf);
@@ -4175,7 +4180,7 @@ fn resolve_identifier_in_local_ribs(identifier: ident,
             }
         }
 
-        alt copy search_result {
+        match copy search_result {
             some(dl_def(def)) => {
                 debug!{"(resolving path in local ribs) resolved `%s` to \
                         local: %?",
@@ -4196,12 +4201,12 @@ fn resolve_item_by_identifier_in_lexical_scope(ident: ident,
         let name = (*self.atom_table).intern(ident);
 
         // Check the items.
-        alt self.resolve_item_in_lexical_scope(self.current_module,
+        match self.resolve_item_in_lexical_scope(self.current_module,
                                                name,
                                                namespace) {
 
             Success(target) => {
-                alt (*target.bindings).def_for_namespace(namespace) {
+                match (*target.bindings).def_for_namespace(namespace) {
                     none => {
                         fail ~"resolved name in a namespace to a set of name \
                               bindings with no def for that namespace?!";
@@ -4235,7 +4240,7 @@ fn resolve_expr(expr: @expr, visitor: ResolveVisitor) {
         self.record_candidate_traits_for_expr_if_necessary(expr);
 
         // Next, resolve the node.
-        alt expr.node {
+        match expr.node {
             // The interpretation of paths depends on whether the path has
             // multiple elements in it or not.
 
@@ -4243,7 +4248,7 @@ fn resolve_expr(expr: @expr, visitor: ResolveVisitor) {
                 // This is a local path in the value namespace. Walk through
                 // scopes looking for it.
 
-                alt self.resolve_path(path, ValueNS, true, visitor) {
+                match self.resolve_path(path, ValueNS, true, visitor) {
                     some(def) => {
                         // Write the result into the def map.
                         debug!{"(resolving expr) resolved `%s`",
@@ -4288,7 +4293,7 @@ fn resolve_expr(expr: @expr, visitor: ResolveVisitor) {
                 //    type Bar<A> = Foo<A>;
                 //    let bar = Bar { ... } // no type parameters
 
-                alt self.resolve_path(path, TypeNS, false, visitor) {
+                match self.resolve_path(path, TypeNS, false, visitor) {
                     some(definition @ def_ty(class_id))
                             if self.structs.contains_key(class_id) => {
 
@@ -4316,7 +4321,7 @@ fn resolve_expr(expr: @expr, visitor: ResolveVisitor) {
     }
 
     fn record_impls_for_expr_if_necessary(expr: @expr) {
-        alt expr.node {
+        match expr.node {
             expr_field(*) | expr_path(*) | expr_cast(*) | expr_binary(*) |
             expr_unary(*) | expr_assign_op(*) | expr_index(*) => {
                 self.impl_map.insert(expr.id,
@@ -4329,7 +4334,7 @@ fn record_impls_for_expr_if_necessary(expr: @expr) {
     }
 
     fn record_candidate_traits_for_expr_if_necessary(expr: @expr) {
-        alt expr.node {
+        match expr.node {
             expr_field(_, ident, _) => {
                 let atom = (*self.atom_table).intern(ident);
                 let traits = self.search_for_traits_containing_method(atom);
@@ -4394,7 +4399,7 @@ fn search_for_traits_containing_method(name: Atom) -> @dvec<def_id> {
         let mut search_module = self.current_module;
         loop {
             // Look for the current trait.
-            alt copy self.current_trait_refs {
+            match copy self.current_trait_refs {
                 some(trait_def_ids) => {
                     for trait_def_ids.each |trait_def_id| {
                         self.add_trait_info_if_containing_method
@@ -4408,7 +4413,7 @@ fn search_for_traits_containing_method(name: Atom) -> @dvec<def_id> {
 
             // Look for trait children.
             for search_module.children.each |_name, child_name_bindings| {
-                alt child_name_bindings.def_for_namespace(TypeNS) {
+                match child_name_bindings.def_for_namespace(TypeNS) {
                     some(def_ty(trait_def_id)) => {
                         self.add_trait_info_if_containing_method(found_traits,
                                                                  trait_def_id,
@@ -4424,12 +4429,12 @@ fn search_for_traits_containing_method(name: Atom) -> @dvec<def_id> {
             for search_module.import_resolutions.each
                     |_atom, import_resolution| {
 
-                alt import_resolution.target_for_namespace(TypeNS) {
+                match import_resolution.target_for_namespace(TypeNS) {
                     none => {
                         // Continue.
                     }
                     some(target) => {
-                        alt target.bindings.def_for_namespace(TypeNS) {
+                        match target.bindings.def_for_namespace(TypeNS) {
                             some(def_ty(trait_def_id)) => {
                                 self.add_trait_info_if_containing_method
                                     (found_traits, trait_def_id, name);
@@ -4443,7 +4448,7 @@ fn search_for_traits_containing_method(name: Atom) -> @dvec<def_id> {
             }
 
             // Move to the next parent.
-            alt search_module.parent_link {
+            match search_module.parent_link {
                 NoParentLink => {
                     // Done.
                     break;
@@ -4462,7 +4467,7 @@ fn add_trait_info_if_containing_method(found_traits: @dvec<def_id>,
                                            trait_def_id: def_id,
                                            name: Atom) {
 
-        alt self.trait_info.find(trait_def_id) {
+        match self.trait_info.find(trait_def_id) {
             some(trait_info) if trait_info.contains_key(name) => {
                 debug!{"(adding trait info if containing method) found trait \
                         %d:%d for method '%s'",
@@ -4508,7 +4513,7 @@ fn check_for_unused_imports_in_module_subtree(module_: @Module) {
         // If this isn't a local crate, then bail out. We don't need to check
         // for unused imports in external crates.
 
-        alt module_.def_id {
+        match module_.def_id {
             some(def_id) if def_id.crate == local_crate => {
                 // OK. Continue.
             }
@@ -4527,7 +4532,7 @@ fn check_for_unused_imports_in_module_subtree(module_: @Module) {
         self.check_for_unused_imports_in_module(module_);
 
         for module_.children.each |_atom, child_name_bindings| {
-            alt (*child_name_bindings).get_module_if_available() {
+            match (*child_name_bindings).get_module_if_available() {
                 none => {
                     // Nothing to do.
                 }
@@ -4546,7 +4551,7 @@ fn check_for_unused_imports_in_module_subtree(module_: @Module) {
     fn check_for_unused_imports_in_module(module_: @Module) {
         for module_.import_resolutions.each |_impl_name, import_resolution| {
             if !import_resolution.used {
-                alt self.unused_import_lint_level {
+                match self.unused_import_lint_level {
                     warn => {
                         self.session.span_warn(import_resolution.span,
                                                ~"unused import");
@@ -4577,7 +4582,7 @@ fn module_to_str(module_: @Module) -> ~str {
         let atoms = dvec();
         let mut current_module = module_;
         loop {
-            alt current_module.parent_link {
+            match current_module.parent_link {
                 NoParentLink => {
                     break;
                 }
@@ -4624,7 +4629,7 @@ fn dump_module(module_: @Module) {
         debug!{"Import resolutions:"};
         for module_.import_resolutions.each |name, import_resolution| {
             let mut module_repr;
-            alt (*import_resolution).target_for_namespace(ModuleNS) {
+            match (*import_resolution).target_for_namespace(ModuleNS) {
                 none => { module_repr = ~""; }
                 some(target) => {
                     module_repr = ~" module:?";
@@ -4633,7 +4638,7 @@ fn dump_module(module_: @Module) {
             }
 
             let mut value_repr;
-            alt (*import_resolution).target_for_namespace(ValueNS) {
+            match (*import_resolution).target_for_namespace(ValueNS) {
                 none => { value_repr = ~""; }
                 some(target) => {
                     value_repr = ~" value:?";
@@ -4642,7 +4647,7 @@ fn dump_module(module_: @Module) {
             }
 
             let mut type_repr;
-            alt (*import_resolution).target_for_namespace(TypeNS) {
+            match (*import_resolution).target_for_namespace(TypeNS) {
                 none => { type_repr = ~""; }
                 some(target) => {
                     type_repr = ~" type:?";
@@ -4651,7 +4656,7 @@ fn dump_module(module_: @Module) {
             }
 
             let mut impl_repr;
-            alt (*import_resolution).target_for_namespace(ImplNS) {
+            match (*import_resolution).target_for_namespace(ImplNS) {
                 none => { impl_repr = ~""; }
                 some(target) => {
                     impl_repr = ~" impl:?";
@@ -4671,7 +4676,7 @@ fn dump_impl_scopes(impl_scopes: ImplScopes) {
         let mut i = 0u;
         let mut impl_scopes = impl_scopes;
         loop {
-            alt *impl_scopes {
+            match *impl_scopes {
                 cons(impl_scope, rest_impl_scopes) => {
                     debug!{"Impl scope %u:", i};
 
index e3103cfefc6df3c39c5382df0269991694b7f48d..783a856fd9d9a3cf02dcdfe890839b9f5b0b508f 100644 (file)
@@ -25,7 +25,7 @@ enum opt {
     range(@ast::expr, @ast::expr)
 }
 fn opt_eq(tcx: ty::ctxt, a: opt, b: opt) -> bool {
-    alt (a, b) {
+    match (a, b) {
       (lit(a), lit(b)) => const_eval::compare_lit_exprs(tcx, a, b) == 0,
       (range(a1, a2), range(b1, b2)) => {
         const_eval::compare_lit_exprs(tcx, a1, b1) == 0 &&
@@ -44,9 +44,9 @@ fn trans_opt(bcx: block, o: opt) -> opt_result {
     let _icx = bcx.insn_ctxt(~"alt::trans_opt");
     let ccx = bcx.ccx();
     let mut bcx = bcx;
-    alt o {
+    match o {
       lit(l) => {
-        alt l.node {
+        match l.node {
           ast::expr_vstore(@{node: ast::expr_lit(
               @{node: ast::lit_str(s), _}), _},
                            ast::vstore_uniq) => {
@@ -112,7 +112,7 @@ fn assoc(key: ast::ident, list: bind_map) -> option<binding> {
 
 fn has_nested_bindings(m: match_, col: uint) -> bool {
     for vec::each(m) |br| {
-        alt br.pats[col].node {
+        match br.pats[col].node {
           ast::pat_ident(_, _, some(_)) => return true,
           _ => ()
         }
@@ -125,7 +125,7 @@ fn expand_nested_bindings(bcx: block, m: match_, col: uint, val: ValueRef)
 
     let mut result = ~[];
     for vec::each(m) |br| {
-      alt br.pats[col].node {
+      match br.pats[col].node {
           ast::pat_ident(mode, name, some(inner)) => {
             let pats = vec::append(
                 vec::slice(br.pats, 0u, col),
@@ -155,13 +155,13 @@ fn enter_match(bcx: block, dm: DefMap, m: match_, col: uint, val: ValueRef,
                e: enter_pat) -> match_ {
     let mut result = ~[];
     for vec::each(m) |br| {
-        alt e(br.pats[col]) {
+        match e(br.pats[col]) {
           some(sub) => {
             let pats = vec::append(
                 vec::append(sub, vec::view(br.pats, 0u, col)),
                 vec::view(br.pats, col + 1u, br.pats.len()));
             let self = br.pats[col];
-            let bound = alt self.node {
+            let bound = match self.node {
               ast::pat_ident(mode, name, none)
                   if !pat_is_variant(dm, self) => {
                 vec::append(br.bound,
@@ -186,7 +186,7 @@ fn enter_default(bcx: block, dm: DefMap, m: match_, col: uint, val: ValueRef)
               -> match_ {
 
     do enter_match(bcx, dm, m, col, val) |p| {
-        alt p.node {
+        match p.node {
           ast::pat_wild | ast::pat_rec(_, _) | ast::pat_tup(_) => some(~[]),
           ast::pat_ident(_, _, none) if !pat_is_variant(dm, p) => some(~[]),
           _ => none
@@ -199,7 +199,7 @@ fn enter_opt(bcx: block, m: match_, opt: opt, col: uint,
     let tcx = bcx.tcx();
     let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
     do enter_match(bcx, tcx.def_map, m, col, val) |p| {
-        alt p.node {
+        match p.node {
           ast::pat_enum(_, subpats) => {
             if opt_eq(tcx, variant_opt(tcx, p.id), opt) {
               some(option::get_default(subpats,
@@ -225,7 +225,7 @@ fn enter_rec(bcx: block, dm: DefMap, m: match_, col: uint,
              fields: ~[ast::ident], val: ValueRef) -> match_ {
     let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
     do enter_match(bcx, dm, m, col, val) |p| {
-        alt p.node {
+        match p.node {
           ast::pat_rec(fpats, _) => {
             let mut pats = ~[];
             for vec::each(fields) |fname| {
@@ -246,7 +246,7 @@ fn enter_tup(bcx: block, dm: DefMap, m: match_, col: uint, val: ValueRef,
              n_elts: uint) -> match_ {
     let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
     do enter_match(bcx, dm, m, col, val) |p| {
-        alt p.node {
+        match p.node {
           ast::pat_tup(elts) => some(elts),
           _ => some(vec::from_elem(n_elts, dummy))
         }
@@ -257,7 +257,7 @@ fn enter_box(bcx: block, dm: DefMap, m: match_, col: uint, val: ValueRef)
           -> match_ {
     let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
     do enter_match(bcx, dm, m, col, val) |p| {
-        alt p.node {
+        match p.node {
           ast::pat_box(sub) => some(~[sub]),
           _ => some(~[dummy])
         }
@@ -268,7 +268,7 @@ fn enter_uniq(bcx: block, dm: DefMap, m: match_, col: uint, val: ValueRef)
            -> match_ {
     let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
     do enter_match(bcx, dm, m, col, val) |p| {
-        alt p.node {
+        match p.node {
           ast::pat_uniq(sub) => some(~[sub]),
           _ => some(~[dummy])
         }
@@ -287,7 +287,7 @@ fn add_to_set(tcx: ty::ctxt, &&set: dvec<opt>, val: opt) {
         if pat_is_variant(ccx.tcx.def_map, cur) {
             add_to_set(ccx.tcx, found, variant_opt(ccx.tcx, br.pats[col].id));
         } else {
-            alt cur.node {
+            match cur.node {
               ast::pat_lit(l) => add_to_set(ccx.tcx, found, lit(l)),
               ast::pat_range(l1, l2) => {
                 add_to_set(ccx.tcx, found, range(l1, l2));
@@ -304,7 +304,9 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id,
    {vals: ~[ValueRef], bcx: block} {
     let _icx = bcx.insn_ctxt(~"alt::extract_variant_args");
     let ccx = bcx.fcx.ccx;
-    let enum_ty_substs = alt check ty::get(node_id_type(bcx, pat_id)).struct {
+    let enum_ty_substs = match check ty::get(node_id_type(bcx, pat_id))
+        .struct {
+
       ty::ty_enum(id, substs) => { assert id == vdefs.enm; substs.tps }
     };
     let mut blobptr = val;
@@ -328,7 +330,7 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id,
 fn collect_record_fields(m: match_, col: uint) -> ~[ast::ident] {
     let mut fields: ~[ast::ident] = ~[];
     for vec::each(m) |br| {
-        alt br.pats[col].node {
+        match br.pats[col].node {
           ast::pat_rec(fs, _) => {
             for vec::each(fs) |f| {
                 if !vec::any(fields, |x| str::eq(f.ident, x)) {
@@ -346,7 +348,7 @@ fn root_pats_as_necessary(bcx: block, m: match_, col: uint, val: ValueRef) {
     for vec::each(m) |br| {
         let pat_id = br.pats[col].id;
 
-        alt bcx.ccx().maps.root_map.find({id:pat_id, derefs:0u}) {
+        match bcx.ccx().maps.root_map.find({id:pat_id, derefs:0u}) {
           none => (),
           some(scope_id) => {
             // Note: the scope_id will always be the id of the alt.  See the
@@ -364,7 +366,7 @@ fn root_pats_as_necessary(bcx: block, m: match_, col: uint, val: ValueRef) {
 
 fn any_box_pat(m: match_, col: uint) -> bool {
     for vec::each(m) |br| {
-        alt br.pats[col].node {
+        match br.pats[col].node {
           ast::pat_box(_) => return true,
           _ => ()
         }
@@ -374,7 +376,7 @@ fn any_box_pat(m: match_, col: uint) -> bool {
 
 fn any_uniq_pat(m: match_, col: uint) -> bool {
     for vec::each(m) |br| {
-        alt br.pats[col].node {
+        match br.pats[col].node {
           ast::pat_uniq(_) => return true,
           _ => ()
         }
@@ -384,7 +386,7 @@ fn any_uniq_pat(m: match_, col: uint) -> bool {
 
 fn any_tup_pat(m: match_, col: uint) -> bool {
     for vec::each(m) |br| {
-        alt br.pats[col].node {
+        match br.pats[col].node {
           ast::pat_tup(_) => return true,
           _ => ()
         }
@@ -397,7 +399,7 @@ fn any_tup_pat(m: match_, col: uint) -> bool {
 
 fn pick_col(m: match_) -> uint {
     fn score(p: @ast::pat) -> uint {
-        alt p.node {
+        match p.node {
           ast::pat_lit(_) | ast::pat_enum(_, _) | ast::pat_range(_, _) => 1u,
           ast::pat_ident(_, _, some(p)) => score(p),
           _ => 0u
@@ -435,7 +437,7 @@ fn compile_submatch(bcx: block, m: match_, vals: ~[ValueRef],
     if m.len() == 0u { Br(bcx, option::get(chk)()); return; }
     if m[0].pats.len() == 0u {
         let data = m[0].data;
-        alt data.guard {
+        match data.guard {
           some(e) => {
             // Temporarily set bindings. They'll be rewritten to PHI nodes
             // for the actual arm block.
@@ -512,7 +514,7 @@ fn compile_submatch(bcx: block, m: match_, vals: ~[ValueRef],
 
     if any_tup_pat(m, col) {
         let tup_ty = node_id_type(bcx, pat_id);
-        let n_tup_elts = alt ty::get(tup_ty).struct {
+        let n_tup_elts = match ty::get(tup_ty).struct {
           ty::ty_tup(elts) => elts.len(),
           _ => ccx.sess.bug(~"non-tuple type in tuple pattern")
         };
@@ -553,7 +555,7 @@ enum branch_kind { no_branch, single, switch, compare, }
     let mut kind = no_branch;
     let mut test_val = val;
     if opts.len() > 0u {
-        alt opts[0] {
+        match opts[0] {
           var(_, vdef) => {
             if (*ty::enum_variants(tcx, vdef.enm)).len() == 1u {
                 kind = single;
@@ -578,12 +580,12 @@ enum branch_kind { no_branch, single, switch, compare, }
         }
     }
     for vec::each(opts) |o| {
-        alt o {
+        match o {
           range(_, _) => { kind = compare; break }
           _ => ()
         }
     }
-    let else_cx = alt kind {
+    let else_cx = match kind {
       no_branch | single => bcx,
       _ => sub_block(bcx, ~"match_else")
     };
@@ -601,10 +603,10 @@ enum branch_kind { no_branch, single, switch, compare, }
         let mut opt_cx = else_cx;
         if !exhaustive || i < len {
             opt_cx = sub_block(bcx, ~"match_case");
-            alt kind {
+            match kind {
               single => Br(bcx, opt_cx.llbb),
               switch => {
-                alt check trans_opt(bcx, opt) {
+                match check trans_opt(bcx, opt) {
                   single_result(r) => {
                     llvm::LLVMAddCase(sw, r.val, opt_cx.llbb);
                     bcx = r.bcx;
@@ -615,7 +617,7 @@ enum branch_kind { no_branch, single, switch, compare, }
                 let t = node_id_type(bcx, pat_id);
                 let {bcx: after_cx, val: matches} = {
                     do with_scope_result(bcx, none, ~"compare_scope") |bcx| {
-                        alt trans_opt(bcx, opt) {
+                        match trans_opt(bcx, opt) {
                           single_result({bcx, val}) => {
                             trans_compare(bcx, ast::eq, test_val, t, val, t)
                           }
@@ -638,7 +640,7 @@ enum branch_kind { no_branch, single, switch, compare, }
         } else if kind == compare { Br(bcx, else_cx.llbb); }
         let mut size = 0u;
         let mut unpacked = ~[];
-        alt opt {
+        match opt {
           var(_, vdef) => {
             let args = extract_variant_args(opt_cx, pat_id, vdef, val);
             size = args.vals.len();
@@ -671,7 +673,7 @@ fn make_phi_bindings(bcx: block, map: ~[exit_node],
         let mut vals = ~[];
         for vec::each(map) |ex| {
             if ex.to as uint == our_block {
-                alt assoc(name, ex.bound) {
+                match assoc(name, ex.bound) {
                   some(binding) => {
                     vec::push(llbbs, ex.from);
                     vec::push(vals, binding.val);
@@ -774,14 +776,14 @@ fn trans_alt_inner(scope_cx: block, expr: @ast::expr, arms: ~[ast::arm],
 
     fn mk_fail(bcx: block, sp: span, msg: ~str,
                    done: @mut option<BasicBlockRef>) -> BasicBlockRef {
-            alt *done { some(bb) => return bb, _ => () }
+            match *done { some(bb) => return bb, _ => () }
             let fail_cx = sub_block(bcx, ~"case_fallthrough");
             trans_fail(fail_cx, some(sp), msg);
             *done = some(fail_cx.llbb);
             return fail_cx.llbb;
     }
     let t = node_id_type(bcx, expr.id);
-    let mk_fail = alt mode {
+    let mk_fail = match mode {
       ast::alt_check => {
         let fail_cx = @mut none;
         // Cached fail-on-fallthrough block
@@ -829,7 +831,7 @@ fn bind_irrefutable_pat(bcx: block, pat: @ast::pat, val: ValueRef,
     let mut bcx = bcx;
 
     // Necessary since bind_irrefutable_pat is called outside trans_alt
-    alt pat.node {
+    match pat.node {
       ast::pat_ident(_, _,inner) => {
         if pat_is_variant(bcx.tcx().def_map, pat) { return bcx; }
         if make_copy {
@@ -841,7 +843,7 @@ fn bind_irrefutable_pat(bcx: block, pat: @ast::pat, val: ValueRef,
             bcx.fcx.lllocals.insert(pat.id, local_mem(alloc));
             add_clean(bcx, alloc, ty);
         } else { bcx.fcx.lllocals.insert(pat.id, local_mem(val)); }
-        alt inner {
+        match inner {
           some(pat) => { bcx = bind_irrefutable_pat(bcx, pat, val, true); }
           _ => ()
         }
index 6fecdead0485e07ee3be1adc89f9b41932d64b16..6e882d71c00587e8374fa70ea55cd7da286beb6f 100644 (file)
@@ -66,7 +66,7 @@ enum dest {
 }
 
 fn dest_str(ccx: @crate_ctxt, d: dest) -> ~str {
-    alt d {
+    match d {
       by_val(v) => fmt!{"by_val(%s)", val_str(ccx.tn, *v)},
       save_in(v) => fmt!{"save_in(%s)", val_str(ccx.tn, v)},
       ignore => ~"ignore"
@@ -78,7 +78,7 @@ fn empty_dest_cell() -> @mut ValueRef {
 }
 
 fn dup_for_join(dest: dest) -> dest {
-    alt dest {
+    match dest {
       by_val(_) => by_val(empty_dest_cell()),
       _ => dest
     }
@@ -128,7 +128,7 @@ fn join_returns(parent_cx: block, in_cxs: ~[block],
         if !cx.unreachable {
             Br(cx, out.llbb);
             reachable = true;
-            alt in_ds[i] {
+            match in_ds[i] {
               by_val(cell) => {
                 if option::is_none(phi) {
                     phi = some(EmptyPhi(out, val_ty(*cell)));
@@ -143,7 +143,7 @@ fn join_returns(parent_cx: block, in_cxs: ~[block],
     if !reachable {
         Unreachable(out);
     } else {
-        alt out_dest {
+        match out_dest {
           by_val(cell) => *cell = option::get(phi),
           _ => ()
         }
@@ -153,7 +153,7 @@ fn join_returns(parent_cx: block, in_cxs: ~[block],
 
 // Used to put an immediate value in a dest.
 fn store_in_dest(bcx: block, val: ValueRef, dest: dest) -> block {
-    alt dest {
+    match dest {
       ignore => (),
       by_val(cell) => *cell = val,
       save_in(addr) => Store(bcx, val, addr)
@@ -162,7 +162,7 @@ fn store_in_dest(bcx: block, val: ValueRef, dest: dest) -> block {
 }
 
 fn get_dest_addr(dest: dest) -> ValueRef {
-    alt dest {
+    match dest {
        save_in(a) => a,
        _ => fail ~"get_dest_addr: not a save_in"
     }
@@ -359,7 +359,7 @@ fn malloc_raw_dyn(bcx: block, t: ty::t, heap: heap,
     let _icx = bcx.insn_ctxt(~"malloc_raw");
     let ccx = bcx.ccx();
 
-    let (mk_fn, rtcall) = alt heap {
+    let (mk_fn, rtcall) = match heap {
       heap_shared => (ty::mk_imm_box, ~"malloc"),
       heap_exchange => (ty::mk_imm_uniq, ~"exchange_malloc")
     };
@@ -419,7 +419,7 @@ fn get_tydesc_simple(ccx: @crate_ctxt, t: ty::t) -> ValueRef {
 }
 
 fn get_tydesc(ccx: @crate_ctxt, t: ty::t) -> @tydesc_info {
-    alt ccx.tydescs.find(t) {
+    match ccx.tydescs.find(t) {
       some(inf) => inf,
       _ => {
         ccx.stats.n_static_tydescs += 1u;
@@ -454,7 +454,7 @@ fn set_inline_hint(f: ValueRef) {
 
 fn set_inline_hint_if_appr(attrs: ~[ast::attribute],
                            llfn: ValueRef) {
-    alt attr::find_inline_attr(attrs) {
+    match attr::find_inline_attr(attrs) {
       attr::ia_hint => set_inline_hint(llfn),
       attr::ia_always => set_always_inline(llfn),
       attr::ia_never => set_no_inline(llfn),
@@ -577,22 +577,22 @@ fn emit_tydescs(ccx: @crate_ctxt) {
         let glue_fn_ty = T_ptr(T_glue_fn(ccx));
         let ti = val;
         let take_glue =
-            alt copy ti.take_glue {
+            match copy ti.take_glue {
               none => { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
               some(v) => { ccx.stats.n_real_glues += 1u; v }
             };
         let drop_glue =
-            alt copy ti.drop_glue {
+            match copy ti.drop_glue {
               none => { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
               some(v) => { ccx.stats.n_real_glues += 1u; v }
             };
         let free_glue =
-            alt copy ti.free_glue {
+            match copy ti.free_glue {
               none => { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
               some(v) => { ccx.stats.n_real_glues += 1u; v }
             };
         let visit_glue =
-            alt copy ti.visit_glue {
+            match copy ti.visit_glue {
               none => { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
               some(v) => { ccx.stats.n_real_glues += 1u; v }
             };
@@ -623,7 +623,7 @@ fn emit_tydescs(ccx: @crate_ctxt) {
 fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) {
     let _icx = bcx.insn_ctxt(~"make_take_glue");
     // NB: v is a *pointer* to type t here, not a direct value.
-    let bcx = alt ty::get(t).struct {
+    let bcx = match ty::get(t).struct {
       ty::ty_box(_) | ty::ty_opaque_box |
       ty::ty_evec(_, ty::vstore_box) | ty::ty_estr(ty::vstore_box) => {
         incr_refcnt_of_boxed(bcx, Load(bcx, v)); bcx
@@ -689,7 +689,7 @@ fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) {
     // everything to a pointer to the type that the glue acts on).
     let _icx = bcx.insn_ctxt(~"make_free_glue");
     let ccx = bcx.ccx();
-    let bcx = alt ty::get(t).struct {
+    let bcx = match ty::get(t).struct {
       ty::ty_box(body_mt) => {
         let v = PointerCast(bcx, v, type_of(ccx, t));
         let body = GEPi(bcx, v, ~[0u, abi::box_field_body]);
@@ -770,7 +770,7 @@ fn make_drop_glue(bcx: block, v0: ValueRef, t: ty::t) {
     // NB: v0 is an *alias* of type t here, not a direct value.
     let _icx = bcx.insn_ctxt(~"make_drop_glue");
     let ccx = bcx.ccx();
-    let bcx = alt ty::get(t).struct {
+    let bcx = match ty::get(t).struct {
       ty::ty_box(_) | ty::ty_opaque_box |
       ty::ty_estr(ty::vstore_box) | ty::ty_evec(_, ty::vstore_box) => {
         decr_refcnt_maybe_free(bcx, Load(bcx, v0), t)
@@ -784,7 +784,7 @@ fn make_drop_glue(bcx: block, v0: ValueRef, t: ty::t) {
       }
       ty::ty_class(did, substs) => {
         let tcx = bcx.tcx();
-        alt ty::ty_dtor(tcx, did) {
+        match ty::ty_dtor(tcx, did) {
           some(dtor) => {
             trans_class_drop(bcx, v0, dtor, did, substs)
           }
@@ -880,7 +880,7 @@ fn compare_scalar_types(cx: block, lhs: ValueRef, rhs: ValueRef,
                         t: ty::t, op: ast::binop) -> result {
     let f = |a| compare_scalar_values(cx, lhs, rhs, a, op);
 
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_nil => return rslt(cx, f(nil_type)),
       ty::ty_bool | ty::ty_ptr(_) => return rslt(cx, f(unsigned_int)),
       ty::ty_int(_) => return rslt(cx, f(signed_int)),
@@ -909,11 +909,11 @@ fn die_(cx: block) -> ! {
           comparison operator");
     }
     let die = fn@() -> ! { die_(cx) };
-    alt nt {
+    match nt {
       nil_type => {
         // We don't need to do actual comparisons for nil.
         // () == () holds but () < () does not.
-        alt op {
+        match op {
           ast::eq | ast::le | ast::ge => return C_bool(true),
           ast::ne | ast::lt | ast::gt => return C_bool(false),
           // refinements would be nice
@@ -921,7 +921,7 @@ fn die_(cx: block) -> ! {
         }
       }
       floating_point => {
-        let cmp = alt op {
+        let cmp = match op {
           ast::eq => lib::llvm::RealOEQ,
           ast::ne => lib::llvm::RealUNE,
           ast::lt => lib::llvm::RealOLT,
@@ -933,7 +933,7 @@ fn die_(cx: block) -> ! {
         return FCmp(cx, cmp, lhs, rhs);
       }
       signed_int => {
-        let cmp = alt op {
+        let cmp = match op {
           ast::eq => lib::llvm::IntEQ,
           ast::ne => lib::llvm::IntNE,
           ast::lt => lib::llvm::IntSLT,
@@ -945,7 +945,7 @@ fn die_(cx: block) -> ! {
         return ICmp(cx, cmp, lhs, rhs);
       }
       unsigned_int => {
-        let cmp = alt op {
+        let cmp = match op {
           ast::eq => lib::llvm::IntEQ,
           ast::ne => lib::llvm::IntNE,
           ast::lt => lib::llvm::IntULT,
@@ -985,7 +985,7 @@ fn iter_variant(cx: block, a_tup: ValueRef,
         let fn_ty = variant.ctor_ty;
         let ccx = cx.ccx();
         let mut cx = cx;
-        alt ty::get(fn_ty).struct {
+        match ty::get(fn_ty).struct {
           ty::ty_fn({inputs: args, _}) => {
             let mut j = 0u;
             let v_id = variant.id;
@@ -1005,7 +1005,7 @@ fn iter_variant(cx: block, a_tup: ValueRef,
     Typestate constraint that shows the unimpl case doesn't happen?
     */
     let mut cx = cx;
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_rec(fields) => {
         for vec::eachi(fields) |i, fld| {
             let llfld_a = GEPi(cx, av, ~[0u, i]);
@@ -1090,7 +1090,7 @@ fn lazily_emit_tydesc_glue(ccx: @crate_ctxt, field: uint,
                            ti: @tydesc_info) {
     let _icx = ccx.insn_ctxt(~"lazily_emit_tydesc_glue");
     if field == abi::tydesc_field_take_glue {
-        alt ti.take_glue {
+        match ti.take_glue {
           some(_) => (),
           none => {
             debug!{"+++ lazily_emit_tydesc_glue TAKE %s",
@@ -1105,7 +1105,7 @@ fn lazily_emit_tydesc_glue(ccx: @crate_ctxt, field: uint,
           }
         }
     } else if field == abi::tydesc_field_drop_glue {
-        alt ti.drop_glue {
+        match ti.drop_glue {
           some(_) => (),
           none => {
             debug!{"+++ lazily_emit_tydesc_glue DROP %s",
@@ -1120,7 +1120,7 @@ fn lazily_emit_tydesc_glue(ccx: @crate_ctxt, field: uint,
           }
         }
     } else if field == abi::tydesc_field_free_glue {
-        alt ti.free_glue {
+        match ti.free_glue {
           some(_) => (),
           none => {
             debug!{"+++ lazily_emit_tydesc_glue FREE %s",
@@ -1135,7 +1135,7 @@ fn lazily_emit_tydesc_glue(ccx: @crate_ctxt, field: uint,
           }
         }
     } else if field == abi::tydesc_field_visit_glue {
-        alt ti.visit_glue {
+        match ti.visit_glue {
           some(_) => (),
           none => {
             debug!{"+++ lazily_emit_tydesc_glue VISIT %s",
@@ -1159,7 +1159,7 @@ fn call_tydesc_glue_full(++cx: block, v: ValueRef, tydesc: ValueRef,
         if cx.unreachable { return; }
 
     let mut static_glue_fn = none;
-    alt static_ti {
+    match static_ti {
       none => {/* no-op */ }
       some(sti) => {
         lazily_emit_tydesc_glue(cx.ccx(), field, sti);
@@ -1178,7 +1178,7 @@ fn call_tydesc_glue_full(++cx: block, v: ValueRef, tydesc: ValueRef,
     let llrawptr = PointerCast(cx, v, T_ptr(T_i8()));
 
     let llfn = {
-        alt static_glue_fn {
+        match static_glue_fn {
           none => {
             // Select out the glue function to call from the tydesc
             let llfnptr = GEPi(cx, tydesc, ~[0u, field]);
@@ -1240,7 +1240,7 @@ fn drop_ty(cx: block, v: ValueRef, t: ty::t) -> block {
 
 fn drop_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block {
     let _icx = bcx.insn_ctxt(~"drop_ty_immediate");
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_uniq(_) |
       ty::ty_evec(_, ty::vstore_uniq) |
       ty::ty_estr(ty::vstore_uniq) => {
@@ -1257,7 +1257,7 @@ fn drop_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block {
 
 fn take_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> result {
     let _icx = bcx.insn_ctxt(~"take_ty_immediate");
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_box(_) | ty::ty_opaque_box |
       ty::ty_evec(_, ty::vstore_box) |
       ty::ty_estr(ty::vstore_box) => {
@@ -1291,7 +1291,7 @@ fn call_memmove(cx: block, dst: ValueRef, src: ValueRef,
     // constant element of a tydesc works).
     let _icx = cx.insn_ctxt(~"call_memmove");
     let ccx = cx.ccx();
-    let key = alt ccx.sess.targ_cfg.arch {
+    let key = match ccx.sess.targ_cfg.arch {
       session::arch_x86 | session::arch_arm => ~"llvm.memmove.p0i8.p0i8.i32",
       session::arch_x86_64 => ~"llvm.memmove.p0i8.p0i8.i64"
     };
@@ -1320,7 +1320,7 @@ enum copy_action { INIT, DROP_EXISTING, }
 // These are the types that are passed by pointer.
 fn type_is_structural_or_param(t: ty::t) -> bool {
     if ty::type_is_structural(t) { return true; }
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_param(*) => return true,
       _ => return false
     }
@@ -1446,7 +1446,7 @@ fn trans_unary(bcx: block, op: ast::unop, e: @ast::expr,
                un_expr: @ast::expr, dest: dest) -> block {
     let _icx = bcx.insn_ctxt(~"trans_unary");
     // Check for user-defined method call
-    alt bcx.ccx().maps.method_map.find(un_expr.id) {
+    match bcx.ccx().maps.method_map.find(un_expr.id) {
       some(mentry) => {
         let fty = node_id_type(bcx, un_expr.callee_id);
         return trans_call_inner(
@@ -1461,7 +1461,7 @@ fn trans_unary(bcx: block, op: ast::unop, e: @ast::expr,
 
     if dest == ignore { return trans_expr(bcx, e, ignore); }
     let e_ty = expr_ty(bcx, e);
-    alt op {
+    match op {
       ast::not => {
         let {bcx, val} = trans_temp_expr(bcx, e);
         store_in_dest(bcx, Not(bcx, val), dest)
@@ -1508,7 +1508,7 @@ fn trans_compare(cx: block, op: ast::binop, lhs: ValueRef,
 
     // Determine the operation we need.
     let llop = {
-        alt op {
+        match op {
           ast::eq | ast::ne => C_u8(abi::cmp_glue_op_eq),
           ast::lt | ast::ge => C_u8(abi::cmp_glue_op_lt),
           ast::le | ast::gt => C_u8(abi::cmp_glue_op_le),
@@ -1519,7 +1519,7 @@ fn trans_compare(cx: block, op: ast::binop, lhs: ValueRef,
     let cmpval = call_cmp_glue(cx, lhs, rhs, rhs_t, llop);
 
     // Invert the result if necessary.
-    alt op {
+    match op {
       ast::eq | ast::lt | ast::le => rslt(cx, cmpval),
       ast::ne | ast::ge | ast::gt => rslt(cx, Not(cx, cmpval)),
       _ => cx.tcx().sess.bug(~"trans_compare got non-comparison-op")
@@ -1571,7 +1571,7 @@ fn fail_if_zero(cx: block, span: span, divmod: ast::binop,
     } else {
         ~"modulo zero"
     };
-    let is_zero = alt ty::get(rhs_t).struct {
+    let is_zero = match ty::get(rhs_t).struct {
       ty::ty_int(t) => {
         let zero = C_integral(T_int_ty(cx.ccx(), t), 0u64, False);
         ICmp(cx, lib::llvm::IntEQ, rhs, zero)
@@ -1607,7 +1607,7 @@ fn trans_eager_binop(cx: block, span: span, op: ast::binop, lhs: ValueRef,
     let rhs = cast_shift_expr_rhs(cx, op, lhs, rhs);
 
     let mut cx = cx;
-    let val = alt op {
+    let val = match op {
       ast::add => {
         if is_float { FAdd(cx, lhs, rhs) }
         else { Add(cx, lhs, rhs) }
@@ -1673,7 +1673,7 @@ fn trans_assign_op(bcx: block, ex: @ast::expr, op: ast::binop,
     assert (lhs_res.kind == lv_owned);
 
     // A user-defined operator method
-    alt bcx.ccx().maps.method_map.find(ex.id) {
+    match bcx.ccx().maps.method_map.find(ex.id) {
       some(origin) => {
         let bcx = lhs_res.bcx;
         debug!{"user-defined method callee_id: %s",
@@ -1738,14 +1738,14 @@ fn autoderef(cx: block, e_id: ast::node_id,
 
         // root the autoderef'd value, if necessary:
         derefs += 1u;
-        alt ccx.maps.root_map.find({id:e_id, derefs:derefs}) {
+        match ccx.maps.root_map.find({id:e_id, derefs:derefs}) {
           none => (),
           some(scope_id) => {
             root_value(cx, v1, t1, scope_id);
           }
         }
 
-        alt ty::get(t1).struct {
+        match ty::get(t1).struct {
           ty::ty_box(mt) => {
             let body = GEPi(cx, v1, ~[0u, abi::box_field_body]);
             t1 = mt.ty;
@@ -1800,7 +1800,7 @@ fn trans_lazy_binop(bcx: block, op: lazy_binop_ty, a: @ast::expr,
     if past_lhs.unreachable { return past_lhs; }
     let join = sub_block(bcx, ~"join"), before_rhs = sub_block(bcx, ~"rhs");
 
-    alt op {
+    match op {
       lazy_and => CondBr(past_lhs, lhs, before_rhs.llbb, join.llbb),
       lazy_or => CondBr(past_lhs, lhs, join.llbb, before_rhs.llbb)
     }
@@ -1821,7 +1821,7 @@ fn trans_binary(bcx: block, op: ast::binop, lhs: @ast::expr,
                 rhs: @ast::expr, dest: dest, ex: @ast::expr) -> block {
     let _icx = bcx.insn_ctxt(~"trans_binary");
     // User-defined operators
-    alt bcx.ccx().maps.method_map.find(ex.id) {
+    match bcx.ccx().maps.method_map.find(ex.id) {
       some(origin) => {
         let fty = node_id_type(bcx, ex.callee_id);
         return trans_call_inner(
@@ -1836,7 +1836,7 @@ fn trans_binary(bcx: block, op: ast::binop, lhs: @ast::expr,
     }
 
     // First couple cases are lazy:
-    alt op {
+    match op {
       ast::and => {
         return trans_lazy_binop(bcx, lazy_and, lhs, rhs, dest);
       }
@@ -1872,9 +1872,9 @@ fn trans_if(cx: block, cond: @ast::expr, thn: ast::blk,
     // because trans_expr will create another scope block
     // context for the block, but we've already got the
     // 'else' context
-    let else_bcx = alt els {
+    let else_bcx = match els {
       some(elexpr) => {
-        alt elexpr.node {
+        match elexpr.node {
           ast::expr_if(_, _, _) => {
             let elseif_blk = ast_util::block_from_expr(elexpr);
             trans_block(else_cx, elseif_blk, else_dest)
@@ -1960,7 +1960,7 @@ fn lval_no_env(bcx: block, val: ValueRef, kind: lval_kind)
 fn trans_external_path(ccx: @crate_ctxt, did: ast::def_id, t: ty::t)
     -> ValueRef {
     let name = csearch::get_symbol(ccx.sess.cstore, did);
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_fn(_) => {
         let llty = type_of_fn_from_ty(ccx, t);
         return get_extern_fn(ccx.externs, ccx.llmod, name,
@@ -1975,7 +1975,7 @@ fn trans_external_path(ccx: @crate_ctxt, did: ast::def_id, t: ty::t)
 
 fn normalize_for_monomorphization(tcx: ty::ctxt, ty: ty::t) -> option<ty::t> {
     // FIXME[mono] could do this recursively. is that worthwhile? (#2529)
-    alt ty::get(ty).struct {
+    match ty::get(ty).struct {
       ty::ty_box(mt) => {
         some(ty::mk_opaque_box(tcx))
       }
@@ -2001,14 +2001,14 @@ fn normalize_for_monomorphization(tcx: ty::ctxt, ty: ty::t) -> option<ty::t> {
 fn make_mono_id(ccx: @crate_ctxt, item: ast::def_id, substs: ~[ty::t],
                 vtables: option<typeck::vtable_res>,
                 param_uses: option<~[type_use::type_uses]>) -> mono_id {
-    let precise_param_ids = alt vtables {
+    let precise_param_ids = match vtables {
       some(vts) => {
         let bounds = ty::lookup_item_type(ccx.tcx, item).bounds;
         let mut i = 0u;
         vec::map2(*bounds, substs, |bounds, subst| {
             let mut v = ~[];
             for vec::each(*bounds) |bound| {
-                alt bound {
+                match bound {
                   ty::bound_trait(_) => {
                     vec::push(v, impl::vtable_id(ccx, vts[i]));
                     i += 1u;
@@ -2023,10 +2023,10 @@ fn make_mono_id(ccx: @crate_ctxt, item: ast::def_id, substs: ~[ty::t],
         vec::map(substs, |subst| mono_precise(subst, none))
       }
     };
-    let param_ids = alt param_uses {
+    let param_ids = match param_uses {
       some(uses) => {
         vec::map2(precise_param_ids, uses, |id, uses| {
-            alt check id {
+            match check id {
               mono_precise(_, some(_)) => id,
               mono_precise(subst, none) => {
                 if uses == 0u { mono_any }
@@ -2058,7 +2058,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
     let _icx = ccx.insn_ctxt(~"monomorphic_fn");
     let mut must_cast = false;
     let substs = vec::map(real_substs, |t| {
-        alt normalize_for_monomorphization(ccx.tcx, t) {
+        match normalize_for_monomorphization(ccx.tcx, t) {
           some(t) => { must_cast = true; t }
           none => t
         }
@@ -2069,7 +2069,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
     let param_uses = type_use::type_uses_for(ccx, fn_id, substs.len());
     let hash_id = make_mono_id(ccx, fn_id, substs, vtables, some(param_uses));
     if vec::any(hash_id.params,
-                |p| alt p { mono_precise(_, _) => false, _ => true }) {
+                |p| match p { mono_precise(_, _) => false, _ => true }) {
         must_cast = true;
     }
 
@@ -2079,7 +2079,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
            real_substs.map(|s| ty_to_str(ccx.tcx, s)),
            substs.map(|s| ty_to_str(ccx.tcx, s)), hash_id];
 
-    alt ccx.monomorphized.find(hash_id) {
+    match ccx.monomorphized.find(hash_id) {
       some(val) => {
         debug!{"leaving monomorphic fn %s",
                ty::item_path_str(ccx.tcx, fn_id)};
@@ -2096,7 +2096,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
         (may have attempted to monomorphize an item defined in a different \
         crate?)", fn_id});
     // Get the path so that we can create a symbol
-    let (pt, name, span) = alt map_node {
+    let (pt, name, span) = match map_node {
       ast_map::node_item(i, pt) => (pt, i.ident, i.span),
       ast_map::node_variant(v, enm, pt) => (pt, v.node.name, enm.span),
       ast_map::node_method(m, _, pt) => (pt, m.ident, m.span),
@@ -2149,7 +2149,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
     };
 
     let psubsts = some({tys: substs, vtables: vtables, bounds: tpt.bounds});
-    let lldecl = alt map_node {
+    let lldecl = match map_node {
       ast_map::node_item(i@@{node: ast::item_fn(decl, _, body), _}, _) => {
         let d = mk_lldecl();
         set_inline_hint_if_appr(i.attrs, d);
@@ -2195,7 +2195,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
         d
       }
       ast_map::node_dtor(_, dtor, _, pt) => {
-        let parent_id = alt ty::ty_to_def_id(ty::node_id_to_type(ccx.tcx,
+        let parent_id = match ty::ty_to_def_id(ty::node_id_to_type(ccx.tcx,
                                               dtor.node.self_id)) {
                 some(did) => did,
                 none      => ccx.sess.span_bug(dtor.span, ~"Bad self ty in \
@@ -2231,7 +2231,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
 fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
     -> ast::def_id {
     let _icx = ccx.insn_ctxt(~"maybe_instantiate_inline");
-    alt ccx.external.find(fn_id) {
+    match ccx.external.find(fn_id) {
       some(some(node_id)) => {
         // Already inline
         debug!{"maybe_instantiate_inline(%s): already inline as node id %d",
@@ -2240,7 +2240,7 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
       }
       some(none) => fn_id, // Not inlinable
       none => { // Not seen yet
-        alt csearch::maybe_get_item_ast(
+        match csearch::maybe_get_item_ast(
             ccx.tcx, fn_id,
             |a,b,c,d| {
                 astencode::decode_inlined_item(a, b, ccx.maps, c, d)
@@ -2266,7 +2266,7 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
           csearch::found_parent(parent_id, ast::ii_item(item)) => {
             ccx.external.insert(parent_id, some(item.id));
             let mut my_id = 0;
-            alt check item.node {
+            match check item.node {
               ast::item_enum(_, _) => {
                 let vs_here = ty::enum_variants(ccx.tcx, local_def(item.id));
                 let vs_there = ty::enum_variants(ccx.tcx, parent_id);
@@ -2350,9 +2350,9 @@ fn lval_static_fn_inner(bcx: block, fn_id: ast::def_id, id: ast::node_id,
             ccx, node_id_type(bcx, id))));
     }
 
-    alt ty::get(tpt.ty).struct {
+    match ty::get(tpt.ty).struct {
       ty::ty_fn(fn_ty) => {
-        alt fn_ty.purity {
+        match fn_ty.purity {
           ast::extern_fn => {
             // Extern functions are just opaque pointers
             let val = PointerCast(bcx, val, T_ptr(T_i8()));
@@ -2369,7 +2369,7 @@ fn lval_static_fn_inner(bcx: block, fn_id: ast::def_id, id: ast::node_id,
 
 fn lookup_discriminant(ccx: @crate_ctxt, vid: ast::def_id) -> ValueRef {
     let _icx = ccx.insn_ctxt(~"lookup_discriminant");
-    alt ccx.discrims.find(vid) {
+    match ccx.discrims.find(vid) {
       none => {
         // It's an external discriminant that we haven't seen yet.
         assert (vid.crate != ast::local_crate);
@@ -2394,13 +2394,13 @@ fn trans_local_var(cx: block, def: ast::def) -> local_var_result {
     let _icx = cx.insn_ctxt(~"trans_local_var");
     fn take_local(table: hashmap<ast::node_id, local_val>,
                   id: ast::node_id) -> local_var_result {
-        alt table.find(id) {
+        match table.find(id) {
           some(local_mem(v)) => {val: v, kind: lv_owned},
           some(local_imm(v)) => {val: v, kind: lv_owned_imm},
           r => fail(~"take_local: internal error")
         }
     }
-    alt def {
+    match def {
       ast::def_upvar(nid, _, _) => {
         assert (cx.fcx.llupvars.contains_key(nid));
         return { val: cx.fcx.llupvars.get(nid), kind: lv_owned };
@@ -2414,7 +2414,7 @@ fn take_local(table: hashmap<ast::node_id, local_val>,
         return take_local(cx.fcx.lllocals, nid);
       }
       ast::def_self(sid) => {
-        let slf = alt copy cx.fcx.llself {
+        let slf = match copy cx.fcx.llself {
           some(s) => cast_self(cx, s),
           none => cx.sess().bug(~"trans_local_var: reference to self \
                                  out of context")
@@ -2431,7 +2431,7 @@ fn take_local(table: hashmap<ast::node_id, local_val>,
 fn trans_path(cx: block, id: ast::node_id)
     -> lval_maybe_callee {
     let _icx = cx.insn_ctxt(~"trans_path");
-    alt cx.tcx().def_map.find(id) {
+    match cx.tcx().def_map.find(id) {
       none => cx.sess().bug(~"trans_path: unbound node ID"),
       some(df) => {
           return trans_var(cx, df, id);
@@ -2442,7 +2442,7 @@ fn trans_path(cx: block, id: ast::node_id)
 fn trans_var(cx: block, def: ast::def, id: ast::node_id)-> lval_maybe_callee {
     let _icx = cx.insn_ctxt(~"trans_var");
     let ccx = cx.ccx();
-    alt def {
+    match def {
       ast::def_fn(did, _) => {
         return lval_static_fn(cx, did, id);
       }
@@ -2491,7 +2491,7 @@ fn trans_rec_field(bcx: block, base: @ast::expr,
 fn trans_rec_field_inner(bcx: block, val: ValueRef, ty: ty::t,
                          field: ast::ident, sp: span) -> lval_result {
     let mut llderef = false;
-    let fields = alt ty::get(ty).struct {
+    let fields = match ty::get(ty).struct {
        ty::ty_rec(fs) => fs,
        ty::ty_class(did, substs) => {
          if option::is_some(ty::ty_dtor(bcx.tcx(), did)) {
@@ -2583,12 +2583,12 @@ fn expr_is_lval(bcx: block, e: @ast::expr) -> bool {
 
 fn trans_callee(bcx: block, e: @ast::expr) -> lval_maybe_callee {
     let _icx = bcx.insn_ctxt(~"trans_callee");
-    alt e.node {
+    match e.node {
       ast::expr_path(path) => return trans_path(bcx, e.id),
       ast::expr_field(base, _, _) => {
         // Lval means this is a record field, so not a method
         if !expr_is_lval(bcx, e) {
-            alt bcx.ccx().maps.method_map.find(e.id) {
+            match bcx.ccx().maps.method_map.find(e.id) {
               some(origin) => { // An impl method
                 return impl::trans_method_callee(bcx, e.id, base, origin);
               }
@@ -2609,7 +2609,7 @@ fn trans_callee(bcx: block, e: @ast::expr) -> lval_maybe_callee {
 // represented as an alloca or heap, hence needs a 'load' to be used as an
 // immediate).
 fn trans_lval(cx: block, e: @ast::expr) -> lval_result {
-    return alt cx.ccx().maps.root_map.find({id:e.id, derefs:0u}) {
+    return match cx.ccx().maps.root_map.find({id:e.id, derefs:0u}) {
       // No need to root this lvalue.
       none => unrooted(cx, e),
 
@@ -2634,7 +2634,7 @@ fn trans_lval(cx: block, e: @ast::expr) -> lval_result {
 
     fn unrooted(cx: block, e: @ast::expr) -> lval_result {
         let _icx = cx.insn_ctxt(~"trans_lval");
-        alt e.node {
+        match e.node {
           ast::expr_path(_) => {
             let v = trans_path(cx, e.id);
             return lval_maybe_callee_to_lval(v, e.span);
@@ -2649,7 +2649,7 @@ fn unrooted(cx: block, e: @ast::expr) -> lval_result {
             let ccx = cx.ccx();
             let sub = trans_temp_expr(cx, base);
             let t = expr_ty(cx, base);
-            let val = alt check ty::get(t).struct {
+            let val = match check ty::get(t).struct {
               ty::ty_box(_) => {
                 let non_gc_val = non_gc_box_cast(sub.bcx, sub.val);
                 GEPi(sub.bcx, non_gc_val, ~[0u, abi::box_field_body])
@@ -2689,7 +2689,7 @@ fn non_gc_box_cast(cx: block, val: ValueRef) -> ValueRef {
 }
 
 fn lval_maybe_callee_to_lval(c: lval_maybe_callee, sp: span) -> lval_result {
-    alt c.env {
+    match c.env {
       self_env(*) => {
         c.bcx.sess().span_bug(sp, ~"implicitly binding method call");
       }
@@ -2732,7 +2732,7 @@ fn float_cast(bcx: block, lldsttype: TypeRef, llsrctype: TypeRef,
 enum cast_kind { cast_pointer, cast_integral, cast_float,
                 cast_enum, cast_other, }
 fn cast_type_kind(t: ty::t) -> cast_kind {
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_float(*)   => cast_float,
       ty::ty_ptr(*)     => cast_pointer,
       ty::ty_rptr(*)    => cast_pointer,
@@ -2750,7 +2750,7 @@ fn trans_cast(cx: block, e: @ast::expr, id: ast::node_id,
     let _icx = cx.insn_ctxt(~"trans_cast");
     let ccx = cx.ccx();
     let t_out = node_id_type(cx, id);
-    alt ty::get(t_out).struct {
+    match ty::get(t_out).struct {
       ty::ty_trait(_, _) => return impl::trans_cast(cx, e, id, dest),
       _ => ()
     }
@@ -2764,7 +2764,7 @@ fn trans_cast(cx: block, e: @ast::expr, id: ast::node_id,
     let s_in = k_in == cast_integral && ty::type_is_signed(t_in);
 
     let newval =
-        alt {in: k_in, out: k_out} {
+        match {in: k_in, out: k_out} {
           {in: cast_integral, out: cast_integral} => {
             int_cast(e_res.bcx, ll_t_out, ll_t_in, e_res.val, s_in)
           }
@@ -2797,7 +2797,7 @@ fn trans_cast(cx: block, e: @ast::expr, id: ast::node_id,
             let av_enum = PointerCast(cx, e_res.val, llenumty);
             let lldiscrim_a_ptr = GEPi(cx, av_enum, ~[0u, 0u]);
             let lldiscrim_a = Load(cx, lldiscrim_a_ptr);
-            alt k_out {
+            match k_out {
               cast_integral => int_cast(e_res.bcx, ll_t_out,
                                         val_ty(lldiscrim_a),
                                         lldiscrim_a, true),
@@ -2812,12 +2812,12 @@ fn trans_cast(cx: block, e: @ast::expr, id: ast::node_id,
 
 fn trans_loop_body(bcx: block, e: @ast::expr, ret_flag: option<ValueRef>,
                    dest: dest) -> block {
-    alt check e.node {
+    match check e.node {
       ast::expr_loop_body(b@@{
         node: ast::expr_fn_block(decl, body, cap),
         _
       }) => {
-        alt check ty::get(expr_ty(bcx, e)).struct {
+        match check ty::get(expr_ty(bcx, e)).struct {
           ty::ty_fn({proto, _}) => {
             closure::trans_expr_fn(bcx, proto, decl, body, b.id,
                                    cap, some(ret_flag),
@@ -2841,9 +2841,9 @@ fn trans_arg_expr(cx: block, arg: ty::arg, lldestty: TypeRef, e: @ast::expr,
     let is_bot = ty::type_is_bot(e_ty);
 
     // translate the arg expr as an lvalue
-    let lv = alt ret_flag {
+    let lv = match ret_flag {
       // If there is a ret_flag, this *must* be a loop body
-      some(ptr) => alt check e.node {
+      some(ptr) => match check e.node {
         ast::expr_loop_body(blk) => {
             let scratch = alloc_ty(cx, expr_ty(cx, blk));
             let bcx = trans_loop_body(cx, e, ret_flag, save_in(scratch));
@@ -2884,7 +2884,7 @@ fn trans_arg_expr(cx: block, arg: ty::arg, lldestty: TypeRef, e: @ast::expr,
         // to have type lldestty (the callee's expected type).
         val = llvm::LLVMGetUndef(lldestty);
     } else {
-        alt arg_mode {
+        match arg_mode {
           ast::by_ref | ast::by_mutbl_ref => {
             // Ensure that the value is spilled into memory:
             if lv.kind != lv_owned && ty::type_is_immediate(e_ty) {
@@ -2949,7 +2949,7 @@ fn adapt_borrowed_value(lv: lval_result,
         return {lv:lv, ty:e_ty};
     }
 
-    alt ty::get(e_ty).struct {
+    match ty::get(e_ty).struct {
       ty::ty_uniq(mt) | ty::ty_box(mt) => {
         let box_ptr = load_value_from_lval_result(lv, e_ty);
         let body_ptr = GEPi(bcx, box_ptr, ~[0u, abi::box_field_body]);
@@ -2959,7 +2959,7 @@ fn adapt_borrowed_value(lv: lval_result,
 
       ty::ty_estr(_) | ty::ty_evec(_, _) => {
         let ccx = bcx.ccx();
-        let val = alt lv.kind {
+        let val = match lv.kind {
           lv_temporary => lv.val,
           lv_owned => load_if_immediate(bcx, lv.val, e_ty),
           lv_owned_imm => lv.val
@@ -3019,7 +3019,7 @@ fn trans_args(cx: block, llenv: ValueRef, args: call_args, fn_ty: ty::t,
 
     let retty = ty::ty_fn_ret(fn_ty);
     // Arg 0: Output pointer.
-    let llretslot = alt dest {
+    let llretslot = match dest {
       ignore => {
         if ty::type_is_nil(retty) {
             llvm::LLVMGetUndef(T_ptr(T_nil()))
@@ -3039,7 +3039,7 @@ fn trans_args(cx: block, llenv: ValueRef, args: call_args, fn_ty: ty::t,
     // First we figure out the caller's view of the types of the arguments.
     // This will be needed if this is a generic call, because the callee has
     // to cast her view of the arguments to the caller's view.
-    alt args {
+    match args {
       arg_exprs(es) => {
         let llarg_tys = type_of_explicit_args(ccx, arg_tys);
         let last = es.len() - 1u;
@@ -3083,7 +3083,7 @@ fn body_contains_ret(body: ast::blk) -> bool {
         visit_item: |_i, _cx, _v| { },
         visit_expr: |e: @ast::expr, cx: {mut found: bool}, v| {
             if !cx.found {
-                alt e.node {
+                match e.node {
                   ast::expr_ret(_) => cx.found = true,
                   _ => visit::visit_expr(e, cx, v),
                 }
@@ -3104,9 +3104,9 @@ fn trans_call_inner(
     dest: dest) -> block {
 
     do with_scope(in_cx, call_info, ~"call") |cx| {
-        let ret_in_loop = alt args {
+        let ret_in_loop = match args {
           arg_exprs(args) => {
-            args.len() > 0u && alt vec::last(args).node {
+            args.len() > 0u && match vec::last(args).node {
               ast::expr_loop_body(@{
                 node: ast::expr_fn_block(_, body, _),
                 _
@@ -3127,7 +3127,7 @@ fn trans_call_inner(
         } else { none };
 
         let mut faddr = f_res.val;
-        let llenv = alt f_res.env {
+        let llenv = match f_res.env {
           null_env => {
             llvm::LLVMGetUndef(T_opaque_box_ptr(ccx))
           }
@@ -3160,7 +3160,7 @@ fn trans_call_inner(
         type _|_. Since that means it diverges, the code
         for the call itself is unreachable. */
         bcx = invoke(bcx, faddr, llargs);
-        alt dest {
+        match dest {
           ignore => {
             if llvm::LLVMIsUndef(llretslot) != lib::llvm::True {
                 bcx = drop_ty(bcx, llretslot, ret_ty);
@@ -3220,10 +3220,10 @@ fn need_invoke(bcx: block) -> bool {
     // Walk the scopes to look for cleanups
     let mut cur = bcx;
     loop {
-        alt cur.kind {
+        match cur.kind {
           block_scope(inf) => {
             for vec::each(inf.cleanups) |cleanup| {
-                alt cleanup {
+                match cleanup {
                   clean(_, cleanup_type) | clean_temp(_, _, cleanup_type) => {
                     if cleanup_type == normal_exit_and_unwind {
                         return true;
@@ -3234,7 +3234,7 @@ fn need_invoke(bcx: block) -> bool {
           }
           _ => ()
         }
-        cur = alt cur.parent {
+        cur = match cur.parent {
           some(next) => next,
           none => return false
         }
@@ -3244,7 +3244,7 @@ fn need_invoke(bcx: block) -> bool {
 fn have_cached_lpad(bcx: block) -> bool {
     let mut res = false;
     do in_lpad_scope_cx(bcx) |inf| {
-        alt inf.landing_pad {
+        match inf.landing_pad {
           some(_) => res = true,
           none => res = false
         }
@@ -3255,7 +3255,7 @@ fn have_cached_lpad(bcx: block) -> bool {
 fn in_lpad_scope_cx(bcx: block, f: fn(scope_info)) {
     let mut bcx = bcx;
     loop {
-        alt bcx.kind {
+        match bcx.kind {
           block_scope(inf) => {
             if inf.cleanups.len() > 0u || is_none(bcx.parent) {
                 f(inf); return;
@@ -3273,7 +3273,7 @@ fn get_landing_pad(bcx: block) -> BasicBlockRef {
     let mut cached = none, pad_bcx = bcx; // Guaranteed to be set below
     do in_lpad_scope_cx(bcx) |inf| {
         // If there is a valid landing pad still around, use it
-        alt copy inf.landing_pad {
+        match copy inf.landing_pad {
           some(target) => cached = some(target),
           none => {
             pad_bcx = lpad_block(bcx, ~"unwind");
@@ -3282,7 +3282,7 @@ fn get_landing_pad(bcx: block) -> BasicBlockRef {
         }
     }
     // Can't return from block above
-    alt cached { some(b) => return b, none => () }
+    match cached { some(b) => return b, none => () }
     // The landing pad return type (the type being propagated). Not sure what
     // this represents but it's determined by the personality function and
     // this is what the EH proposal example uses.
@@ -3303,7 +3303,7 @@ fn get_landing_pad(bcx: block) -> BasicBlockRef {
 
     // We store the retval in a function-central alloca, so that calls to
     // Resume can find it.
-    alt copy bcx.fcx.personality {
+    match copy bcx.fcx.personality {
       some(addr) => Store(pad_bcx, llretval, addr),
       none => {
         let addr = alloca(pad_bcx, val_ty(llretval));
@@ -3320,7 +3320,7 @@ fn get_landing_pad(bcx: block) -> BasicBlockRef {
 fn trans_tup(bcx: block, elts: ~[@ast::expr], dest: dest) -> block {
     let _icx = bcx.insn_ctxt(~"trans_tup");
     let mut bcx = bcx;
-    let addr = alt dest {
+    let addr = match dest {
       ignore => {
         for vec::each(elts) |ex| { bcx = trans_expr(bcx, ex, ignore); }
         return bcx;
@@ -3346,7 +3346,7 @@ fn trans_rec(bcx: block, fields: ~[ast::field],
     let _icx = bcx.insn_ctxt(~"trans_rec");
     let t = node_id_type(bcx, id);
     let mut bcx = bcx;
-    let addr = alt check dest {
+    let addr = match check dest {
       ignore => {
         for vec::each(fields) |fld| {
             bcx = trans_expr(bcx, fld.node.expr, ignore);
@@ -3356,7 +3356,7 @@ fn trans_rec(bcx: block, fields: ~[ast::field],
       save_in(pos) => pos
     };
 
-    let ty_fields = alt check ty::get(t).struct { ty::ty_rec(f) => f };
+    let ty_fields = match check ty::get(t).struct { ty::ty_rec(f) => f };
 
     let mut temp_cleanups = ~[];
     for fields.each |fld| {
@@ -3368,7 +3368,7 @@ fn trans_rec(bcx: block, fields: ~[ast::field],
         add_clean_temp_mem(bcx, dst, ty_fields[ix].mt.ty);
         vec::push(temp_cleanups, dst);
     }
-    alt base {
+    match base {
       some(bexp) => {
         let {bcx: cx, val: base_val} = trans_temp_expr(bcx, bexp);
         bcx = cx;
@@ -3404,7 +3404,7 @@ fn trans_struct(block_context: block, span: span, fields: ~[ast::field],
     // Get the address to store the structure into. If there is no address,
     // just translate each field and be done with it.
     let dest_address;
-    alt dest {
+    match dest {
         ignore => {
             for fields.each |field| {
                 block_context = trans_expr(block_context,
@@ -3423,7 +3423,7 @@ fn trans_struct(block_context: block, span: span, fields: ~[ast::field],
 
     // Get the class ID and its fields.
     let class_fields, class_id, substitutions;
-    alt ty::get(struct_type).struct {
+    match ty::get(struct_type).struct {
         ty::ty_class(existing_class_id, existing_substitutions) => {
             class_id = existing_class_id;
             substitutions = existing_substitutions;
@@ -3458,7 +3458,7 @@ fn get_field(block_context: block, dest_address: ValueRef,
         }
 
         let index, field_id;
-        alt found {
+        match found {
             some((found_index, found_field_id)) => {
                 index = found_index;
                 field_id = found_field_id;
@@ -3571,7 +3571,7 @@ fn trans_temp_expr(bcx: block, e: @ast::expr) -> result {
 }
 
 fn load_value_from_lval_result(lv: lval_result, ty: ty::t) -> ValueRef {
-    alt lv.kind {
+    match lv.kind {
       lv_temporary => lv.val,
       lv_owned => load_if_immediate(lv.bcx, lv.val, ty),
       lv_owned_imm => lv.val
@@ -3606,12 +3606,12 @@ fn add_root_cleanup(bcx: block, scope_id: ast::node_id,
     fn find_bcx_for_scope(bcx: block, scope_id: ast::node_id) -> block {
         let mut bcx_sid = bcx;
         loop {
-            bcx_sid = alt bcx_sid.node_info {
+            bcx_sid = match bcx_sid.node_info {
               some({id, _}) if id == scope_id => {
                 return bcx_sid
               }
               _ => {
-                alt bcx_sid.parent {
+                match bcx_sid.parent {
                   none => bcx.tcx().sess.bug(
                       fmt!{"no enclosing scope with id %d", scope_id}),
                   some(bcx_par) => bcx_par
@@ -3634,7 +3634,7 @@ fn trans_expr(bcx: block, e: @ast::expr, dest: dest) -> block {
         return lval_to_dps(bcx, e, dest);
     }
 
-    return alt bcx.ccx().maps.root_map.find({id:e.id, derefs:0u}) {
+    return match bcx.ccx().maps.root_map.find({id:e.id, derefs:0u}) {
       none => unrooted(bcx, e, dest),
       some(scope_id) => {
         debug!{"expression %d found in root map with scope %d",
@@ -3658,7 +3658,7 @@ fn trans_expr(bcx: block, e: @ast::expr, dest: dest) -> block {
 
     fn unrooted(bcx: block, e: @ast::expr, dest: dest) -> block {
         let tcx = bcx.tcx();
-        alt e.node {
+        match e.node {
           ast::expr_if(cond, thn, els) => {
             return trans_if(bcx, cond, thn, els, dest);
           }
@@ -3703,7 +3703,7 @@ fn unrooted(bcx: block, e: @ast::expr, dest: dest) -> block {
                                        cap_clause, none, dest);
           }
           ast::expr_fn_block(decl, body, cap_clause) => {
-            alt check ty::get(expr_ty(bcx, e)).struct {
+            match check ty::get(expr_ty(bcx, e)).struct {
               ty::ty_fn({proto, _}) => {
                 debug!{"translating fn_block %s with type %s",
                        expr_to_str(e),
@@ -3841,7 +3841,7 @@ fn lval_result_to_dps(lv: lval_result, ty: ty::t,
                       last_use: bool, dest: dest) -> block {
     let mut {bcx, val, kind} = lv;
     let ccx = bcx.ccx();
-    alt dest {
+    match dest {
       by_val(cell) => {
         if kind == lv_temporary {
             revoke_clean(bcx, val);
@@ -3909,7 +3909,7 @@ fn trans_log(log_ex: @ast::expr, lvl: @ast::expr,
     let modpath = vec::append(
         ~[path_mod(ccx.link_meta.name)],
         vec::filter(bcx.fcx.path, |e|
-            alt e { path_mod(_) => true, _ => false }
+            match e { path_mod(_) => true, _ => false }
         ));
     let modname = path_str(modpath);
 
@@ -3967,7 +3967,7 @@ fn trans_fail_expr(bcx: block, sp_opt: option<span>,
                    fail_expr: option<@ast::expr>) -> block {
     let _icx = bcx.insn_ctxt(~"trans_fail_expr");
     let mut bcx = bcx;
-    alt fail_expr {
+    match fail_expr {
       some(expr) => {
         let ccx = bcx.ccx(), tcx = ccx.tcx;
         let expr_res = trans_temp_expr(bcx, expr);
@@ -3995,7 +3995,7 @@ fn trans_trace(bcx: block, sp_opt: option<span>, trace_str: ~str) {
     let _icx = bcx.insn_ctxt(~"trans_trace");
     add_comment(bcx, trace_str);
     let V_trace_str = C_cstr(bcx.ccx(), trace_str);
-    let {V_filename, V_line} = alt sp_opt {
+    let {V_filename, V_line} = match sp_opt {
       some(sp) => {
         let sess = bcx.sess();
         let loc = codemap::lookup_char_pos(sess.parse_sess.cm, sp.lo);
@@ -4025,7 +4025,7 @@ fn trans_fail_value(bcx: block, sp_opt: option<span>,
                     V_fail_str: ValueRef) -> block {
     let _icx = bcx.insn_ctxt(~"trans_fail_value");
     let ccx = bcx.ccx();
-    let {V_filename, V_line} = alt sp_opt {
+    let {V_filename, V_line} = match sp_opt {
       some(sp) => {
         let sess = bcx.sess();
         let loc = codemap::lookup_char_pos(sess.parse_sess.cm, sp.lo);
@@ -4067,7 +4067,7 @@ fn trans_break_cont(bcx: block, to_end: bool)
     let mut unwind = bcx;
     let mut target;
     loop {
-        alt unwind.kind {
+        match unwind.kind {
           block_scope({loop_break: some(brk), _}) => {
             target = if to_end {
                 brk
@@ -4078,7 +4078,7 @@ fn trans_break_cont(bcx: block, to_end: bool)
           }
           _ => ()
         }
-        unwind = alt unwind.parent {
+        unwind = match unwind.parent {
           some(cx) => cx,
           // This is a return from a loop body block
           none => {
@@ -4105,14 +4105,14 @@ fn trans_cont(cx: block) -> block {
 fn trans_ret(bcx: block, e: option<@ast::expr>) -> block {
     let _icx = bcx.insn_ctxt(~"trans_ret");
     let mut bcx = bcx;
-    let retptr = alt copy bcx.fcx.loop_ret {
+    let retptr = match copy bcx.fcx.loop_ret {
       some({flagptr, retptr}) => {
         // This is a loop body return. Must set continue flag (our retptr)
         // to false, return flag to true, and then store the value in the
         // parent's retptr.
         Store(bcx, C_bool(true), flagptr);
         Store(bcx, C_bool(false), bcx.fcx.llretptr);
-        alt e {
+        match e {
           some(x) => PointerCast(bcx, retptr,
                                  T_ptr(type_of(bcx.ccx(), expr_ty(bcx, x)))),
           none => retptr
@@ -4120,7 +4120,7 @@ fn trans_ret(bcx: block, e: option<@ast::expr>) -> block {
       }
       none => bcx.fcx.llretptr
     };
-    alt e {
+    match e {
       some(x) => {
         bcx = trans_expr_save_in(bcx, x, retptr);
       }
@@ -4139,7 +4139,7 @@ fn build_return(bcx: block) {
 fn init_local(bcx: block, local: @ast::local) -> block {
     let _icx = bcx.insn_ctxt(~"init_local");
     let ty = node_id_type(bcx, local.node.id);
-    let llptr = alt bcx.fcx.lllocals.find(local.node.id) {
+    let llptr = match bcx.fcx.lllocals.find(local.node.id) {
       some(local_mem(v)) => v,
       _ => { bcx.tcx().sess.span_bug(local.span,
                         ~"init_local: Someone forgot to document why it's\
@@ -4148,7 +4148,7 @@ fn init_local(bcx: block, local: @ast::local) -> block {
     };
 
     let mut bcx = bcx;
-    alt local.node.init {
+    match local.node.init {
       some(init) => {
         if init.op == ast::init_assign || !expr_is_lval(bcx, init.expr) {
             bcx = trans_expr_save_in(bcx, init.expr, llptr);
@@ -4175,12 +4175,12 @@ fn trans_stmt(cx: block, s: ast::stmt) -> block {
     let mut bcx = cx;
     debuginfo::update_source_pos(cx, s.span);
 
-    alt s.node {
+    match s.node {
       ast::stmt_expr(e, _) | ast::stmt_semi(e, _) => {
         bcx = trans_expr(cx, e, ignore);
       }
       ast::stmt_decl(d, _) => {
-        alt d.node {
+        match d.node {
           ast::decl_local(locals) => {
             for vec::each(locals) |local| {
                 bcx = init_local(bcx, local);
@@ -4275,11 +4275,11 @@ fn trans_block_cleanups_(bcx: block, cleanup_cx: block, is_lpad: bool) ->
     let _icx = bcx.insn_ctxt(~"trans_block_cleanups");
     if bcx.unreachable { return bcx; }
     let mut bcx = bcx;
-    alt check cleanup_cx.kind {
+    match check cleanup_cx.kind {
       block_scope({cleanups, _}) => {
         let cleanups = copy cleanups;
         do vec::riter(cleanups) |cu| {
-            alt cu {
+            match cu {
               clean(cfn, cleanup_type) | clean_temp(_, cfn, cleanup_type) => {
                 // Some types don't need to be cleaned up during
                 // landing pads because they can be freed en mass later
@@ -4311,7 +4311,7 @@ fn cleanup_and_leave(bcx: block, upto: option<BasicBlockRef>,
                 fmt!{"cleanup_and_leave(%s)", cur.to_str()});
         }
 
-        alt cur.kind {
+        match cur.kind {
           block_scope(inf) if inf.cleanups.len() > 0u => {
             for vec::find(inf.cleanup_paths,
                           |cp| cp.target == leave).each |cp| {
@@ -4325,16 +4325,16 @@ fn cleanup_and_leave(bcx: block, upto: option<BasicBlockRef>,
           }
           _ => ()
         }
-        alt upto {
+        match upto {
           some(bb) => { if cur.llbb == bb { break; } }
           _ => ()
         }
-        cur = alt cur.parent {
+        cur = match cur.parent {
           some(next) => next,
           none => { assert is_none(upto); break; }
         };
     }
-    alt leave {
+    match leave {
       some(target) => Br(bcx, target),
       none => { Resume(bcx, Load(bcx, option::get(bcx.fcx.personality))); }
     }
@@ -4383,9 +4383,9 @@ fn with_cond(bcx: block, val: ValueRef, f: fn(block) -> block) -> block {
 
 fn block_locals(b: ast::blk, it: fn(@ast::local)) {
     for vec::each(b.node.stmts) |s| {
-        alt s.node {
+        match s.node {
           ast::stmt_decl(d, _) => {
-            alt d.node {
+            match d.node {
               ast::decl_local(locals) => {
                 for vec::each(locals) |local| { it(local); }
               }
@@ -4410,7 +4410,7 @@ fn alloc_ty(bcx: block, t: ty::t) -> ValueRef {
 fn alloc_local(cx: block, local: @ast::local) -> block {
     let _icx = cx.insn_ctxt(~"alloc_local");
     let t = node_id_type(cx, local.node.id);
-    let simple_name = alt local.node.pat.node {
+    let simple_name = match local.node.pat.node {
       ast::pat_ident(_, pth, none) => some(path_to_ident(pth)),
       _ => none
     };
@@ -4435,7 +4435,7 @@ fn trans_block(bcx: block, b: ast::blk, dest: dest)
         debuginfo::update_source_pos(bcx, b.span);
         bcx = trans_stmt(bcx, *s);
     }
-    alt b.node.expr {
+    match b.node.expr {
       some(e) => {
         let bt = ty::type_is_bot(expr_ty(bcx, e));
         debuginfo::update_source_pos(bcx, e.span);
@@ -4513,7 +4513,7 @@ fn create_llargs_for_fn_args(cx: fn_ctxt,
     let _icx = cx.insn_ctxt(~"create_llargs_for_fn_args");
     // Skip the implicit arguments 0, and 1.
     let mut arg_n = first_real_arg;
-    alt ty_self {
+    match ty_self {
       impl_self(tt) => {
         cx.llself = some({v: cx.llenv, t: tt});
       }
@@ -4544,11 +4544,11 @@ fn copy_args_to_allocas(fcx: fn_ctxt, bcx: block, args: ~[ast::arg],
     };
     for vec::each(arg_tys) |arg| {
         let id = args[arg_n].id;
-        let argval = alt fcx.llargs.get(id) {
+        let argval = match fcx.llargs.get(id) {
           local_mem(v) => v,
           _ => epic_fail()
         };
-        alt ty::resolved_mode(tcx, arg.mode) {
+        match ty::resolved_mode(tcx, arg.mode) {
           ast::by_mutbl_ref => (),
           ast::by_move | ast::by_copy => add_clean(bcx, argval, arg.ty),
           ast::by_val => {
@@ -4682,7 +4682,7 @@ fn trans_enum_variant(ccx: @crate_ctxt, enum_id: ast::node_id,
     let fcx = new_fn_ctxt_w_id(ccx, ~[], llfndecl, variant.node.id,
                                param_substs, none);
     create_llargs_for_fn_args(fcx, no_self, fn_args);
-    let ty_param_substs = alt param_substs {
+    let ty_param_substs = match param_substs {
       some(substs) => substs.tys,
       none => ~[]
     };
@@ -4708,7 +4708,7 @@ fn trans_enum_variant(ccx: @crate_ctxt, enum_id: ast::node_id,
         // If this argument to this function is a enum, it'll have come in to
         // this function as an opaque blob due to the way that type_of()
         // works. So we have to cast to the destination's view of the type.
-        let llarg = alt check fcx.llargs.find(va.id) {
+        let llarg = match check fcx.llargs.find(va.id) {
           some(local_mem(x)) => x
         };
         let arg_ty = arg_tys[i].ty;
@@ -4824,10 +4824,10 @@ fn trans_class_dtor(ccx: @crate_ctxt, path: path,
 
 fn trans_item(ccx: @crate_ctxt, item: ast::item) {
     let _icx = ccx.insn_ctxt(~"trans_item");
-    let path = alt check ccx.tcx.items.get(item.id) {
+    let path = match check ccx.tcx.items.get(item.id) {
       ast_map::node_item(_, p) => p
     };
-    alt item.node {
+    match item.node {
       ast::item_fn(decl, tps, body) => {
         if decl.purity == ast::extern_fn  {
             let llfndecl = get_item_val(ccx, item.id);
@@ -4843,7 +4843,7 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) {
                      decl, body, llfndecl, no_self, none, item.id);
         } else {
             for vec::each(body.node.stmts) |stmt| {
-                alt stmt.node {
+                match stmt.node {
                   ast::stmt_decl(@{node: ast::decl_item(i), _}, _) => {
                     trans_item(ccx, *i);
                   }
@@ -4876,7 +4876,7 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) {
       }
       ast::item_const(_, expr) => consts::trans_const(ccx, expr, item.id),
       ast::item_foreign_mod(foreign_mod) => {
-        let abi = alt attr::foreign_abi(item.attrs) {
+        let abi = match attr::foreign_abi(item.attrs) {
           either::right(abi_) => abi_,
           either::left(msg) => ccx.sess.span_fatal(item.span, msg)
         };
@@ -4961,7 +4961,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
 
     let main_takes_argv =
         // invariant!
-        alt ty::get(main_node_type).struct {
+        match ty::get(main_node_type).struct {
           ty::ty_fn({inputs, _}) => inputs.len() != 0u,
           _ => ccx.sess.span_fatal(sp, ~"main has a non-function type")
         };
@@ -5050,7 +5050,7 @@ fn fill_fn_pair(bcx: block, pair: ValueRef, llfn: ValueRef,
 
 fn item_path(ccx: @crate_ctxt, i: @ast::item) -> path {
     vec::append(
-        *alt check ccx.tcx.items.get(i.id) {
+        *match check ccx.tcx.items.get(i.id) {
             ast_map::node_item(_, p) => p
         },
         ~[path_name(i.ident)])
@@ -5061,7 +5061,7 @@ fn item_path(ccx: @crate_ctxt, i: @ast::item) -> path {
 fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id,
                    substs: option<param_substs>) -> ~str {
   let t = ty::node_id_to_type(ccx.tcx, id);
-  alt ccx.item_symbols.find(id) {
+  match ccx.item_symbols.find(id) {
      some(s) => s,
      none if is_none(substs) => {
        let s = mangle_exported_name(
@@ -5074,7 +5074,7 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id,
      none   => {
        // Monomorphizing, so just make a symbol, don't add
        // this to item_symbols
-       alt substs {
+       match substs {
          some(ss) => {
            let mono_ty = ty::subst_tps(ccx.tcx, ss.tys, t);
            mangle_exported_name(
@@ -5094,14 +5094,14 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id,
 
 fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
     let tcx = ccx.tcx;
-    alt ccx.item_vals.find(id) {
+    match ccx.item_vals.find(id) {
       some(v) => v,
       none => {
         let mut exprt = false;
-        let val = alt check ccx.tcx.items.get(id) {
+        let val = match check ccx.tcx.items.get(id) {
           ast_map::node_item(i, pth) => {
             let my_path = vec::append(*pth, ~[path_name(i.ident)]);
-            alt check i.node {
+            match check i.node {
               ast::item_const(_, _) => {
                 let typ = ty::node_id_to_type(ccx.tcx, i.id);
                 let s = mangle_exported_name(ccx, my_path, typ);
@@ -5167,7 +5167,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
             let pth = vec::append(*pth,
                                   ~[path_name(enm.ident),
                                    path_name(v.node.name)]);
-            let llfn = alt check enm.node {
+            let llfn = match check enm.node {
               ast::item_enum(_, _) => {
                 register_fn(ccx, v.span, pth, id)
               }
@@ -5188,7 +5188,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
 // The constant translation pass.
 fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
     let _icx = ccx.insn_ctxt(~"trans_constant");
-    alt it.node {
+    match it.node {
       ast::item_enum(variants, _) => {
         let vi = ty::enum_variants(ccx.tcx, {crate: ast::local_crate,
                                              node: it.id});
@@ -5294,7 +5294,7 @@ fn declare_dbg_intrinsics(llmod: ModuleRef,
 
 fn trap(bcx: block) {
     let v: ~[ValueRef] = ~[];
-    alt bcx.ccx().intrinsics.find(~"llvm.trap") {
+    match bcx.ccx().intrinsics.find(~"llvm.trap") {
       some(x) => { Call(bcx, x, v); },
       _ => bcx.sess().bug(~"unbound llvm.trap in trap")
     }
@@ -5309,12 +5309,12 @@ fn push_rtcall(ccx: @crate_ctxt, name: ~str, did: ast::def_id) {
 
 fn gather_local_rtcalls(ccx: @crate_ctxt, crate: @ast::crate) {
     visit::visit_crate(*crate, (), visit::mk_simple_visitor(@{
-        visit_item: |item| alt item.node {
+        visit_item: |item| match item.node {
           ast::item_fn(decl, _, _) => {
             let attr_metas = attr::attr_metas(
                 attr::find_attrs_by_name(item.attrs, ~"rt"));
             do vec::iter(attr_metas) |attr_meta| {
-                alt attr::get_meta_item_list(attr_meta) {
+                match attr::get_meta_item_list(attr_meta) {
                   some(list) => {
                     let name = *attr::get_meta_item_name(vec::head(list));
                     push_rtcall(ccx, name, {crate: ast::local_crate,
@@ -5334,9 +5334,9 @@ fn gather_external_rtcalls(ccx: @crate_ctxt) {
     do cstore::iter_crate_data(ccx.sess.cstore) |_cnum, cmeta| {
         do decoder::each_path(cmeta) |path| {
             let pathname = path.path_string;
-            alt path.def_like {
+            match path.def_like {
               decoder::dl_def(d) => {
-                alt d {
+                match d {
                   ast::def_fn(did, _) => {
                     // FIXME (#2861): This should really iterate attributes
                     // like gather_local_rtcalls, but we'll need to
@@ -5462,7 +5462,7 @@ fn reexports(cx: @crate_ctxt) -> ~[(~str, ast::def_id)] {
         for cx.exp_map.each |exp_id, defs| {
             for defs.each |def| {
                 if !def.reexp { again; }
-                let path = alt check cx.tcx.items.get(exp_id) {
+                let path = match check cx.tcx.items.get(exp_id) {
                   ast_map::node_export(_, path) => {
                     ast_map::path_to_str(*path)
                   }
index 6e7c41e0fa97ea117547369654ea43bedbacf333..d6083a3c56405c4a0cd5d1baadc5d53379b916f0 100644 (file)
@@ -49,7 +49,7 @@ fn count_insn(cx: block, category: ~str) {
         s += ~"/";
         s += category;
 
-        let n = alt h.find(s) {
+        let n = match h.find(s) {
           some(n) => n,
           _ => 0u
         };
index 1912c50969336cc5c367e7270b6c9f341fe356c6..752ce97427ca5dd41598ca452150a79cc3a236f7 100644 (file)
@@ -101,7 +101,7 @@ enum environment_value {
 }
 
 fn ev_to_str(ccx: @crate_ctxt, ev: environment_value) -> ~str {
-    alt ev {
+    match ev {
       env_copy(v, t, lk) => fmt!{"copy(%s,%s)", val_str(ccx.tn, v),
                                 ty_to_str(ccx.tcx, t)},
       env_move(v, t, lk) => fmt!{"move(%s,%s)", val_str(ccx.tn, v),
@@ -124,7 +124,7 @@ fn mk_closure_tys(tcx: ty::ctxt,
 
     // Compute the closed over data
     for vec::each(bound_values) |bv| {
-        vec::push(bound_tys, alt bv {
+        vec::push(bound_tys, match bv {
             env_copy(_, t, _) => t,
             env_move(_, t, _) => t,
             env_ref(_, t, _) => t
@@ -153,7 +153,7 @@ fn nuke_ref_count(bcx: block, llbox: ValueRef) {
     }
 
     // Allocate and initialize the box:
-    let {bcx, val} = alt ck {
+    let {bcx, val} = match ck {
       ty::ck_box => malloc_raw(bcx, cdata_ty, heap_shared),
       ty::ck_uniq => malloc_raw(bcx, cdata_ty, heap_exchange),
       ty::ck_block => {
@@ -211,7 +211,7 @@ fn store_environment(bcx: block,
 
         let bound_data = GEPi(bcx, llbox,
              ~[0u, abi::box_field_body, i]);
-        alt bv {
+        match bv {
           env_copy(val, ty, lv_owned) => {
             let val1 = load_if_immediate(bcx, val, ty);
             bcx = base::copy_val(bcx, INIT, bound_data, val1, ty);
@@ -267,14 +267,14 @@ fn build_closure(bcx0: block,
         debug!{"Node id is %s",
                syntax::ast_map::node_id_to_str(bcx.ccx().tcx.items, nid)};
         let mut ty = node_id_type(bcx, nid);
-        alt cap_var.mode {
+        match cap_var.mode {
           capture::cap_ref => {
             assert ck == ty::ck_block;
             ty = ty::mk_mut_ptr(tcx, ty);
             vec::push(env_vals, env_ref(lv.val, ty, lv.kind));
           }
           capture::cap_copy => {
-            let mv = alt check ccx.maps.last_use_map.find(id) {
+            let mv = match check ccx.maps.last_use_map.find(id) {
               none => false,
               some(vars) => (*vars).contains(nid)
             };
@@ -292,7 +292,7 @@ fn build_closure(bcx0: block,
         }
     }
     do option::iter(include_ret_handle) |flagptr| {
-        let our_ret = alt bcx.fcx.loop_ret {
+        let our_ret = match bcx.fcx.loop_ret {
           some({retptr, _}) => retptr,
           none => bcx.fcx.llretptr
         };
@@ -323,12 +323,12 @@ fn load_environment(fcx: fn_ctxt,
     // Populate the upvars from the environment.
     let mut i = 0u;
     do vec::iter(cap_vars) |cap_var| {
-        alt cap_var.mode {
+        match cap_var.mode {
           capture::cap_drop => { /* ignore */ }
           _ => {
             let mut upvarptr =
                 GEPi(bcx, llcdata, ~[0u, i]);
-            alt ck {
+            match ck {
               ty::ck_block => { upvarptr = Load(bcx, upvarptr); }
               ty::ck_uniq | ty::ck_box => ()
             }
@@ -368,7 +368,7 @@ fn trans_expr_fn(bcx: block,
     let trans_closure_env = fn@(ck: ty::closure_kind) -> result {
         let cap_vars = capture::compute_capture_vars(
             ccx.tcx, id, proto, cap_clause);
-        let ret_handle = alt is_loop_body { some(x) => x, none => none };
+        let ret_handle = match is_loop_body { some(x) => x, none => none };
         let {llbox, cdata_ty, bcx} = build_closure(bcx, cap_vars, ck, id,
                                                    ret_handle);
         trans_closure(ccx, sub_path, decl, body, llfn, no_self,
@@ -383,7 +383,7 @@ fn trans_expr_fn(bcx: block,
         {bcx: bcx, val: llbox}
     };
 
-    let {bcx: bcx, val: closure} = alt proto {
+    let {bcx: bcx, val: closure} = match proto {
       ast::proto_block => trans_closure_env(ty::ck_block),
       ast::proto_box => trans_closure_env(ty::ck_box),
       ast::proto_uniq => trans_closure_env(ty::ck_uniq),
@@ -417,7 +417,7 @@ fn make_fn_glue(
         }
     };
 
-    return alt ty::get(t).struct {
+    return match ty::get(t).struct {
       ty::ty_fn({proto: ast::proto_bare, _}) |
       ty::ty_fn({proto: ast::proto_block, _}) => bcx,
       ty::ty_fn({proto: ast::proto_uniq, _}) => fn_env(ty::ck_uniq),
@@ -433,7 +433,7 @@ fn make_opaque_cbox_take_glue(
     -> block {
     // Easy cases:
     let _icx = bcx.insn_ctxt(~"closure::make_opaque_cbox_take_glue");
-    alt ck {
+    match ck {
       ty::ck_block => return bcx,
       ty::ck_box => {
         incr_refcnt_of_boxed(bcx, Load(bcx, cboxptr));
@@ -485,7 +485,7 @@ fn make_opaque_cbox_drop_glue(
     cboxptr: ValueRef)     // ptr to the opaque closure
     -> block {
     let _icx = bcx.insn_ctxt(~"closure::make_opaque_cbox_drop_glue");
-    alt ck {
+    match ck {
       ty::ck_block => bcx,
       ty::ck_box => {
         decr_refcnt_maybe_free(bcx, Load(bcx, cboxptr),
@@ -504,7 +504,7 @@ fn make_opaque_cbox_free_glue(
     cbox: ValueRef)     // ptr to the opaque closure
     -> block {
     let _icx = bcx.insn_ctxt(~"closure::make_opaque_cbox_free_glue");
-    alt ck {
+    match ck {
       ty::ck_block => return bcx,
       ty::ck_box | ty::ck_uniq => { /* hard cases: */ }
     }
@@ -524,7 +524,7 @@ fn make_opaque_cbox_free_glue(
                               abi::tydesc_field_drop_glue, none);
 
         // Free the ty descr (if necc) and the box itself
-        alt ck {
+        match ck {
           ty::ck_block => fail ~"Impossible",
           ty::ck_box => trans_free(bcx, cbox),
           ty::ck_uniq => trans_unique_free(bcx, cbox)
index 99fd0c8b7bc9124a6d1057e00fac3b3d86e09ebf..7e48297f12ec6394410ad83e7058c7a0e594b64b 100644 (file)
@@ -292,7 +292,7 @@ fn add_clean_temp_mem(cx: block, val: ValueRef, ty: ty::t) {
     }
 }
 fn add_clean_free(cx: block, ptr: ValueRef, heap: heap) {
-    let free_fn = alt heap {
+    let free_fn = match heap {
       heap_shared => |a| base::trans_free(a, ptr),
       heap_exchange => |a| base::trans_unique_free(a, ptr)
     };
@@ -310,7 +310,7 @@ fn add_clean_free(cx: block, ptr: ValueRef, heap: heap) {
 fn revoke_clean(cx: block, val: ValueRef) {
     do in_scope_cx(cx) |info| {
         do option::iter(vec::position(info.cleanups, |cu| {
-            alt cu {
+            match cu {
               clean_temp(v, _, _) if v == val => true,
               _ => false
             }
@@ -453,7 +453,7 @@ fn struct_elt(llstructty: TypeRef, n: uint) -> TypeRef unsafe {
 fn in_scope_cx(cx: block, f: fn(scope_info)) {
     let mut cur = cx;
     loop {
-        alt cur.kind {
+        match cur.kind {
           block_scope(inf) => { f(inf); return; }
           _ => ()
         }
@@ -462,7 +462,7 @@ fn in_scope_cx(cx: block, f: fn(scope_info)) {
 }
 
 fn block_parent(cx: block) -> block {
-    alt cx.parent {
+    match cx.parent {
       some(b) => b,
       none    => cx.sess().bug(fmt!{"block_parent called on root block %?",
                                    cx})
@@ -483,7 +483,7 @@ fn ty_to_str(t: ty::t) -> ~str {
         ty_to_str(self.tcx(), t)
     }
     fn to_str() -> ~str {
-        alt self.node_info {
+        match self.node_info {
           some(node_info) => {
             fmt!{"[block %d]", node_info.id}
           }
@@ -535,7 +535,7 @@ fn T_nil() -> TypeRef {
 fn T_bool() -> TypeRef { return T_i1(); }
 
 fn T_int(targ_cfg: @session::config) -> TypeRef {
-    return alt targ_cfg.arch {
+    return match targ_cfg.arch {
       session::arch_x86 => T_i32(),
       session::arch_x86_64 => T_i64(),
       session::arch_arm => T_i32()
@@ -543,7 +543,7 @@ fn T_int(targ_cfg: @session::config) -> TypeRef {
 }
 
 fn T_int_ty(cx: @crate_ctxt, t: ast::int_ty) -> TypeRef {
-    alt t {
+    match t {
       ast::ty_i => cx.int_type,
       ast::ty_char => T_char(),
       ast::ty_i8 => T_i8(),
@@ -554,7 +554,7 @@ fn T_int_ty(cx: @crate_ctxt, t: ast::int_ty) -> TypeRef {
 }
 
 fn T_uint_ty(cx: @crate_ctxt, t: ast::uint_ty) -> TypeRef {
-    alt t {
+    match t {
       ast::ty_u => cx.int_type,
       ast::ty_u8 => T_i8(),
       ast::ty_u16 => T_i16(),
@@ -564,7 +564,7 @@ fn T_uint_ty(cx: @crate_ctxt, t: ast::uint_ty) -> TypeRef {
 }
 
 fn T_float_ty(cx: @crate_ctxt, t: ast::float_ty) -> TypeRef {
-    alt t {
+    match t {
       ast::ty_f => cx.float_type,
       ast::ty_f32 => T_f32(),
       ast::ty_f64 => T_f64()
@@ -572,7 +572,7 @@ fn T_float_ty(cx: @crate_ctxt, t: ast::float_ty) -> TypeRef {
 }
 
 fn T_float(targ_cfg: @session::config) -> TypeRef {
-    return alt targ_cfg.arch {
+    return match targ_cfg.arch {
       session::arch_x86 => T_f64(),
       session::arch_x86_64 => T_f64(),
       session::arch_arm => T_f64()
@@ -657,7 +657,7 @@ fn T_tydesc_field(cx: @crate_ctxt, field: uint) -> TypeRef unsafe {
 
 fn T_glue_fn(cx: @crate_ctxt) -> TypeRef {
     let s = ~"glue_fn";
-    alt name_has_type(cx.tn, s) {
+    match name_has_type(cx.tn, s) {
       some(t) => return t,
       _ => ()
     }
@@ -764,7 +764,7 @@ fn T_chan(cx: @crate_ctxt, _t: TypeRef) -> TypeRef {
 // This type must never be used directly; it must always be cast away.
 fn T_typaram(tn: type_names) -> TypeRef {
     let s = ~"typaram";
-    alt name_has_type(tn, s) {
+    match name_has_type(tn, s) {
       some(t) => return t,
       _ => ()
     }
@@ -787,7 +787,7 @@ fn T_enum_discrim(cx: @crate_ctxt) -> TypeRef {
 
 fn T_opaque_enum(cx: @crate_ctxt) -> TypeRef {
     let s = ~"opaque_enum";
-    alt name_has_type(cx.tn, s) {
+    match name_has_type(cx.tn, s) {
       some(t) => return t,
       _ => ()
     }
@@ -856,7 +856,7 @@ fn C_uint(cx: @crate_ctxt, i: uint) -> ValueRef {
 // This is a 'c-like' raw string, which differs from
 // our boxed-and-length-annotated strings.
 fn C_cstr(cx: @crate_ctxt, s: ~str) -> ValueRef {
-    alt cx.const_cstr_cache.find(s) {
+    match cx.const_cstr_cache.find(s) {
       some(llval) => return llval,
       none => ()
     }
@@ -942,7 +942,7 @@ enum mono_param_id {
 pure fn hash_mono_id(mi: &mono_id) -> uint {
     let mut h = syntax::ast_util::hash_def(&mi.def);
     for vec::each(mi.params) |param| {
-        h = h * alt param {
+        h = h * match param {
           mono_precise(ty, vts) => {
             let mut h = ty::type_id(ty);
             do option::iter(vts) |vts| {
@@ -978,7 +978,7 @@ fn align_to(cx: block, off: ValueRef, align: ValueRef) -> ValueRef {
 fn path_str(p: path) -> ~str {
     let mut r = ~"", first = true;
     for vec::each(p) |e| {
-        alt e { ast_map::path_name(s) | ast_map::path_mod(s) => {
+        match e { ast_map::path_name(s) | ast_map::path_mod(s) => {
           if first { first = false; }
           else { r += ~"::"; }
           r += *s;
@@ -990,7 +990,7 @@ fn path_str(p: path) -> ~str {
 fn node_id_type(bcx: block, id: ast::node_id) -> ty::t {
     let tcx = bcx.tcx();
     let t = ty::node_id_to_type(tcx, id);
-    alt bcx.fcx.param_substs {
+    match bcx.fcx.param_substs {
       some(substs) => ty::subst_tps(tcx, substs.tys, t),
       _ => { assert !ty::type_has_params(t); t }
     }
@@ -1001,7 +1001,7 @@ fn expr_ty(bcx: block, ex: @ast::expr) -> ty::t {
 fn node_id_type_params(bcx: block, id: ast::node_id) -> ~[ty::t] {
     let tcx = bcx.tcx();
     let params = ty::node_id_to_type_params(tcx, id);
-    alt bcx.fcx.param_substs {
+    match bcx.fcx.param_substs {
       some(substs) => {
         vec::map(params, |t| ty::subst_tps(tcx, substs.tys, t))
       }
@@ -1012,7 +1012,7 @@ fn node_id_type_params(bcx: block, id: ast::node_id) -> ~[ty::t] {
 fn field_idx_strict(cx: ty::ctxt, sp: span, ident: ast::ident,
                     fields: ~[ty::field])
     -> uint {
-    alt ty::field_idx(ident, fields) {
+    match ty::field_idx(ident, fields) {
        none => cx.sess.span_bug(
            sp, fmt!{"base expr doesn't appear to \
                          have a field named %s", *ident}),
index d0a448da5b2f601f1b3bab6526e7b5ea66af9588..49ea20c6e8575fff3ab5b77d94009f8685067104 100644 (file)
@@ -5,12 +5,12 @@
 fn const_lit(cx: @crate_ctxt, e: @ast::expr, lit: ast::lit)
     -> ValueRef {
     let _icx = cx.insn_ctxt(~"trans_lit");
-    alt lit.node {
+    match lit.node {
       ast::lit_int(i, t) => C_integral(T_int_ty(cx, t), i as u64, True),
       ast::lit_uint(u, t) => C_integral(T_uint_ty(cx, t), u, False),
       ast::lit_int_unsuffixed(i) => {
         let lit_int_ty = ty::node_id_to_type(cx.tcx, e.id);
-        alt ty::get(lit_int_ty).struct {
+        match ty::get(lit_int_ty).struct {
           ty::ty_int(t) => {
             C_integral(T_int_ty(cx, t), i as u64, True)
           }
@@ -45,7 +45,7 @@ fn const_vec_and_sz(cx: @crate_ctxt, e: @ast::expr, es: &[@ast::expr])
 
 fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
     let _icx = cx.insn_ctxt(~"const_expr");
-    alt e.node {
+    match e.node {
       ast::expr_lit(lit) => consts::const_lit(cx, e, *lit),
       ast::expr_binary(b, e1, e2) => {
         let te1 = const_expr(cx, e1);
@@ -58,7 +58,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
         let ty = ty::expr_ty(cx.tcx, e1);
         let is_float = ty::type_is_fp(ty);
         let signed = ty::type_is_signed(ty);
-        return alt b {
+        return match b {
           ast::add   => {
             if is_float { llvm::LLVMConstFAdd(te1, te2) }
             else        { llvm::LLVMConstAdd(te1, te2) }
@@ -103,7 +103,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
         let te = const_expr(cx, e);
         let ty = ty::expr_ty(cx.tcx, e);
         let is_float = ty::type_is_fp(ty);
-        return alt u {
+        return match u {
           ast::box(_)  |
           ast::uniq(_) |
           ast::deref   => cx.sess.span_bug(e.span,
@@ -119,7 +119,9 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
         let ety = ty::expr_ty(cx.tcx, e), llty = type_of::type_of(cx, ety);
         let basety = ty::expr_ty(cx.tcx, base);
         let v = const_expr(cx, base);
-        alt check (base::cast_type_kind(basety), base::cast_type_kind(ety)) {
+        match check (base::cast_type_kind(basety),
+                     base::cast_type_kind(ety)) {
+
           (base::cast_integral, base::cast_integral) => {
             let s = if ty::type_is_signed(basety) { True } else { False };
             llvm::LLVMConstIntCast(v, llty, s)
@@ -162,9 +164,9 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
         const_expr(cx, e)
       }
       ast::expr_vstore(sub, ast::vstore_slice(_)) => {
-        alt sub.node {
+        match sub.node {
           ast::expr_lit(lit) => {
-            alt lit.node {
+            match lit.node {
               ast::lit_str(*) => { const_expr(cx, sub) }
               _ => { cx.sess.span_bug(e.span,
                                       ~"bad const-slice lit") }
@@ -186,11 +188,11 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
         }
       }
       ast::expr_path(path) => {
-        alt cx.tcx.def_map.find(e.id) {
+        match cx.tcx.def_map.find(e.id) {
           some(ast::def_const(def_id)) => {
             // Don't know how to handle external consts
             assert ast_util::is_local(def_id);
-            alt cx.tcx.items.get(def_id.node) {
+            match cx.tcx.items.get(def_id.node) {
               ast_map::node_item(@{
                 node: ast::item_const(_, subexpr), _
               }, _) => {
index 30300550c3199afa64fd75dedfc6716b817c59de..1a207a5313ca31565f50dcd8a55dd37d16fbde65 100644 (file)
@@ -134,7 +134,7 @@ fn cast_safely<T: copy, U>(val: T) -> U unsafe {
 }
 
 fn md_from_metadata<T>(val: debug_metadata) -> T unsafe {
-    alt val {
+    match val {
       file_metadata(md) => cast_safely(md),
       compile_unit_metadata(md) => cast_safely(md),
       subprogram_metadata(md) => cast_safely(md),
@@ -165,7 +165,7 @@ fn create_compile_unit(cx: @crate_ctxt)
     let cache = get_cache(cx);
     let crate_name = option::get(cx.dbg_cx).crate_file;
     let tg = CompileUnitTag;
-    alt cached_metadata::<@metadata<compile_unit_md>>(cache, tg,
+    match cached_metadata::<@metadata<compile_unit_md>>(cache, tg,
                         |md| md.data.name == crate_name) {
       option::some(md) => return md,
       option::none => ()
@@ -208,7 +208,7 @@ fn get_file_path_and_dir(work_dir: ~str, full_path: ~str) -> (~str, ~str) {
 fn create_file(cx: @crate_ctxt, full_path: ~str) -> @metadata<file_md> {
     let cache = get_cache(cx);;
     let tg = FileDescriptorTag;
-    alt cached_metadata::<@metadata<file_md>>(
+    match cached_metadata::<@metadata<file_md>>(
         cache, tg, |md| md.data.path == full_path) {
         option::some(md) => return md,
         option::none => ()
@@ -235,7 +235,7 @@ fn create_block(cx: block) -> @metadata<block_md> {
     let cache = get_cache(cx.ccx());
     let mut cx = cx;
     while option::is_none(cx.node_info) {
-        alt cx.parent {
+        match cx.parent {
           some(b) => cx = b,
           none => fail
         }
@@ -253,12 +253,12 @@ fn create_block(cx: block) -> @metadata<block_md> {
       option::none {}
     }*/
 
-    let parent = alt cx.parent {
+    let parent = match cx.parent {
         none => create_function(cx.fcx).node,
         some(bcx) => create_block(bcx).node
     };
     let file_node = create_file(cx.ccx(), fname);
-    let unique_id = alt cache.find(LexicalBlockTag) {
+    let unique_id = match cache.find(LexicalBlockTag) {
       option::some(v) => vec::len(v) as int,
       option::none => 0
     };
@@ -285,15 +285,15 @@ fn create_basic_type(cx: @crate_ctxt, t: ty::t, ty: ast::prim_ty, span: span)
     -> @metadata<tydesc_md> {
     let cache = get_cache(cx);
     let tg = BasicTypeDescriptorTag;
-    alt cached_metadata::<@metadata<tydesc_md>>(
+    match cached_metadata::<@metadata<tydesc_md>>(
         cache, tg, |md| ty::type_id(t) == md.data.hash) {
       option::some(md) => return md,
       option::none => ()
     }
 
-    let (name, encoding) = alt check ty {
+    let (name, encoding) = match check ty {
       ast::ty_bool => (~"bool", DW_ATE_boolean),
-      ast::ty_int(m) => alt m {
+      ast::ty_int(m) => match m {
         ast::ty_char => (~"char", DW_ATE_unsigned),
         ast::ty_i => (~"int", DW_ATE_signed),
         ast::ty_i8 => (~"i8", DW_ATE_signed_char),
@@ -301,14 +301,14 @@ fn create_basic_type(cx: @crate_ctxt, t: ty::t, ty: ast::prim_ty, span: span)
         ast::ty_i32 => (~"i32", DW_ATE_signed),
         ast::ty_i64 => (~"i64", DW_ATE_signed)
       }
-      ast::ty_uint(m) => alt m {
+      ast::ty_uint(m) => match m {
         ast::ty_u => (~"uint", DW_ATE_unsigned),
         ast::ty_u8 => (~"u8", DW_ATE_unsigned_char),
         ast::ty_u16 => (~"u16", DW_ATE_unsigned),
         ast::ty_u32 => (~"u32", DW_ATE_unsigned),
         ast::ty_u64 => (~"u64", DW_ATE_unsigned)
       }
-      ast::ty_float(m) => alt m {
+      ast::ty_float(m) => match m {
         ast::ty_f => (~"float", DW_ATE_float),
         ast::ty_f32 => (~"f32", DW_ATE_float),
         ast::ty_f64 => (~"f64", DW_ATE_float)
@@ -341,7 +341,7 @@ fn create_pointer_type(cx: @crate_ctxt, t: ty::t, span: span,
     -> @metadata<tydesc_md> {
     let tg = PointerTypeTag;
     /*let cache = cx.llmetadata;
-    alt cached_metadata::<@metadata<tydesc_md>>(
+    match cached_metadata::<@metadata<tydesc_md>>(
         cache, tg, {|md| ty::hash_ty(t) == ty::hash_ty(md.data.hash)}) {
       option::some(md) { return md; }
       option::none {}
@@ -434,7 +434,7 @@ fn create_boxed_type(cx: @crate_ctxt, outer: ty::t, _inner: ty::t,
     -> @metadata<tydesc_md> {
     //let tg = StructureTypeTag;
     /*let cache = cx.llmetadata;
-    alt cached_metadata::<@metadata<tydesc_md>>(
+    match cached_metadata::<@metadata<tydesc_md>>(
         cache, tg, {|md| ty::hash_ty(outer) == ty::hash_ty(md.data.hash)}) {
       option::some(md) { return md; }
       option::none {}
@@ -516,7 +516,7 @@ fn create_vec(cx: @crate_ctxt, vec_t: ty::t, elem_t: ty::t,
 fn create_ty(_cx: @crate_ctxt, _t: ty::t, _ty: @ast::ty)
     -> @metadata<tydesc_md> {
     /*let cache = get_cache(cx);
-    alt cached_metadata::<@metadata<tydesc_md>>(
+    match cached_metadata::<@metadata<tydesc_md>>(
         cache, tg, {|md| t == md.data.hash}) {
       option::some(md) { return md; }
       option::none {}
@@ -536,7 +536,7 @@ fn create_ty(_cx: @crate_ctxt, _t: ty::t, _ty: @ast::ty)
     fail;
     /*
     fn t_to_ty(cx: crate_ctxt, t: ty::t, span: span) -> @ast::ty {
-        let ty = alt ty::get(t).struct {
+        let ty = match ty::get(t).struct {
           ty::ty_nil { ast::ty_nil }
           ty::ty_bot { ast::ty_bot }
           ty::ty_bool { ast::ty_bool }
@@ -566,9 +566,9 @@ fn t_to_ty(cx: crate_ctxt, t: ty::t, span: span) -> @ast::ty {
         return @{node: ty, span: span};
     }
 
-    alt ty.node {
+    match ty.node {
       ast::ty_box(mt) {
-        let inner_t = alt ty::get(t).struct {
+        let inner_t = match ty::get(t).struct {
           ty::ty_box(boxed) { boxed.ty }
           _ { cx.sess.span_bug(ty.span, "t_to_ty was incoherent"); }
         };
@@ -578,7 +578,7 @@ fn t_to_ty(cx: crate_ctxt, t: ty::t, span: span) -> @ast::ty {
       }
 
       ast::ty_uniq(mt) {
-        let inner_t = alt ty::get(t).struct {
+        let inner_t = match ty::get(t).struct {
           ty::ty_uniq(boxed) { boxed.ty }
           // Hoping we'll have a way to eliminate this check soon.
           _ { cx.sess.span_bug(ty.span, "t_to_ty was incoherent"); }
@@ -604,7 +604,7 @@ fn t_to_ty(cx: crate_ctxt, t: ty::t, span: span) -> @ast::ty {
       }
 
       ast::ty_path(_, id) {
-        alt cx.tcx.def_map.get(id) {
+        match cx.tcx.def_map.get(id) {
           ast::def_prim_ty(pty) {
             return create_basic_type(cx, t, pty, ty.span);
           }
@@ -639,13 +639,13 @@ fn create_local_var(bcx: block, local: @ast::local)
     let cx = bcx.ccx();
     let cache = get_cache(cx);
     let tg = AutoVariableTag;
-    alt cached_metadata::<@metadata<local_var_md>>(
+    match cached_metadata::<@metadata<local_var_md>>(
         cache, tg, |md| md.data.id == local.node.id) {
       option::some(md) => return md,
       option::none => ()
     }
 
-    let name = alt local.node.pat.node {
+    let name = match local.node.pat.node {
       ast::pat_ident(_, pth, _) => ast_util::path_to_ident(pth),
       // FIXME this should be handled (#2533)
       _ => fail ~"no single variable name for local"
@@ -655,7 +655,7 @@ fn create_local_var(bcx: block, local: @ast::local)
     let ty = node_id_type(bcx, local.node.id);
     let tymd = create_ty(cx, ty, local.node.ty);
     let filemd = create_file(cx, loc.file.name);
-    let context = alt bcx.parent {
+    let context = match bcx.parent {
         none => create_function(bcx.fcx).node,
         some(_) => create_block(bcx).node
     };
@@ -664,14 +664,14 @@ fn create_local_var(bcx: block, local: @ast::local)
     let mdval = @{node: mdnode, data: {id: local.node.id}};
     update_cache(cache, AutoVariableTag, local_var_metadata(mdval));
 
-    let llptr = alt bcx.fcx.lllocals.find(local.node.id) {
+    let llptr = match bcx.fcx.lllocals.find(local.node.id) {
       option::some(local_mem(v)) => v,
       option::some(_) => {
         bcx.tcx().sess.span_bug(local.span, ~"local is bound to \
                 something weird");
       }
       option::none => {
-        alt bcx.fcx.lllocals.get(local.node.pat.id) {
+        match bcx.fcx.lllocals.get(local.node.pat.id) {
           local_imm(v) => v,
           _ => bcx.tcx().sess.span_bug(local.span, ~"local is bound to \
                                                      something weird")
@@ -689,7 +689,7 @@ fn create_arg(bcx: block, arg: ast::arg, sp: span)
     let fcx = bcx.fcx, cx = fcx.ccx;
     let cache = get_cache(cx);
     let tg = ArgVariableTag;
-    alt cached_metadata::<@metadata<argument_md>>(
+    match cached_metadata::<@metadata<argument_md>>(
         cache, ArgVariableTag, |md| md.data.id == arg.id) {
       option::some(md) => return md,
       option::none => ()
@@ -706,7 +706,7 @@ fn create_arg(bcx: block, arg: ast::arg, sp: span)
     let mdval = @{node: mdnode, data: {id: arg.id}};
     update_cache(cache, tg, argument_metadata(mdval));
 
-    let llptr = alt fcx.llargs.get(arg.id) {
+    let llptr = match fcx.llargs.get(arg.id) {
       local_mem(v) | local_imm(v) => v,
     };
     let declargs = ~[llmdnode(~[llptr]), mdnode];
@@ -740,9 +740,9 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
     let sp = option::get(fcx.span);
     log(debug, codemap::span_to_str(sp, cx.sess.codemap));
 
-    let (ident, ret_ty, id) = alt cx.tcx.items.get(fcx.id) {
+    let (ident, ret_ty, id) = match cx.tcx.items.get(fcx.id) {
       ast_map::node_item(item, _) => {
-        alt item.node {
+        match item.node {
           ast::item_fn(decl, _, _) => {
             (item.ident, decl.output, item.id)
           }
@@ -758,7 +758,7 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
         (nm, ctor.node.dec.output, ctor.node.id)
       }
       ast_map::node_expr(expr) => {
-        alt expr.node {
+        match expr.node {
           ast::expr_fn(_, decl, _, _) => {
             (@dbg_cx.names(~"fn"), decl.output, expr.id)
           }
@@ -778,7 +778,7 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
     log(debug, id);
 
     let cache = get_cache(cx);
-    alt cached_metadata::<@metadata<subprogram_md>>(
+    match cached_metadata::<@metadata<subprogram_md>>(
         cache, SubprogramTag, |md| md.data.id == id) {
       option::some(md) => return md,
       option::none => ()
@@ -788,7 +788,7 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
                                        sp.lo);
     let file_node = create_file(cx, loc.file.name).node;
     let ty_node = if cx.sess.opts.extra_debuginfo {
-        alt ret_ty.node {
+        match ret_ty.node {
           ast::ty_nil => llnull(),
           _ => create_ty(cx, ty::node_id_to_type(cx.tcx, id), ret_ty).node
         }
index 56f8892ff37e2e752b5cb8be60ea782065ab448e..1555f2df89ae0eef678d5675412568f49bea3647 100644 (file)
@@ -38,7 +38,7 @@ enum x86_64_reg_class {
 }
 
 fn is_sse(++c: x86_64_reg_class) -> bool {
-    return alt c {
+    return match c {
         sse_fs_class | sse_fv_class |
         sse_ds_class | sse_dv_class => true,
         _ => false
@@ -73,7 +73,7 @@ fn struct_tys(ty: TypeRef) -> ~[TypeRef] {
     }
 
     fn ty_align(ty: TypeRef) -> uint {
-        return alt llvm::LLVMGetTypeKind(ty) as int {
+        return match llvm::LLVMGetTypeKind(ty) as int {
             8 /* integer */ => {
                 ((llvm::LLVMGetIntTypeWidth(ty) as uint) + 7u) / 8u
             }
@@ -94,7 +94,7 @@ fn ty_align(ty: TypeRef) -> uint {
     }
 
     fn ty_size(ty: TypeRef) -> uint {
-        return alt llvm::LLVMGetTypeKind(ty) as int {
+        return match llvm::LLVMGetTypeKind(ty) as int {
             8 /* integer */ => {
                 ((llvm::LLVMGetIntTypeWidth(ty) as uint) + 7u) / 8u
             }
@@ -179,7 +179,7 @@ fn classify(ty: TypeRef,
             return;
         }
 
-        alt llvm::LLVMGetTypeKind(ty) as int {
+        match llvm::LLVMGetTypeKind(ty) as int {
             8 /* integer */ |
             12 /* pointer */ => {
                 unify(cls, ix + off / 8u, integer_class);
@@ -285,7 +285,7 @@ fn llvec_len(cls: ~[x86_64_reg_class]) -> uint {
     let mut i = 0u;
     let e = vec::len(cls);
     while i < e {
-        alt cls[i] {
+        match cls[i] {
             integer_class => {
                 vec::push(tys, T_i64());
             }
@@ -326,7 +326,7 @@ fn x86_64_tys(atys: ~[TypeRef],
               rty: TypeRef,
               ret_def: bool) -> x86_64_tys {
     fn is_reg_ty(ty: TypeRef) -> bool {
-        return alt llvm::LLVMGetTypeKind(ty) as int {
+        return match llvm::LLVMGetTypeKind(ty) as int {
             8 /* integer */ |
             12 /* pointer */ |
             2 /* float */ |
@@ -401,7 +401,7 @@ fn decl_x86_64_fn(tys: x86_64_tys,
     let llfn = decl(fnty);
 
     do vec::iteri(tys.attrs) |i, a| {
-        alt a {
+        match a {
             option::some(attr) => {
                 let llarg = get_param(llfn, i);
                 llvm::LLVMAddAttribute(llarg, attr as c_uint);
@@ -413,7 +413,7 @@ fn decl_x86_64_fn(tys: x86_64_tys,
 }
 
 fn link_name(i: @ast::foreign_item) -> ~str {
-    alt attr::first_attr_value_str_by_name(i.attrs, ~"link_name") {
+    match attr::first_attr_value_str_by_name(i.attrs, ~"link_name") {
       none => return *i.ident,
       option::some(ln) => return *ln
     }
@@ -430,7 +430,7 @@ fn link_name(i: @ast::foreign_item) -> ~str {
 
 fn c_arg_and_ret_lltys(ccx: @crate_ctxt,
                        id: ast::node_id) -> (~[TypeRef], TypeRef, ty::t) {
-    alt ty::get(ty::node_id_to_type(ccx.tcx, id)).struct {
+    match ty::get(ty::node_id_to_type(ccx.tcx, id)).struct {
       ty::ty_fn({inputs: arg_tys, output: ret_ty, _}) => {
         let llargtys = type_of_explicit_args(ccx, arg_tys);
         let llretty = type_of::type_of(ccx, ret_ty);
@@ -587,7 +587,7 @@ fn build_args(bcx: block, tys: @c_stack_tys,
             let mut i = 0u;
             let n = vec::len(tys.arg_tys);
 
-            alt tys.x86_64_tys {
+            match tys.x86_64_tys {
                 some(x86_64) => {
                     let mut atys = x86_64.arg_tys;
                     let mut attrs = x86_64.attrs;
@@ -629,10 +629,10 @@ fn build_args(bcx: block, tys: @c_stack_tys,
         fn build_ret(bcx: block, tys: @c_stack_tys,
                      llargbundle: ValueRef, llretval: ValueRef)  {
             let _icx = bcx.insn_ctxt(~"foreign::shim::build_ret");
-            alt tys.x86_64_tys {
+            match tys.x86_64_tys {
                 some(x86_64) => {
                   do vec::iteri(x86_64.attrs) |i, a| {
-                        alt a {
+                        match a {
                             some(attr) => {
                                 llvm::LLVMAddInstrAttribute(
                                     llretval, (i + 1u) as c_uint,
@@ -680,7 +680,7 @@ fn build_ret(bcx: block, tys: @c_stack_tys,
     fn base_fn(ccx: @crate_ctxt, lname: ~str, tys: @c_stack_tys,
                cc: lib::llvm::CallConv) -> ValueRef {
         // Declare the "prototype" for the base function F:
-        alt tys.x86_64_tys {
+        match tys.x86_64_tys {
           some(x86_64) => {
             do decl_x86_64_fn(x86_64) |fnty| {
                 decl_fn(ccx.llmod, lname, cc, fnty)
@@ -747,14 +747,14 @@ fn build_ret(bcx: block, _tys: @c_stack_tys,
                        build_args, build_ret);
     }
 
-    let mut cc = alt abi {
+    let mut cc = match abi {
       ast::foreign_abi_rust_intrinsic |
       ast::foreign_abi_cdecl => lib::llvm::CCallConv,
       ast::foreign_abi_stdcall => lib::llvm::X86StdcallCallConv
     };
 
     for vec::each(foreign_mod.items) |foreign_item| {
-      alt foreign_item.node {
+      match foreign_item.node {
         ast::foreign_item_fn(fn_decl, typarams) => {
           let id = foreign_item.id;
           if abi != ast::foreign_abi_rust_intrinsic {
@@ -772,7 +772,7 @@ fn build_ret(bcx: block, _tys: @c_stack_tys,
               // monomorphic_fn, but ones without are emitted here
               if typarams.is_empty() {
                   let llwrapfn = get_item_val(ccx, id);
-                  let path = alt ccx.tcx.items.find(id) {
+                  let path = match ccx.tcx.items.find(id) {
                       some(ast_map::node_foreign_item(_, _, pt)) => pt,
                       _ => {
                           ccx.sess.span_bug(foreign_item.span,
@@ -799,7 +799,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item,
     let fcx = new_fn_ctxt_w_id(ccx, path, decl, item.id,
                                some(substs), some(item.span));
     let mut bcx = top_scope_block(fcx, none), lltop = bcx.llbb;
-    alt check *item.ident {
+    match check *item.ident {
       ~"atomic_xchng" => {
         let old = AtomicRMW(bcx, Xchg,
                   get_param(decl, first_real_arg),
@@ -925,7 +925,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item,
         let tp_sz = shape::llsize_of_real(ccx, lltp_ty),
             out_sz = shape::llsize_of_real(ccx, llout_ty);
         if tp_sz != out_sz {
-            let sp = alt check ccx.tcx.items.get(option::get(ref_id)) {
+            let sp = match check ccx.tcx.items.get(option::get(ref_id)) {
               ast_map::node_expr(e) => e.span
             };
             ccx.sess.span_fatal(
@@ -1045,7 +1045,7 @@ fn build_wrap_fn(ccx: @crate_ctxt, llshimfn: ValueRef,
         fn build_args(bcx: block, tys: @c_stack_tys,
                       llwrapfn: ValueRef, llargbundle: ValueRef) {
             let _icx = bcx.insn_ctxt(~"foreign::foreign::wrap::build_args");
-            alt tys.x86_64_tys {
+            match tys.x86_64_tys {
                 option::some(x86_64) => {
                     let mut atys = x86_64.arg_tys;
                     let mut attrs = x86_64.attrs;
@@ -1099,7 +1099,7 @@ fn build_args(bcx: block, tys: @c_stack_tys,
         fn build_ret(bcx: block, tys: @c_stack_tys,
                      llargbundle: ValueRef) {
             let _icx = bcx.insn_ctxt(~"foreign::foreign::wrap::build_ret");
-            alt tys.x86_64_tys {
+            match tys.x86_64_tys {
                 option::some(x86_64) => {
                     if x86_64.sret || !tys.ret_def {
                         RetVoid(bcx);
@@ -1161,11 +1161,11 @@ fn register_foreign_fn(ccx: @crate_ctxt, sp: span,
 
 fn abi_of_foreign_fn(ccx: @crate_ctxt, i: @ast::foreign_item)
     -> ast::foreign_abi {
-    alt attr::first_attr_value_str_by_name(i.attrs, ~"abi") {
-      none => alt check ccx.tcx.items.get(i.id) {
+    match attr::first_attr_value_str_by_name(i.attrs, ~"abi") {
+      none => match check ccx.tcx.items.get(i.id) {
         ast_map::node_foreign_item(_, abi, _) => abi
       }
-      some(_) => alt attr::foreign_abi(i.attrs) {
+      some(_) => match attr::foreign_abi(i.attrs) {
         either::right(abi) => abi,
         either::left(msg) => ccx.sess.span_fatal(i.span, msg)
       }
index 434707f3fa8d50dd349d06ff5c6254b56119d1b9..979bb6e847a948a09affc0e1e43a40418ca8cf68 100644 (file)
@@ -52,7 +52,7 @@ fn trans_method_callee(bcx: block, callee_id: ast::node_id,
                        self: @ast::expr, mentry: typeck::method_map_entry)
     -> lval_maybe_callee {
     let _icx = bcx.insn_ctxt(~"impl::trans_method_callee");
-    alt mentry.origin {
+    match mentry.origin {
       typeck::method_static(did) => {
         let {bcx, val} = trans_self_arg(bcx, self, mentry.derefs);
         {env: self_env(val, node_id_type(bcx, self.id), none)
@@ -60,7 +60,7 @@ fn trans_method_callee(bcx: block, callee_id: ast::node_id,
       }
       typeck::method_param({trait_id:iid, method_num:off,
                             param_num:p, bound_num:b}) => {
-        alt check bcx.fcx.param_substs {
+        match check bcx.fcx.param_substs {
           some(substs) => {
             trans_monomorphized_callee(bcx, callee_id, self, mentry.derefs,
                                        iid, off, p, b, substs)
@@ -83,7 +83,7 @@ fn method_from_methods(ms: ~[@ast::method], name: ast::ident)
 fn method_with_name(ccx: @crate_ctxt, impl_id: ast::def_id,
                     name: ast::ident) -> ast::def_id {
     if impl_id.crate == ast::local_crate {
-        alt check ccx.tcx.items.get(impl_id.node) {
+        match check ccx.tcx.items.get(impl_id.node) {
           ast_map::node_item(@{node: ast::item_impl(_, _, _, ms), _}, _) => {
             method_from_methods(ms, name)
           }
@@ -101,7 +101,7 @@ fn method_with_name(ccx: @crate_ctxt, impl_id: ast::def_id,
 fn method_ty_param_count(ccx: @crate_ctxt, m_id: ast::def_id,
                          i_id: ast::def_id) -> uint {
     if m_id.crate == ast::local_crate {
-        alt check ccx.tcx.items.get(m_id.node) {
+        match check ccx.tcx.items.get(m_id.node) {
           ast_map::node_method(m, _, _) => vec::len(m.tps),
         }
     } else {
@@ -116,7 +116,7 @@ fn trans_monomorphized_callee(bcx: block, callee_id: ast::node_id,
                               n_param: uint, n_bound: uint,
                               substs: param_substs) -> lval_maybe_callee {
     let _icx = bcx.insn_ctxt(~"impl::trans_monomorphized_callee");
-    alt find_vtable_in_fn_ctxt(substs, n_param, n_bound) {
+    match find_vtable_in_fn_ctxt(substs, n_param, n_bound) {
       typeck::vtable_static(impl_did, impl_substs, sub_origins) => {
         let ccx = bcx.ccx();
         let mname = ty::trait_methods(ccx.tcx, trait_id)[n_method].ident;
@@ -173,7 +173,7 @@ fn find_vtable_in_fn_ctxt(ps: param_substs, n_param: uint, n_bound: uint)
     for vec::each(*ps.bounds) |bounds| {
         if i >= n_param { break; }
         for vec::each(*bounds) |bound| {
-            alt bound { ty::bound_trait(_) => vtable_off += 1u, _ => () }
+            match bound { ty::bound_trait(_) => vtable_off += 1u, _ => () }
         }
         i += 1u;
     }
@@ -189,9 +189,9 @@ fn resolve_vtables_in_fn_ctxt(fcx: fn_ctxt, vts: typeck::vtable_res)
 // eliminate any vtable_params.
 fn resolve_vtable_in_fn_ctxt(fcx: fn_ctxt, vt: typeck::vtable_origin)
     -> typeck::vtable_origin {
-    alt vt {
+    match vt {
       typeck::vtable_static(iid, tys, sub) => {
-        let tys = alt fcx.param_substs {
+        let tys = match fcx.param_substs {
           some(substs) => {
             vec::map(tys, |t| ty::subst_tps(fcx.ccx.tcx, substs.tys, t))
           }
@@ -200,7 +200,7 @@ fn resolve_vtable_in_fn_ctxt(fcx: fn_ctxt, vt: typeck::vtable_origin)
         typeck::vtable_static(iid, tys, resolve_vtables_in_fn_ctxt(fcx, sub))
       }
       typeck::vtable_param(n_param, n_bound) => {
-        alt check fcx.param_substs {
+        match check fcx.param_substs {
           some(substs) => {
             find_vtable_in_fn_ctxt(substs, n_param, n_bound)
           }
@@ -211,7 +211,7 @@ fn resolve_vtable_in_fn_ctxt(fcx: fn_ctxt, vt: typeck::vtable_origin)
 }
 
 fn vtable_id(ccx: @crate_ctxt, origin: typeck::vtable_origin) -> mono_id {
-    alt check origin {
+    match check origin {
       typeck::vtable_static(impl_id, substs, sub_vtables) => {
         make_mono_id(ccx, impl_id, substs,
                      if (*sub_vtables).len() == 0u { none }
@@ -227,9 +227,9 @@ fn vtable_id(ccx: @crate_ctxt, origin: typeck::vtable_origin) -> mono_id {
 fn get_vtable(ccx: @crate_ctxt, origin: typeck::vtable_origin)
     -> ValueRef {
     let hash_id = vtable_id(ccx, origin);
-    alt ccx.vtables.find(hash_id) {
+    match ccx.vtables.find(hash_id) {
       some(val) => val,
-      none => alt check origin {
+      none => match check origin {
         typeck::vtable_static(id, substs, sub_vtables) => {
             make_impl_vtable(ccx, id, substs, sub_vtables)
         }
index b149857ffaa7c4de93d8d377679f14e93d5a9081..9637b5b7ce5f4ce0fb8f9ae817ef047280ecd055 100644 (file)
@@ -34,11 +34,11 @@ fn find_reachable(crate_mod: _mod, exp_map: resolve3::ExportMap,
 fn traverse_exports(cx: ctx, vis: ~[@view_item]) -> bool {
     let mut found_export = false;
     for vec::each(vis) |vi| {
-        alt vi.node {
+        match vi.node {
           view_item_export(vps) => {
             found_export = true;
             for vec::each(vps) |vp| {
-                alt vp.node {
+                match vp.node {
                   view_path_simple(_, _, id) | view_path_glob(_, id) |
                   view_path_list(_, _, id) => {
                     traverse_export(cx, id);
@@ -60,11 +60,11 @@ fn traverse_export(cx: ctx, exp_id: node_id) {
 
 fn traverse_def_id(cx: ctx, did: def_id) {
     if did.crate != local_crate { return; }
-    let n = alt cx.tcx.items.find(did.node) {
+    let n = match cx.tcx.items.find(did.node) {
         none => return, // This can happen for self, for example
         some(n) => n
     };
-    alt n {
+    match n {
       ast_map::node_item(item, _) => traverse_public_item(cx, item),
       ast_map::node_method(_, impl_id, _) => traverse_def_id(cx, impl_id),
       ast_map::node_foreign_item(item, _, _) => {
@@ -89,7 +89,7 @@ fn traverse_public_mod(cx: ctx, m: _mod) {
 fn traverse_public_item(cx: ctx, item: @item) {
     if cx.rmap.contains_key(item.id) { return; }
     cx.rmap.insert(item.id, ());
-    alt item.node {
+    match item.node {
       item_mod(m) => traverse_public_mod(cx, m),
       item_foreign_mod(nm) => {
           if !traverse_exports(cx, nm.view_items) {
@@ -127,7 +127,7 @@ fn traverse_public_item(cx: ctx, item: @item) {
             }
         }
         for vec::each(items) |item| {
-            alt item.node {
+            match item.node {
               class_method(m) => {
                 cx.rmap.insert(m.id, ());
                 if tps.len() > 0u ||
@@ -156,9 +156,9 @@ fn traverse_ty(ty: @ty, cx: ctx, v: visit::vt<ctx>) {
     if cx.rmap.contains_key(ty.id) { return; }
     cx.rmap.insert(ty.id, ());
 
-    alt ty.node {
+    match ty.node {
       ty_path(p, p_id) => {
-        alt cx.tcx.def_map.find(p_id) {
+        match cx.tcx.def_map.find(p_id) {
           // Kind of a hack to check this here, but I'm not sure what else
           // to do
           some(def_prim_ty(_)) => { /* do nothing */ }
@@ -173,9 +173,9 @@ fn traverse_ty(ty: @ty, cx: ctx, v: visit::vt<ctx>) {
 
 fn traverse_inline_body(cx: ctx, body: blk) {
     fn traverse_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
-        alt e.node {
+        match e.node {
           expr_path(_) => {
-            alt cx.tcx.def_map.find(e.id) {
+            match cx.tcx.def_map.find(e.id) {
                 some(d) => {
                   traverse_def_id(cx, def_id_of_def(d));
                 }
@@ -184,7 +184,7 @@ fn traverse_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
             }
           }
           expr_field(_, _, _) => {
-            alt cx.method_map.find(e.id) {
+            match cx.method_map.find(e.id) {
               some({origin: typeck::method_static(did), _}) => {
                 traverse_def_id(cx, did);
               }
@@ -213,7 +213,7 @@ fn traverse_all_resources_and_impls(cx: ctx, crate_mod: _mod) {
         visit_expr: |_e, _cx, _v| { },
         visit_item: |i, cx, v| {
             visit::visit_item(i, cx, v);
-            alt i.node {
+            match i.node {
               item_class(_, _, _, _, some(_)) => {
                 traverse_public_item(cx, i);
               }
index c4d4cd6f9b35aaf9c76a7eff495833336b70149f..fbcb01ff68e76d0efb5d1dd40aae3842f76adeec 100644 (file)
@@ -91,7 +91,7 @@ fn bracketed(bracket_name: ~str, extra: ~[ValueRef],
     fn vstore_name_and_extra(t: ty::t,
                              vstore: ty::vstore,
                              f: fn(~str,~[ValueRef])) {
-        alt vstore {
+        match vstore {
           ty::vstore_fixed(n) => {
             let extra = vec::append(~[self.c_uint(n)],
                                     self.c_size_and_align(t));
@@ -114,7 +114,7 @@ fn visit_ty(t: ty::t) {
         debug!{"reflect::visit_ty %s",
                ty_to_str(bcx.ccx().tcx, t)};
 
-        alt ty::get(t).struct {
+        match ty::get(t).struct {
           ty::ty_bot => self.leaf(~"bot"),
           ty::ty_nil => self.leaf(~"nil"),
           ty::ty_bool => self.leaf(~"bool"),
@@ -178,19 +178,19 @@ fn visit_ty(t: ty::t) {
           // FIXME (#2594): fetch constants out of intrinsic:: for the
           // numbers.
           ty::ty_fn(fty) => {
-            let pureval = alt fty.purity {
+            let pureval = match fty.purity {
               ast::pure_fn => 0u,
               ast::unsafe_fn => 1u,
               ast::impure_fn => 2u,
               ast::extern_fn => 3u
             };
-            let protoval = alt fty.proto {
+            let protoval = match fty.proto {
               ast::proto_bare => 0u,
               ast::proto_uniq => 2u,
               ast::proto_box => 3u,
               ast::proto_block => 4u
             };
-            let retval = alt fty.ret_style {
+            let retval = match fty.ret_style {
               ast::noreturn => 0u,
               ast::return_val => 1u
             };
@@ -200,9 +200,9 @@ fn visit_ty(t: ty::t) {
                          self.c_uint(retval)];
             self.visit(~"enter_fn", extra);
             for fty.inputs.eachi |i, arg| {
-                let modeval = alt arg.mode {
+                let modeval = match arg.mode {
                   ast::infer(_) => 0u,
-                  ast::expl(e) => alt e {
+                  ast::expl(e) => match e {
                     ast::by_ref => 1u,
                     ast::by_val => 2u,
                     ast::by_mutbl_ref => 3u,
@@ -274,7 +274,7 @@ fn visit_ty(t: ty::t) {
           ty::ty_type => self.leaf(~"type"),
           ty::ty_opaque_box => self.leaf(~"opaque_box"),
           ty::ty_opaque_closure_ptr(ck) => {
-            let ckval = alt ck {
+            let ckval = match ck {
               ty::ck_block => 0u,
               ty::ck_box => 1u,
               ty::ck_uniq => 2u
index d6d5d96e4dc18c6d7fc9800befa4cd6b16d330fa..2d57b71e68383a868879e36db72a0ab4223fc1bc 100644 (file)
@@ -149,7 +149,7 @@ fn enum_kind(ccx: @crate_ctxt, did: ast::def_id) -> enum_kind {
 
 // Returns the code corresponding to the pointer size on this architecture.
 fn s_int(tcx: ty_ctxt) -> u8 {
-    return alt tcx.sess.targ_cfg.arch {
+    return match tcx.sess.targ_cfg.arch {
         session::arch_x86 => shape_i32,
         session::arch_x86_64 => shape_i64,
         session::arch_arm => shape_i32
@@ -157,7 +157,7 @@ fn s_int(tcx: ty_ctxt) -> u8 {
 }
 
 fn s_uint(tcx: ty_ctxt) -> u8 {
-    return alt tcx.sess.targ_cfg.arch {
+    return match tcx.sess.targ_cfg.arch {
         session::arch_x86 => shape_u32,
         session::arch_x86_64 => shape_u64,
         session::arch_arm => shape_u32
@@ -165,7 +165,7 @@ fn s_uint(tcx: ty_ctxt) -> u8 {
 }
 
 fn s_float(tcx: ty_ctxt) -> u8 {
-    return alt tcx.sess.targ_cfg.arch {
+    return match tcx.sess.targ_cfg.arch {
         session::arch_x86 => shape_f64,
         session::arch_x86_64 => shape_f64,
         session::arch_arm => shape_f64
@@ -213,7 +213,7 @@ fn add_substr(&dest: ~[u8], src: ~[u8]) {
 }
 
 fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] {
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_nil | ty::ty_bool | ty::ty_uint(ast::ty_u8) |
       ty::ty_bot => ~[shape_u8],
       ty::ty_int(ast::ty_i) => ~[s_int(ccx.tcx)],
@@ -233,13 +233,13 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] {
         shape_of(ccx, tvec::expand_boxed_vec_ty(ccx.tcx, t))
       }
       ty::ty_enum(did, substs) => {
-        alt enum_kind(ccx, did) {
+        match enum_kind(ccx, did) {
           tk_unit => ~[s_variant_enum_t(ccx.tcx)],
           tk_enum => ~[s_variant_enum_t(ccx.tcx)],
           tk_newtype | tk_complex => {
             let mut s = ~[shape_enum], id;
             let nom_id = mk_nominal_id(ccx.tcx, did, none, substs.tps);
-            alt ccx.shape_cx.tag_id_to_index.find(nom_id) {
+            match ccx.shape_cx.tag_id_to_index.find(nom_id) {
               none => {
                 id = ccx.shape_cx.next_tag_id;
                 ccx.shape_cx.tag_id_to_index.insert(nom_id, id);
@@ -678,7 +678,7 @@ fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
 // Computes the size of the data part of an enum.
 fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
     if cx.enum_sizes.contains_key(t) { return cx.enum_sizes.get(t); }
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_enum(tid, substs) => {
         // Compute max(variant sizes).
         let mut max_size = 0u;
@@ -712,7 +712,7 @@ fn nilptr(tcx: ty::ctxt) -> ty::t {
         ty::mk_ptr(tcx, {ty: ty::mk_nil(tcx), mutbl: ast::m_imm})
     }
     fn simplifier(tcx: ty::ctxt, typ: ty::t) -> ty::t {
-        alt ty::get(typ).struct {
+        match ty::get(typ).struct {
           ty::ty_box(_) | ty::ty_opaque_box | ty::ty_uniq(_) |
           ty::ty_evec(_, ty::vstore_uniq) | ty::ty_evec(_, ty::vstore_box) |
           ty::ty_estr(ty::vstore_uniq) | ty::ty_estr(ty::vstore_box) |
index 84d7ca370f9dba07c5fb78c3ee3c68223c0a9456..aa92c96a686819831a37c91adb66a88813b71662 100644 (file)
@@ -19,7 +19,7 @@
 fn expand_boxed_vec_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
     let unit_ty = ty::sequence_element_type(tcx, t);
     let unboxed_vec_ty = ty::mk_mut_unboxed_vec(tcx, unit_ty);
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_estr(ty::vstore_uniq) | ty::ty_evec(_, ty::vstore_uniq) => {
         ty::mk_imm_uniq(tcx, unboxed_vec_ty)
       }
@@ -156,10 +156,10 @@ fn trans_evec(bcx: block, elements: evec_elements,
     let unit_sz = llsize_of(ccx, llunitty);
 
     let mut {bcx, val, dataptr} =
-        alt vst {
+        match vst {
           ast::vstore_fixed(_) => {
             // Destination should be pre-allocated for us.
-            let v = alt dest {
+            let v = match dest {
               base::save_in(v) => {
                 PointerCast(bcx, v, T_ptr(llunitty))
               }
@@ -245,7 +245,7 @@ fn trans_evec(bcx: block, elements: evec_elements,
 
     for vec::each(temp_cleanups) |cln| { revoke_clean(bcx, cln); }
 
-    alt vst {
+    match vst {
       ast::vstore_fixed(_) => {
         // We wrote into the destination in the fixed case.
         return bcx;
@@ -261,7 +261,7 @@ fn trans_evec(bcx: block, elements: evec_elements,
 
 fn trans_vstore(bcx: block, e: @ast::expr,
                 v: ast::vstore, dest: dest) -> block {
-    alt e.node {
+    match e.node {
       ast::expr_lit(@{node: ast::lit_str(s), span: _}) => {
         return trans_estr(bcx, s, some(v), dest);
       }
@@ -288,12 +288,12 @@ fn get_base_and_len(cx: block, v: ValueRef, e_ty: ty::t)
     let llunitty = type_of::type_of(ccx, unit_ty);
     let unit_sz = llsize_of(ccx, llunitty);
 
-    let vstore = alt ty::get(vec_ty).struct {
+    let vstore = match ty::get(vec_ty).struct {
       ty::ty_estr(vst) | ty::ty_evec(_, vst) => vst,
       _ => ty::vstore_uniq
     };
 
-    alt vstore {
+    match vstore {
       ty::vstore_fixed(n) => {
         let base = GEPi(cx, v, ~[0u, 0u]);
         let n = if ty::type_is_str(e_ty) { n + 1u } else { n };
@@ -319,7 +319,7 @@ fn trans_estr(bcx: block, s: @~str, vstore: option<ast::vstore>,
     if dest == base::ignore { return bcx; }
     let ccx = bcx.ccx();
 
-    let c = alt vstore {
+    let c = match vstore {
       some(ast::vstore_fixed(_)) => {
         // "hello"/_  =>  "hello"/5  =>  ~[i8 x 6] in llvm
         debug!{"trans_estr: fixed: %s", *s};
index 03f7d2b5482439b16b48e8e71586f777a37d495f..73daa654d28d2be82c589cb64f5b18a85f701c26 100644 (file)
@@ -17,7 +17,7 @@ fn type_of_explicit_args(cx: @crate_ctxt,
     do vec::map(inputs) |arg| {
         let arg_ty = arg.ty;
         let llty = type_of(cx, arg_ty);
-        alt ty::resolved_mode(cx.tcx, arg.mode) {
+        match ty::resolved_mode(cx.tcx, arg.mode) {
           ast::by_val => llty,
           _ => T_ptr(llty)
         }
@@ -51,7 +51,7 @@ fn type_of_non_gc_box(cx: @crate_ctxt, t: ty::t) -> TypeRef {
     if t != t_norm {
         type_of_non_gc_box(cx, t_norm)
     } else {
-        alt ty::get(t).struct {
+        match ty::get(t).struct {
           ty::ty_box(mt) => {
             T_ptr(T_box(cx, type_of(cx, mt.ty)))
           }
@@ -83,7 +83,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
         llty = type_of(cx, t_norm);
         cx.lltypes.insert(t, llty);
     } else {
-        llty = alt ty::get(t).struct {
+        llty = match ty::get(t).struct {
           ty::ty_nil | ty::ty_bot => T_nil(),
           ty::ty_bool => T_bool(),
           ty::ty_int(t) => T_int_ty(cx, t),
@@ -166,7 +166,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
         cx.lltypes.insert(t, llty);
 
         // If this was a class, fill in the type now.
-        alt ty::get(t).struct {
+        match ty::get(t).struct {
           ty::ty_class(did, ts) => {
             // Only instance vars are record fields at runtime.
             let fields = ty::lookup_class_fields(cx.tcx, did);
@@ -225,7 +225,7 @@ fn type_of_enum(cx: @crate_ctxt, did: ast::def_id, t: ty::t)
 }
 
 fn llvm_type_name(cx: @crate_ctxt, t: ty::t) -> ~str {
-    let (name, did, tps) = alt check ty::get(t).struct {
+    let (name, did, tps) = match check ty::get(t).struct {
       ty::ty_enum(did, substs) => (~"enum", did, substs.tps),
       ty::ty_class(did, substs) => (~"class", did, substs.tps)
     };
index 4026d2b0a2497fd2a7fe65d473f0742c5e5244cf..b7f9fdc459dba31f0f5ba29aa296b21328df754c 100644 (file)
@@ -35,7 +35,7 @@
 
 fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
     -> ~[type_uses] {
-    alt ccx.type_use_cache.find(fn_id) {
+    match ccx.type_use_cache.find(fn_id) {
       some(uses) => return uses,
       none => ()
     }
@@ -45,7 +45,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
     ccx.type_use_cache.insert(fn_id, vec::from_elem(n_tps, 3u));
 
     let cx = {ccx: ccx, uses: vec::to_mut(vec::from_elem(n_tps, 0u))};
-    alt ty::get(ty::lookup_item_type(cx.ccx.tcx, fn_id).ty).struct {
+    match ty::get(ty::lookup_item_type(cx.ccx.tcx, fn_id).ty).struct {
       ty::ty_fn({inputs, _}) => {
         for vec::each(inputs) |arg| {
             if arg.mode == expl(by_val) { type_needs(cx, use_repr, arg.ty); }
@@ -59,12 +59,12 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
         ccx.type_use_cache.insert(fn_id, uses);
         return uses;
     }
-    let map_node = alt ccx.tcx.items.find(fn_id_loc.node) {
+    let map_node = match ccx.tcx.items.find(fn_id_loc.node) {
         some(x) => x,
         none    => ccx.sess.bug(fmt!{"type_uses_for: unbound item ID %?",
                                      fn_id_loc})
     };
-    alt check map_node {
+    match check map_node {
       ast_map::node_item(@{node: item_fn(_, _, body), _}, _) |
       ast_map::node_method(@{body, _}, _, _) => {
         handle_body(cx, body);
@@ -75,7 +75,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
       ast_map::node_foreign_item(i@@{node: foreign_item_fn(_, _), _},
                                  abi, _) => {
         if abi == foreign_abi_rust_intrinsic {
-            let flags = alt check *i.ident {
+            let flags = match check *i.ident {
               ~"size_of" |  ~"pref_align_of" | ~"min_align_of" |
               ~"init" |  ~"reinterpret_cast" |
               ~"move_val" | ~"move_val_init" => {
@@ -120,7 +120,7 @@ fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
                     enums_seen: @list<def_id>) {
     do ty::maybe_walk_ty(ty) |ty| {
         if ty::type_has_params(ty) {
-            alt ty::get(ty).struct {
+            match ty::get(ty).struct {
                 /*
                  This previously included ty_box -- that was wrong
                  because if we cast an @T to an trait (for example) and return
@@ -156,7 +156,7 @@ fn node_type_needs(cx: ctx, use: uint, id: node_id) {
 }
 
 fn mark_for_expr(cx: ctx, e: @expr) {
-    alt e.node {
+    match e.node {
       expr_vstore(_, _) |
       expr_vec(_, _) |
       expr_rec(_, _) | expr_struct(*) | expr_tup(_) |
@@ -168,7 +168,7 @@ fn mark_for_expr(cx: ctx, e: @expr) {
       }
       expr_cast(base, _) => {
         let result_t = ty::node_id_to_type(cx.ccx.tcx, e.id);
-        alt ty::get(result_t).struct {
+        match ty::get(result_t).struct {
             ty::ty_trait(*) => {
               // When we're casting to an trait, we need the
               // tydesc for the expr that's being cast.
@@ -178,7 +178,7 @@ fn mark_for_expr(cx: ctx, e: @expr) {
         }
       }
       expr_binary(op, lhs, _) => {
-        alt op {
+        match op {
           eq | lt | le | ne | ge | gt => {
             node_type_needs(cx, use_tydesc, lhs.id)
           }
@@ -195,7 +195,7 @@ fn mark_for_expr(cx: ctx, e: @expr) {
         }
       }
       expr_fn(*) | expr_fn_block(*) => {
-        alt ty::ty_fn_proto(ty::expr_ty(cx.ccx.tcx, e)) {
+        match ty::ty_fn_proto(ty::expr_ty(cx.ccx.tcx, e)) {
           proto_bare | proto_uniq => {}
           proto_box | proto_block => {
             for vec::each(*freevars::get_freevars(cx.ccx.tcx, e.id)) |fv| {
@@ -216,7 +216,7 @@ fn mark_for_expr(cx: ctx, e: @expr) {
         type_needs(cx, use_repr, ty::type_autoderef(cx.ccx.tcx, base_ty));
 
         do option::iter(cx.ccx.maps.method_map.find(e.id)) |mth| {
-            alt mth.origin {
+            match mth.origin {
               typeck::method_static(did) => {
                 do option::iter(cx.ccx.tcx.node_type_substs.find(e.id)) |ts| {
                     do vec::iter2(type_uses_for(cx.ccx, did, ts.len()), ts)
@@ -235,7 +235,7 @@ fn mark_for_expr(cx: ctx, e: @expr) {
       }
       expr_call(f, _, _) => {
         vec::iter(ty::ty_fn_args(ty::node_id_to_type(cx.ccx.tcx, f.id)), |a| {
-            alt a.mode {
+            match a.mode {
               expl(by_move) | expl(by_copy) | expl(by_val) => {
                 type_needs(cx, use_repr, a.ty);
               }
index c2bdf2801004115e39758e545cb5b782a6afc163..e66ae41e5c6441e70bb3dd3d57b07b80dd701f18 100644 (file)
@@ -19,7 +19,7 @@ fn make_free_glue(bcx: block, vptr: ValueRef, t: ty::t)
 }
 
 fn content_ty(t: ty::t) -> ty::t {
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
       ty::ty_uniq({ty: ct, _}) => ct,
       _ => core::unreachable()
     }
index cbd255341f5fe19a94013f5a02b9500e054ffc53..19a2ca1572366d84176a8491999f52465c3193aa 100644 (file)
@@ -240,7 +240,7 @@ fn implies(a: t, b: t) -> bool {
 }
 
 fn trit_str(t: trit) -> ~str {
-    alt t { dont_care { ~"?" } ttrue { ~"1" } tfalse { ~"0" } }
+    match t { dont_care { ~"?" } ttrue { ~"1" } tfalse { ~"0" } }
 }
 
 // FIXME (#2538): Would be nice to have unit tests for some of these
index f4b2e5e6442e9bd6c1c406b593091878ba074d59..379546015ccd5e0107452adfbcdc7f23041b8ef6 100644 (file)
@@ -14,7 +14,7 @@ fn collect_ids_block(b: blk, rs: @mut ~[node_id]) {
 }
 
 fn collect_ids_stmt(s: @stmt, rs: @mut ~[node_id]) {
-    alt s.node {
+    match s.node {
       stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) {
         debug!{"node_id %s", int::str(id)};
         debug!{"%s", stmt_to_str(*s)};
index eb39d4ec561c95adf2d4a8bdae933c752a5953cb..ce3b65db6ff3113215596df77057efd6c82f199e 100644 (file)
@@ -39,7 +39,7 @@ fn comma_str(args: ~[@constr_arg_use]) -> ~str {
     let mut comma = false;
     for args.each |a| {
         if comma { rslt += ~", "; } else { comma = true; }
-        alt a.node {
+        match a.node {
           carg_base { rslt += ~"*"; }
           carg_ident(i) { rslt += *i.ident; }
           carg_lit(l) { rslt += lit_to_str(l); }
@@ -59,7 +59,7 @@ fn tritv_to_str(fcx: fn_ctxt, v: tritv::t) -> ~str {
     let mut s = ~"";
     let mut comma = false;
     for constraints(fcx).each |p| {
-        alt v.get(p.bit_num) {
+        match v.get(p.bit_num) {
           dont_care { }
           tt {
             s +=
@@ -261,7 +261,7 @@ fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option<ts_ann> {
 
 /********* utils ********/
 fn node_id_to_ts_ann(ccx: crate_ctxt, id: node_id) -> ts_ann {
-    alt get_ts_ann(ccx, id) {
+    match get_ts_ann(ccx, id) {
       none {
         error!{"node_id_to_ts_ann: no ts_ann for node_id %d", id};
         fail;
@@ -277,7 +277,7 @@ fn node_id_to_poststate(ccx: crate_ctxt, id: node_id) -> poststate {
 
 fn stmt_to_ann(ccx: crate_ctxt, s: stmt) -> ts_ann {
     debug!{"stmt_to_ann"};
-    alt s.node {
+    match s.node {
       stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) {
         return node_id_to_ts_ann(ccx, id);
       }
@@ -445,21 +445,21 @@ fn new_crate_ctxt(cx: ty::ctxt) -> crate_ctxt {
  If it has a function type with a ! annotation,
 the answer is noreturn. */
 fn controlflow_expr(ccx: crate_ctxt, e: @expr) -> ret_style {
-    alt ty::get(ty::node_id_to_type(ccx.tcx, e.id)).struct {
+    match ty::get(ty::node_id_to_type(ccx.tcx, e.id)).struct {
       ty::ty_fn(f) { return f.ret_style; }
       _ { return return_val; }
     }
 }
 
 fn constraints_expr(cx: ty::ctxt, e: @expr) -> ~[@ty::constr] {
-    alt ty::get(ty::node_id_to_type(cx, e.id)).struct {
+    match ty::get(ty::node_id_to_type(cx, e.id)).struct {
       ty::ty_fn(f) { return f.constraints; }
       _ { return ~[]; }
     }
 }
 
 fn node_id_to_def_strict(cx: ty::ctxt, id: node_id) -> def {
-    alt cx.def_map.find(id) {
+    match cx.def_map.find(id) {
       none {
         error!{"node_id_to_def: node_id %d has no def", id};
         fail;
@@ -511,7 +511,7 @@ fn match_args(fcx: fn_ctxt, occs: @dvec<pred_args>,
 }
 
 fn def_id_for_constr(tcx: ty::ctxt, t: node_id) -> def_id {
-    alt tcx.def_map.find(t) {
+    match tcx.def_map.find(t) {
       none {
         tcx.sess.bug(~"node_id_for_constr: bad node_id " + int::str(t));
       }
@@ -521,9 +521,9 @@ fn def_id_for_constr(tcx: ty::ctxt, t: node_id) -> def_id {
 }
 
 fn expr_to_constr_arg(tcx: ty::ctxt, e: @expr) -> @constr_arg_use {
-    alt e.node {
+    match e.node {
       expr_path(p) {
-        alt tcx.def_map.find(e.id) {
+        match tcx.def_map.find(e.id) {
           some(def_local(nid, _)) | some(def_arg(nid, _)) |
           some(def_binding(nid, _)) | some(def_upvar(nid, _, _)) {
             return @respan(p.span,
@@ -559,9 +559,9 @@ fn exprs_to_constr_args(tcx: ty::ctxt,
 }
 
 fn expr_to_constr(tcx: ty::ctxt, e: @expr) -> sp_constr {
-    alt e.node {
+    match e.node {
       expr_call(operator, args, _) {
-        alt operator.node {
+        match operator.node {
           expr_path(p) {
             return respan(e.span,
                        {path: p,
@@ -601,7 +601,7 @@ fn substitute_constr_args(cx: ty::ctxt, actuals: ~[@expr], c: @ty::constr) ->
 fn substitute_arg(cx: ty::ctxt, actuals: ~[@expr], a: @constr_arg) ->
    @constr_arg_use {
     let num_actuals = vec::len(actuals);
-    alt a.node {
+    match a.node {
       carg_ident(i) {
         if i < num_actuals {
             return expr_to_constr_arg(cx, actuals[i]);
@@ -620,16 +620,16 @@ fn pred_args_matches(pattern: ~[constr_arg_general_<inst>],
     let mut i = 0u;
     for desc.node.args.each |c| {
         let n = pattern[i];
-        alt c.node {
+        match c.node {
           carg_ident(p) {
-            alt n {
+            match n {
               carg_ident(q) { if p.node != q.node { return false; } }
               _ { return false; }
             }
           }
           carg_base { if n != carg_base { return false; } }
           carg_lit(l) {
-            alt n {
+            match n {
               carg_lit(m) { if !const_eval::lit_eq(l, m) { return false; } }
               _ { return false; }
             }
@@ -669,7 +669,7 @@ fn find_instances(_fcx: fn_ctxt, subst: subst,
             if args_mention(d.node.args, find_in_subst_bool, subst) {
                 let old_bit_num = d.node.bit_num;
                 let newv = replace(subst, d);
-                alt find_instance_(newv, v) {
+                match find_instance_(newv, v) {
                   some(d1) {vec::push(res, {from: old_bit_num, to: d1})}
                   _ {}
                 }
@@ -696,7 +696,7 @@ fn insts_to_str(stuff: ~[constr_arg_general_<inst>]) -> ~str {
     for stuff.each |i| {
         rslt +=
             ~" " +
-                alt i {
+                match i {
                   carg_ident(p) { *p.ident }
                   carg_base { ~"*" }
                   carg_lit(_) { ~"~[lit]" }
@@ -709,9 +709,9 @@ fn insts_to_str(stuff: ~[constr_arg_general_<inst>]) -> ~str {
 fn replace(subst: subst, d: pred_args) -> ~[constr_arg_general_<inst>] {
     let mut rslt: ~[constr_arg_general_<inst>] = ~[];
     for d.node.args.each |c| {
-        alt c.node {
+        match c.node {
           carg_ident(p) {
-            alt find_in_subst(p.node, subst) {
+            match find_in_subst(p.node, subst) {
               some(newv) { vec::push(rslt, carg_ident(newv)); }
               _ { vec::push(rslt, c.node); }
             }
@@ -736,7 +736,7 @@ fn for_constraints_mentioning(fcx: fn_ctxt, id: node_id,
 
 fn local_node_id_to_def_id_strict(fcx: fn_ctxt, sp: span, i: node_id) ->
    def_id {
-    alt local_node_id_to_def(fcx, i) {
+    match local_node_id_to_def(fcx, i) {
       some(def_local(nid, _)) | some(def_arg(nid, _)) |
       some(def_upvar(nid, _, _)) {
         return local_def(nid);
@@ -760,7 +760,7 @@ fn local_node_id_to_def(fcx: fn_ctxt, i: node_id) -> option<def> {
 }
 
 fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option<def_id> {
-    alt local_node_id_to_def(fcx, i) {
+    match local_node_id_to_def(fcx, i) {
       some(def_local(nid, _)) | some(def_arg(nid, _)) |
       some(def_binding(nid, _)) | some(def_upvar(nid, _, _)) {
         some(local_def(nid))
@@ -771,7 +771,7 @@ fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option<def_id> {
 
 fn local_node_id_to_local_def_id(fcx: fn_ctxt, i: node_id) ->
    option<node_id> {
-    alt local_node_id_to_def_id(fcx, i) {
+    match local_node_id_to_def_id(fcx, i) {
       some(did) { some(did.node) }
       _ { none }
     }
@@ -798,7 +798,7 @@ fn copy_in_poststate_two(fcx: fn_ctxt, src_post: poststate,
                          target_post: poststate, dest: inst, src: inst,
                          ty: oper_type) {
     let mut subst;
-    alt ty {
+    match ty {
       oper_swap { subst = ~[{from: dest, to: src}, {from: src, to: dest}]; }
       oper_assign_op {
         return; // Don't do any propagation
@@ -863,7 +863,7 @@ fn args_mention<T>(args: ~[@constr_arg_use],
                    s: ~[T]) -> bool {
 
     for args.each |a| {
-        alt a.node {
+        match a.node {
           carg_ident(p1) { if q(s, p1.node) { return true; } } _ { }
         }
     }
@@ -875,7 +875,7 @@ fn use_var(fcx: fn_ctxt, v: node_id) {
 }
 
 fn op_to_oper_ty(io: init_op) -> oper_type {
-    alt io { init_move { oper_move } _ { oper_assign } }
+    match io { init_move { oper_move } _ { oper_assign } }
 }
 
 // default function visitor
@@ -894,7 +894,7 @@ fn args_to_constr_args(tcx: ty::ctxt, args: ~[arg],
         vec::push(
             actuals,
             @respan(a.span,
-                    alt a.node {
+                    match a.node {
                         carg_base { carg_base }
                         carg_ident(i) {
                             if i < num_args {
@@ -945,7 +945,7 @@ fn locals_to_bindings(tcx: ty::ctxt, locals: ~[@local]) -> ~[binding] {
 fn callee_modes(fcx: fn_ctxt, callee: node_id) -> ~[mode] {
     let ty = ty::type_autoderef(fcx.ccx.tcx,
                                 ty::node_id_to_type(fcx.ccx.tcx, callee));
-    alt ty::get(ty).struct {
+    match ty::get(ty).struct {
       ty::ty_fn({inputs: args, _}) {
         let mut modes = ~[];
         for args.each |arg| { vec::push(modes, arg.mode); }
@@ -961,7 +961,7 @@ fn callee_modes(fcx: fn_ctxt, callee: node_id) -> ~[mode] {
 
 fn callee_arg_init_ops(fcx: fn_ctxt, callee: node_id) -> ~[init_op] {
     do vec::map(callee_modes(fcx, callee)) |m| {
-        alt ty::resolved_mode(fcx.ccx.tcx, m) {
+        match ty::resolved_mode(fcx.ccx.tcx, m) {
           by_move { init_move }
           by_copy | by_ref | by_val | by_mutbl_ref { init_assign }
         }
index c6f46ba388858e9d4404f7c298473b373eeb072e..6379e8898f732d5d4437800f0d0f70b716f92ba5 100644 (file)
@@ -13,7 +13,7 @@
 type ctxt = {cs: @mut ~[sp_constr], tcx: ty::ctxt};
 
 fn collect_pred(e: @expr, cx: ctxt, v: visit::vt<ctxt>) {
-    alt e.node {
+    match e.node {
       expr_check(_, ch) { vec::push(*cx.cs, expr_to_constr(cx.tcx, ch)); }
       expr_if_check(ex, _, _) {
         vec::push(*cx.cs, expr_to_constr(cx.tcx, ex));
@@ -58,7 +58,7 @@ fn add_constraint(tcx: ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) ->
              constraint_to_str(tcx, c) + ~" |-> " + uint::str(next));
 
     let {path: p, def_id: d_id, args: args} = c.node;
-    alt tbl.find(d_id) {
+    match tbl.find(d_id) {
       some(ct) {
         (*ct.descs).push(respan(c.span, {args: args, bit_num: next}));
       }
index 9315e69d2891041279e4c191a3c8b0e3e92f0332..6036db54432368f89076aa35f68dfa237b206c6d 100644 (file)
@@ -36,7 +36,7 @@ fn find_pre_post_method(ccx: crate_ctxt, m: @method) {
 }
 
 fn find_pre_post_item(ccx: crate_ctxt, i: item) {
-    alt i.node {
+    match i.node {
       item_const(_, e) {
           // do nothing -- item_consts don't refer to local vars
       }
@@ -100,9 +100,9 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
                   maybe_alt: option<@expr>, id: node_id, chck: if_ty) {
     find_pre_post_expr(fcx, antec);
     find_pre_post_block(fcx, conseq);
-    alt maybe_alt {
+    match maybe_alt {
       none {
-        alt chck {
+        match chck {
           if_check {
             let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec);
             gen(fcx, antec.id, c.node);
@@ -135,7 +135,7 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
 
         /* Be sure to set the bit for the check condition here,
          so that it's *not* set in the alternative. */
-        alt chck {
+        match chck {
           if_check {
             let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec);
             gen(fcx, antec.id, c.node);
@@ -162,9 +162,9 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
 
 fn gen_if_local(fcx: fn_ctxt, lhs: @expr, rhs: @expr, larger_id: node_id,
                 new_var: node_id) {
-    alt node_id_to_def(fcx.ccx, new_var) {
+    match node_id_to_def(fcx.ccx, new_var) {
       some(d) {
-        alt d {
+        match d {
           def_local(nid, _) {
             find_pre_post_expr(fcx, rhs);
             let p = expr_pp(fcx.ccx, rhs);
@@ -181,12 +181,12 @@ fn gen_if_local(fcx: fn_ctxt, lhs: @expr, rhs: @expr, larger_id: node_id,
 fn handle_update(fcx: fn_ctxt, parent: @expr, lhs: @expr, rhs: @expr,
                  ty: oper_type) {
     find_pre_post_expr(fcx, rhs);
-    alt lhs.node {
+    match lhs.node {
       expr_path(p) {
         let post = expr_postcond(fcx.ccx, parent);
         let tmp = post.clone();
 
-        alt ty {
+        match ty {
           oper_move {
             if is_path(rhs) { forget_in_postcond(fcx, parent.id, rhs.id); }
           }
@@ -201,13 +201,13 @@ fn handle_update(fcx: fn_ctxt, parent: @expr, lhs: @expr, rhs: @expr,
         }
 
         gen_if_local(fcx, lhs, rhs, parent.id, lhs.id);
-        alt rhs.node {
+        match rhs.node {
           expr_path(p1) {
             let d = local_node_id_to_local_def_id(fcx, lhs.id);
             let d1 = local_node_id_to_local_def_id(fcx, rhs.id);
-            alt d {
+            match d {
               some(id) {
-                alt d1 {
+                match d1 {
                   some(id1) {
                     let instlhs =
                         {ident: path_to_ident(p), node: id};
@@ -232,7 +232,7 @@ fn handle_update(fcx: fn_ctxt, parent: @expr, lhs: @expr, rhs: @expr,
 fn forget_args_moved_in(fcx: fn_ctxt, parent: @expr, modes: ~[mode],
                         operands: ~[@expr]) {
     do vec::iteri(modes) |i,mode| {
-        alt ty::resolved_mode(fcx.ccx.tcx, mode) {
+        match ty::resolved_mode(fcx.ccx.tcx, mode) {
           by_move { forget_in_postcond(fcx, parent.id, operands[i].id); }
           by_ref | by_val | by_mutbl_ref | by_copy { }
         }
@@ -251,7 +251,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
     fn do_rand_(fcx: fn_ctxt, e: @expr) { find_pre_post_expr(fcx, e); }
 
 
-    alt e.node {
+    match e.node {
       expr_call(operator, operands, _) {
         /* copy */
 
@@ -270,7 +270,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
                              operands);
 
         /* if this is a failing call, its postcondition sets everything */
-        alt controlflow_expr(fcx.ccx, operator) {
+        match controlflow_expr(fcx.ccx, operator) {
           noreturn { set_postcond_false(fcx.ccx, e.id); }
           _ { }
         }
@@ -315,7 +315,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
       }
       expr_rec(fields, maybe_base) {
         let mut es = field_exprs(fields);
-        alt maybe_base { none {/* no-op */ } some(b) { vec::push(es, b); } }
+        match maybe_base { none {/* no-op */ } some(b) { vec::push(es, b); } }
         find_pre_post_exprs(fcx, es, e.id);
       }
       expr_tup(elts) { find_pre_post_exprs(fcx, elts, e.id); }
@@ -331,7 +331,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
       }
       expr_lit(_) { clear_pp(expr_pp(fcx.ccx, e)); }
       expr_ret(maybe_val) {
-        alt maybe_val {
+        match maybe_val {
           none {
             clear_precond(fcx.ccx, e.id);
             set_postcond_false(fcx.ccx, e.id);
@@ -391,7 +391,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
       expr_alt(ex, alts, _) {
         find_pre_post_expr(fcx, ex);
         fn do_an_alt(fcx: fn_ctxt, an_alt: arm) -> pre_and_post {
-            alt an_alt.guard {
+            match an_alt.guard {
               some(e) { find_pre_post_expr(fcx, e); }
               _ {}
             }
@@ -422,7 +422,7 @@ fn combine_pp(antec: pre_and_post, fcx: fn_ctxt, &&pp: pre_and_post,
       }
       expr_fail(maybe_val) {
         let mut prestate;
-        alt maybe_val {
+        match maybe_val {
           none { prestate = empty_prestate(num_local_vars); }
           some(fail_val) {
             find_pre_post_expr(fcx, fail_val);
@@ -453,13 +453,13 @@ fn combine_pp(antec: pre_and_post, fcx: fn_ctxt, &&pp: pre_and_post,
 
 fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) {
     debug!{"stmt = %s", stmt_to_str(s)};
-    alt s.node {
+    match s.node {
       stmt_decl(adecl, id) {
-        alt adecl.node {
+        match adecl.node {
           decl_local(alocals) {
             let prev_pp = empty_pre_post(num_constraints(fcx.enclosing));
             for alocals.each |alocal| {
-                alt alocal.node.init {
+                match alocal.node.init {
                   some(an_init) {
                     /* LHS always becomes initialized,
                      whether or not this is a move */
@@ -473,7 +473,7 @@ fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) {
                     copy_pre_post(fcx.ccx, id, an_init.expr);
 
                     let mut p = none;
-                    alt an_init.expr.node {
+                    match an_init.expr.node {
                       expr_path(_p) { p = some(_p); }
                       _ { }
                     }
@@ -481,7 +481,7 @@ fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) {
                     do pat_bindings(fcx.ccx.tcx.def_map, alocal.node.pat)
                         |p_id, _s, n| {
                         let ident = path_to_ident(n);
-                        alt p {
+                        match p {
                           some(p) {
                             copy_in_postcond(fcx, id,
                                              {ident: ident, node: p_id},
@@ -557,7 +557,7 @@ fn do_one_(fcx: fn_ctxt, s: @stmt) {
 
     let mut pps: ~[pre_and_post] = ~[];
     for b.node.stmts.each |s| { vec::push(pps, stmt_pp(fcx.ccx, *s)); }
-    alt b.node.expr {
+    match b.node.expr {
       none {/* no-op */ }
       some(e) { vec::push(pps, expr_pp(fcx.ccx, e)); }
     }
@@ -584,7 +584,7 @@ fn find_pre_post_fn(fcx: fn_ctxt, body: blk) {
     find_pre_post_block(fcx, body);
 
     // Treat the tail expression as a return statement
-    alt body.node.expr {
+    match body.node.expr {
       some(tailexpr) { set_postcond_false(fcx.ccx, tailexpr.id); }
       none {/* fallthrough */ }
     }
index b134f3b71af49873a5970c82f974cacdf6b0c772..9c4191fc20a2dc132a2a64e0fcd65c34f9707744 100644 (file)
@@ -15,9 +15,9 @@
 import std::map::hashmap;
 
 fn forbid_upvar(fcx: fn_ctxt, rhs_id: node_id, sp: span, t: oper_type) {
-    alt t {
+    match t {
       oper_move {
-        alt local_node_id_to_def(fcx, rhs_id) {
+        match local_node_id_to_def(fcx, rhs_id) {
           some(def_upvar(_, _, _)) {
             fcx.ccx.tcx.sess.span_err(sp,
                                       ~"tried to deinitialize a variable \
@@ -35,12 +35,12 @@ fn handle_move_or_copy(fcx: fn_ctxt, post: poststate, rhs_path: @path,
     forbid_upvar(fcx, rhs_id, rhs_path.span, op_to_oper_ty(init_op));
 
     let rhs_d_id = local_node_id_to_def_id(fcx, rhs_id);
-    alt rhs_d_id {
+    match rhs_d_id {
       some(rhsid) {
         // RHS is a local var
         let instrhs =
             {ident: path_to_ident(rhs_path), node: rhsid.node};
-        alt destlhs {
+        match destlhs {
           local_dest(instlhs) {
              copy_in_poststate(fcx, post, instlhs, instrhs,
                                op_to_oper_ty(init_op));
@@ -59,14 +59,14 @@ fn seq_states(fcx: fn_ctxt, pres: prestate, bindings: ~[binding]) ->
     let mut changed = false;
     let mut post = pres.clone();
     for bindings.each |b| {
-        alt b.rhs {
+        match b.rhs {
           some(an_init) {
             // an expression, with or without a destination
             changed |=
                 find_pre_post_state_expr(fcx, post, an_init.expr) || changed;
             post = expr_poststate(fcx.ccx, an_init.expr).clone();
             for b.lhs.each |d| {
-                alt an_init.expr.node {
+                match an_init.expr.node {
                   expr_path(p) {
                     handle_move_or_copy(fcx, post, p, an_init.expr.id, d,
                                         an_init.op);
@@ -94,7 +94,7 @@ fn find_pre_post_state_sub(fcx: fn_ctxt, pres: prestate, e: @expr,
     changed = set_prestate_ann(fcx.ccx, parent, pres) || changed;
 
     let post = expr_poststate(fcx.ccx, e).clone();
-    alt c {
+    match c {
       none { }
       some(c1) { set_in_poststate_(bit_num(fcx, c1), post); }
     }
@@ -115,7 +115,7 @@ fn find_pre_post_state_two(fcx: fn_ctxt, pres: prestate, lhs: @expr,
 
     let post = expr_poststate(fcx.ccx, rhs).clone();
 
-    alt lhs.node {
+    match lhs.node {
       expr_path(p) {
         // for termination, need to make sure intermediate changes don't set
         // changed flag
@@ -123,7 +123,7 @@ fn find_pre_post_state_two(fcx: fn_ctxt, pres: prestate, lhs: @expr,
         // for substitution purposes
         let tmp = post.clone();
 
-        alt ty {
+        match ty {
           oper_move {
             if is_path(rhs) { forget_in_poststate(fcx, post, rhs.id); }
             forget_in_poststate(fcx, post, lhs.id);
@@ -135,13 +135,13 @@ fn find_pre_post_state_two(fcx: fn_ctxt, pres: prestate, lhs: @expr,
           _ { forget_in_poststate(fcx, post, lhs.id); }
         }
 
-        alt rhs.node {
+        match rhs.node {
           expr_path(p1) {
             let d = local_node_id_to_local_def_id(fcx, lhs.id);
             let d1 = local_node_id_to_local_def_id(fcx, rhs.id);
-            alt d {
+            match d {
               some(id) {
-                alt d1 {
+                match d1 {
                   some(id1) {
                     let instlhs =
                         {ident: path_to_ident(p), node: id};
@@ -188,7 +188,7 @@ fn find_pre_post_state_exprs(fcx: fn_ctxt, pres: prestate, id: node_id,
     let rs = seq_states(fcx, pres, arg_bindings(ops, es));
     let mut changed = rs.changed | set_prestate_ann(fcx.ccx, id, pres);
     /* if this is a failing call, it sets everything as initialized */
-    alt cf {
+    match cf {
       noreturn {
         let post = false_postcond(num_constraints(fcx.enclosing));
         changed |= set_poststate_ann(fcx.ccx, id, post);
@@ -205,9 +205,9 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
         set_prestate_ann(fcx.ccx, id, pres) |
             find_pre_post_state_expr(fcx, pres, antec);
 
-    alt maybe_alt {
+    match maybe_alt {
       none {
-        alt chk {
+        match chk {
           if_check {
             let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec);
             let conseq_prestate = expr_poststate(fcx.ccx, antec).clone();
@@ -232,7 +232,7 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
                                      altern);
 
         let mut conseq_prestate = expr_poststate(fcx.ccx, antec);
-        alt chk {
+        match chk {
           if_check {
             let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec);
             conseq_prestate = conseq_prestate.clone();
@@ -282,7 +282,7 @@ fn find_pre_post_state_cap_clause(fcx: fn_ctxt, e_id: node_id,
 fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
     let num_constrs = num_constraints(fcx.enclosing);
 
-    alt e.node {
+    match e.node {
       expr_new(p, _, v) {
         return find_pre_post_state_two(fcx, pres, p, v, e.id, oper_pure);
       }
@@ -330,7 +330,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
                                                     init_assign),
                                       exs, return_val);
 
-        let base_pres = alt vec::last_opt(exs) { none { pres }
+        let base_pres = match vec::last_opt(exs) { none { pres }
                           some(f) { expr_poststate(fcx.ccx, f) }};
         option::iter(maybe_base, |base| {
             changed |= find_pre_post_state_expr(fcx, base_pres, base) |
@@ -366,7 +366,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
 
         set_poststate_ann(fcx.ccx, e.id, post);
 
-        alt maybe_ret_val {
+        match maybe_ret_val {
           none {/* do nothing */ }
           some(ret_val) {
             changed |= find_pre_post_state_expr(fcx, pres, ret_val);
@@ -452,7 +452,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
         if vec::len(alts) > 0u {
             a_post = false_postcond(num_constrs);
             for alts.each |an_alt| {
-                alt an_alt.guard {
+                match an_alt.guard {
                   some(e) {
                     changed |= find_pre_post_state_expr(fcx, e_post, e);
                   }
@@ -512,9 +512,9 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
     debug!{"*prestate = %s", stmt_ann.states.prestate.to_str()};
     debug!{"*poststate = %s", stmt_ann.states.prestate.to_str()};
 
-    alt s.node {
+    match s.node {
       stmt_decl(adecl, id) {
-        alt adecl.node {
+        match adecl.node {
           decl_local(alocals) {
             set_prestate(stmt_ann, pres);
             let c_and_p = seq_states(fcx, pres,
@@ -574,7 +574,7 @@ fn find_pre_post_state_block(fcx: fn_ctxt, pres0: prestate, b: blk) -> bool {
         pres = stmt_poststate(fcx.ccx, *s);
     }
     let mut post = pres;
-    alt b.node.expr {
+    match b.node.expr {
       none { }
       some(e) {
         changed |= find_pre_post_state_expr(fcx, pres, e);
index ee2cf2d7a14c4be09feb7589ffaeefef7151494d..b6110121171c18af7cff7948759cd9f9216b20f7 100644 (file)
@@ -57,7 +57,7 @@ fn difference(p: t) -> bool {
     }
     pure fn set(i: uint, t: trit) -> bool {
         let old = self.get(i);
-        alt t {
+        match t {
           dont_care {
             self.uncertain.set(i, true);
             self.val.set(i, false);
@@ -103,7 +103,7 @@ fn to_vec() -> ~[uint] {
       let mut rslt: ~[uint] = ~[];
       for uint::range(0, self.nbits) |i| {
         vec::push(rslt,
-                  alt self.get(i) {
+                  match self.get(i) {
                       dont_care { 2 }
                       ttrue     { 1 }
                       tfalse    { 0 }
@@ -116,7 +116,7 @@ fn to_str() -> str {
        let mut rs: str = "";
        for uint::range(0, self.nbits) |i| {
         rs +=
-            alt self.get(i) {
+            match self.get(i) {
               dont_care { "?" }
               ttrue { "1" }
               tfalse { "0" }
@@ -177,10 +177,10 @@ fn minus(a: trit, b: trit) -> trit {
          0 - 1 is an error
          0 - anything else - 0
      */
-    alt a {
+    match a {
       dont_care { dont_care }
       ttrue {
-        alt b {
+        match b {
           ttrue { dont_care }
           tfalse { ttrue }
           /* internally contradictory, but
@@ -191,7 +191,7 @@ fn minus(a: trit, b: trit) -> trit {
         }
       }
       tfalse {
-        alt b {
+        match b {
           ttrue { tfalse }
           /* see above comment */
           _ {
@@ -203,11 +203,11 @@ fn minus(a: trit, b: trit) -> trit {
     }
 
 fn trit_or(a: trit, b: trit) -> trit {
-    alt a {
+    match a {
       dont_care { b }
       ttrue { ttrue }
       tfalse {
-        alt b {
+        match b {
           ttrue { dont_care }
           /* FIXME (#2538): ??????
              Again, unit tests would help here
@@ -226,11 +226,11 @@ fn trit_or(a: trit, b: trit) -> trit {
 // to make it so that all constraints start out in a 0 state
 // (we consider a constraint false until proven true), too.
 fn trit_and(a: trit, b: trit) -> trit {
-    alt a {
+    match a {
       dont_care { b }
       // also seems wrong for case b = ttrue
       ttrue {
-        alt b {
+        match b {
           dont_care { ttrue }
           // ??? Seems wrong
           ttrue {
index 210c4c9af8656db6127c85f6cd556a57c08c846c..814e0cc2f1575c6edc832706c50c21afd1209f9c 100644 (file)
@@ -510,7 +510,7 @@ impl of purity_to_str for purity {
 fn param_bounds_to_kind(bounds: param_bounds) -> kind {
     let mut kind = kind_noncopyable();
     for vec::each(*bounds) |bound| {
-        alt bound {
+        match bound {
           bound_copy => {
             kind = raise_kind(kind, kind_implicitly_copyable());
           }
@@ -608,14 +608,14 @@ fn mk_t(cx: ctxt, st: sty) -> t { mk_t_with_id(cx, st, none) }
 // and returns the box as cast to an unsafe ptr (see comments for t above).
 fn mk_t_with_id(cx: ctxt, st: sty, o_def_id: option<ast::def_id>) -> t {
     let key = {struct: st, o_def_id: o_def_id};
-    alt cx.interner.find(key) {
+    match cx.interner.find(key) {
       some(t) => unsafe { return unsafe::reinterpret_cast(t); }
       _ => ()
     }
     let mut flags = 0u;
     fn rflags(r: region) -> uint {
         (has_regions as uint) | {
-            alt r {
+            match r {
               ty::re_var(_) => needs_infer as uint,
               _ => 0u
             }
@@ -627,7 +627,7 @@ fn sflags(substs: substs) -> uint {
         substs.self_r.iter(|r| f |= rflags(r));
         return f;
     }
-    alt st {
+    match st {
       ty_estr(vstore_slice(r)) => {
         flags |= rflags(r);
       }
@@ -786,7 +786,7 @@ fn mk_with_id(cx: ctxt, base: t, def_id: ast::def_id) -> t {
 
 // Converts s to its machine type equivalent
 pure fn mach_sty(cfg: @session::config, t: t) -> sty {
-    alt get(t).struct {
+    match get(t).struct {
       ty_int(ast::ty_i) => ty_int(cfg.int_type),
       ty_uint(ast::ty_u) => ty_uint(cfg.uint_type),
       ty_float(ast::ty_f) => ty_float(cfg.float_type),
@@ -802,7 +802,7 @@ fn default_arg_mode_for_ty(ty: ty::t) -> ast::rmode {
 // Returns the narrowest lifetime enclosing the evaluation of the expression
 // with id `id`.
 fn encl_region(cx: ctxt, id: ast::node_id) -> ty::region {
-    alt cx.region_map.find(id) {
+    match cx.region_map.find(id) {
       some(encl_scope) => ty::re_scope(encl_scope),
       none => ty::re_static
     }
@@ -814,7 +814,7 @@ fn walk_ty(ty: t, f: fn(t)) {
 
 fn maybe_walk_ty(ty: t, f: fn(t) -> bool) {
     if !f(ty) { return; }
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
       ty_estr(_) | ty_type | ty_opaque_box | ty_self |
       ty_opaque_closure_ptr(_) | ty_var(_) | ty_var_integral(_) |
@@ -851,7 +851,7 @@ fn fold_substs(substs: substs, fldop: fn(t) -> t) -> substs {
          tps: substs.tps.map(|t| fldop(t))}
     }
 
-    alt sty {
+    match sty {
       ty_box(tm) => {
         ty_box({ty: fldop(tm.ty), mutbl: tm.mutbl})
       }
@@ -947,7 +947,7 @@ fn fold_substs(
     }
 
     let tb = ty::get(ty);
-    alt tb.struct {
+    match tb.struct {
       ty::ty_rptr(r, mt) => {
         let m_r = fldr(r);
         let m_t = fldt(mt.ty);
@@ -1004,7 +1004,7 @@ fn do_fold(cx: ctxt, t0: t, under_r: bool,
                fldop: fn(region, bool) -> region) -> t {
         let tb = get(t0);
         if !tbox_has_flag(tb, has_regions) { return t0; }
-        alt tb.struct {
+        match tb.struct {
           ty_rptr(r, {ty: t1, mutbl: m}) => {
             let m_r = fldop(r, under_r);
             let m_t1 = do_fold(cx, t1, true, fldop);
@@ -1039,7 +1039,7 @@ fn subst_tps(cx: ctxt, tps: ~[t], typ: t) -> t {
     if tps.len() == 0u { return typ; }
     let tb = ty::get(typ);
     if !tbox_has_flag(tb, has_params) { return typ; }
-    alt tb.struct {
+    match tb.struct {
       ty_param(p) => tps[p.idx],
       sty => fold_sty_to_ty(cx, sty, |t| subst_tps(cx, tps, t))
     }
@@ -1076,13 +1076,13 @@ fn do_subst(cx: ctxt,
                 typ: t) -> t {
         let tb = get(typ);
         if !tbox_has_flag(tb, needs_subst) { return typ; }
-        alt tb.struct {
+        match tb.struct {
           ty_param(p) => substs.tps[p.idx],
           ty_self => substs.self_ty.get(),
           _ => {
             fold_regions_and_ty(
                 cx, typ,
-                |r| alt r {
+                |r| match r {
                     re_bound(br_self) => substs.self_r.get(),
                     _ => r
                 },
@@ -1100,14 +1100,14 @@ fn type_is_nil(ty: t) -> bool { get(ty).struct == ty_nil }
 fn type_is_bot(ty: t) -> bool { get(ty).struct == ty_bot }
 
 fn type_is_var(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_var(_) => true,
       _ => false
     }
 }
 
 fn type_is_var_integral(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_var_integral(_) => true,
       _ => false
     }
@@ -1116,7 +1116,7 @@ fn type_is_var_integral(ty: t) -> bool {
 fn type_is_bool(ty: t) -> bool { get(ty).struct == ty_bool }
 
 fn type_is_structural(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_rec(_) | ty_class(*) | ty_tup(_) | ty_enum(*) | ty_fn(_) |
       ty_trait(*) |
       ty_evec(_, vstore_fixed(_)) | ty_estr(vstore_fixed(_)) |
@@ -1131,21 +1131,21 @@ fn type_is_copyable(cx: ctxt, ty: t) -> bool {
 }
 
 fn type_is_sequence(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_estr(_) | ty_evec(_, _) => true,
       _ => false
     }
 }
 
 fn type_is_str(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_estr(_) => true,
       _ => false
     }
 }
 
 fn sequence_element_type(cx: ctxt, ty: t) -> t {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_estr(_) => return mk_mach_uint(cx, ast::ty_u8),
       ty_evec(mt, _) | ty_unboxed_vec(mt) => return mt.ty,
       _ => cx.sess.bug(
@@ -1154,7 +1154,7 @@ fn sequence_element_type(cx: ctxt, ty: t) -> t {
 }
 
 fn get_element_type(ty: t, i: uint) -> t {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_rec(flds) => return flds[i].mt.ty,
       ty_tup(ts) => return ts[i],
       _ => fail ~"get_element_type called on invalid type"
@@ -1162,14 +1162,14 @@ fn get_element_type(ty: t, i: uint) -> t {
 }
 
 pure fn type_is_box(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_box(_) => return true,
       _ => return false
     }
 }
 
 pure fn type_is_boxed(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_box(_) | ty_opaque_box |
       ty_evec(_, vstore_box) | ty_estr(vstore_box) => true,
       _ => false
@@ -1177,35 +1177,35 @@ fn get_element_type(ty: t, i: uint) -> t {
 }
 
 pure fn type_is_region_ptr(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_rptr(_, _) => true,
       _ => false
     }
 }
 
 pure fn type_is_slice(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_evec(_, vstore_slice(_)) | ty_estr(vstore_slice(_)) => true,
       _ => return false
     }
 }
 
 pure fn type_is_unique_box(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_uniq(_) => return true,
       _ => return false
     }
 }
 
 pure fn type_is_unsafe_ptr(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_ptr(_) => return true,
       _ => return false
     }
 }
 
 pure fn type_is_vec(ty: t) -> bool {
-    return alt get(ty).struct {
+    return match get(ty).struct {
           ty_evec(_, _) | ty_unboxed_vec(_) => true,
           ty_estr(_) => true,
           _ => false
@@ -1213,7 +1213,7 @@ fn get_element_type(ty: t, i: uint) -> t {
 }
 
 pure fn type_is_unique(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_uniq(_) => return true,
       ty_evec(_, vstore_uniq) => true,
       ty_estr(vstore_uniq) => true,
@@ -1227,7 +1227,7 @@ fn get_element_type(ty: t, i: uint) -> t {
  contents are abstract to rustc.)
 */
 pure fn type_is_scalar(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_nil | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
       ty_var_integral(_) | ty_type | ty_ptr(_) => true,
       _ => false
@@ -1240,13 +1240,13 @@ fn type_is_immediate(ty: t) -> bool {
 }
 
 fn type_needs_drop(cx: ctxt, ty: t) -> bool {
-    alt cx.needs_drop_cache.find(ty) {
+    match cx.needs_drop_cache.find(ty) {
       some(result) => return result,
       none => {/* fall through */ }
     }
 
     let mut accum = false;
-    let result = alt get(ty).struct {
+    let result = match get(ty).struct {
       // scalar types
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
       ty_type | ty_ptr(_) | ty_rptr(_, _) |
@@ -1286,7 +1286,7 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool {
         accum
       }
       ty_fn(fty) => {
-        alt fty.proto {
+        match fty.proto {
           proto_bare | proto_block => false,
           _ => true
         }
@@ -1303,7 +1303,7 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool {
 // that only contain scalars and shared boxes can avoid unwind
 // cleanups.
 fn type_needs_unwind_cleanup(cx: ctxt, ty: t) -> bool {
-    alt cx.needs_unwind_cleanup_cache.find(ty) {
+    match cx.needs_unwind_cleanup_cache.find(ty) {
       some(result) => return result,
       none => ()
     }
@@ -1320,7 +1320,7 @@ fn type_needs_unwind_cleanup_(cx: ctxt, ty: t,
                               encountered_box: bool) -> bool {
 
     // Prevent infinite recursion
-    alt tycache.find(ty) {
+    match tycache.find(ty) {
       some(_) => return false,
       none => { tycache.insert(ty, ()); }
     }
@@ -1329,7 +1329,7 @@ fn type_needs_unwind_cleanup_(cx: ctxt, ty: t,
     let mut needs_unwind_cleanup = false;
     do maybe_walk_ty(ty) |ty| {
         let old_encountered_box = encountered_box;
-        let result = alt get(ty).struct {
+        let result = match get(ty).struct {
           ty_box(_) | ty_opaque_box => {
             encountered_box = true;
             true
@@ -1528,7 +1528,7 @@ impl operators of ops::sub<kind,kind> for kind {
 }
 
 fn proto_kind(p: proto) -> kind {
-    alt p {
+    match p {
       ast::proto_block => kind_noncopyable(),
       ast::proto_box => kind_safe_for_default_mode() | kind_owned(),
       ast::proto_uniq => kind_send_copy() | kind_owned(),
@@ -1571,7 +1571,7 @@ fn test_kinds() {
 // This is used to prevent objects containing mutable state from being
 // implicitly copied and to compute whether things have const kind.
 fn mutability_kind(m: mutability) -> kind {
-    alt (m) {
+    match (m) {
       m_mutbl => remove_const(remove_implicit(kind_top())),
       m_const => remove_implicit(kind_top()),
       m_imm => kind_top()
@@ -1583,7 +1583,7 @@ fn mutable_type_kind(cx: ctxt, ty: mt) -> kind {
 }
 
 fn type_kind(cx: ctxt, ty: t) -> kind {
-    alt cx.kind_cache.find(ty) {
+    match cx.kind_cache.find(ty) {
       some(result) => return result,
       none => {/* fall through */ }
     }
@@ -1591,7 +1591,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
     // Insert a default in case we loop back on self recursively.
     cx.kind_cache.insert(ty, kind_top());
 
-    let mut result = alt get(ty).struct {
+    let mut result = match get(ty).struct {
       // Scalar and unique types are sendable, constant, and owned
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
       ty_ptr(_) => {
@@ -1743,7 +1743,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
 /// gives a rough estimate of how much space it takes to represent
 /// an instance of `ty`.  Used for the mode transition.
 fn type_size(cx: ctxt, ty: t) -> uint {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
       ty_ptr(_) | ty_box(_) | ty_uniq(_) | ty_estr(vstore_uniq) |
       ty_trait(*) | ty_rptr(*) | ty_evec(_, vstore_uniq) |
@@ -1828,7 +1828,7 @@ fn subtypes_require(cx: ctxt, seen: @mut ~[def_id],
                ty_to_str(cx, r_ty),
                ty_to_str(cx, ty)};
 
-        let r = alt get(ty).struct {
+        let r = match get(ty).struct {
           ty_nil |
           ty_bot |
           ty_bool |
@@ -1919,7 +1919,7 @@ fn type_structurally_contains(cx: ctxt, ty: t, test: fn(sty) -> bool) ->
     let sty = get(ty).struct;
     debug!{"type_structurally_contains: %s", ty_to_str(cx, ty)};
     if test(sty) { return true; }
-    alt sty {
+    match sty {
       ty_enum(did, substs) => {
         for vec::each(*enum_variants(cx, did)) |variant| {
             for variant.args.each |aty| {
@@ -1960,7 +1960,7 @@ fn type_structurally_contains(cx: ctxt, ty: t, test: fn(sty) -> bool) ->
 
 fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool {
     return type_structurally_contains(cx, ty, |sty| {
-        alt sty {
+        match sty {
           ty_uniq(_) |
           ty_evec(_, vstore_uniq) |
           ty_estr(vstore_uniq) => true,
@@ -1970,14 +1970,14 @@ fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool {
 }
 
 fn type_is_integral(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_var_integral(_) | ty_int(_) | ty_uint(_) | ty_bool => true,
       _ => false
     }
 }
 
 fn type_is_fp(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_float(_) => true,
       _ => false
     }
@@ -1988,7 +1988,7 @@ fn type_is_numeric(ty: t) -> bool {
 }
 
 fn type_is_signed(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_int(_) => true,
       _ => false
     }
@@ -1998,7 +1998,7 @@ fn type_is_signed(ty: t) -> bool {
 // that the cycle collector might care about.
 fn type_is_pod(cx: ctxt, ty: t) -> bool {
     let mut result = true;
-    alt get(ty).struct {
+    match get(ty).struct {
       // Scalar types
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
       ty_type | ty_ptr(_) => result = true,
@@ -2053,7 +2053,7 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool {
 }
 
 fn type_is_enum(ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_enum(_, _) => return true,
       _ => return false
     }
@@ -2062,7 +2062,7 @@ fn type_is_enum(ty: t) -> bool {
 // Whether a type is enum like, that is a enum type with only nullary
 // constructors
 fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_enum(did, substs) => {
         let variants = enum_variants(cx, did);
         let some_n_ary = vec::any(*variants, |v| vec::len(v.args) > 0u);
@@ -2073,7 +2073,7 @@ fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool {
 }
 
 fn type_param(ty: t) -> option<uint> {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_param(p) => return some(p.idx),
       _ => {/* fall through */ }
     }
@@ -2088,7 +2088,7 @@ fn deref(cx: ctxt, t: t, expl: bool) -> option<mt> {
     deref_sty(cx, get(t).struct, expl)
 }
 fn deref_sty(cx: ctxt, sty: sty, expl: bool) -> option<mt> {
-    alt sty {
+    match sty {
       ty_rptr(_, mt) | ty_box(mt) | ty_uniq(mt) => {
         some(mt)
       }
@@ -2114,7 +2114,7 @@ fn deref_sty(cx: ctxt, sty: sty, expl: bool) -> option<mt> {
 fn type_autoderef(cx: ctxt, t: t) -> t {
     let mut t = t;
     loop {
-        alt deref(cx, t, false) {
+        match deref(cx, t, false) {
           none => return t,
           some(mt) => t = mt.ty
         }
@@ -2127,7 +2127,7 @@ fn index(cx: ctxt, t: t) -> option<mt> {
 }
 
 fn index_sty(cx: ctxt, sty: sty) -> option<mt> {
-    alt sty {
+    match sty {
       ty_evec(mt, _) => some(mt),
       ty_estr(_) => some({ty: mk_u8(cx), mutbl: ast::m_imm}),
       _ => none
@@ -2135,7 +2135,7 @@ fn index_sty(cx: ctxt, sty: sty) -> option<mt> {
 }
 
 pure fn hash_bound_region(br: &bound_region) -> uint {
-    alt *br { // no idea if this is any good
+    match *br { // no idea if this is any good
       ty::br_self => 0u,
       ty::br_anon => 1u,
       ty::br_named(str) => str::hash(str),
@@ -2163,7 +2163,7 @@ fn br_hashmap<V:copy>() -> hashmap<bound_region, V> {
         h
     }
     pure fn hash_region(r: &region) -> uint {
-        alt *r { // no idea if this is any good
+        match *r { // no idea if this is any good
           re_bound(br) => (hash_bound_region(&br)) << 2u | 0u,
           re_free(id, br) => ((id as uint) << 4u) |
                                (hash_bound_region(&br)) << 2u | 1u,
@@ -2176,10 +2176,10 @@ fn br_hashmap<V:copy>() -> hashmap<bound_region, V> {
         let h = hash_subtys(h, substs.tps);
         h + substs.self_r.map_default(0u, |r| hash_region(&r))
     }
-    alt st {
+    match st {
       ty_nil => 0u,
       ty_bool => 1u,
-      ty_int(t) => alt t {
+      ty_int(t) => match t {
         ast::ty_i => 2u,
         ast::ty_char => 3u,
         ast::ty_i8 => 4u,
@@ -2187,14 +2187,14 @@ fn br_hashmap<V:copy>() -> hashmap<bound_region, V> {
         ast::ty_i32 => 6u,
         ast::ty_i64 => 7u
       }
-      ty_uint(t) => alt t {
+      ty_uint(t) => match t {
         ast::ty_u => 8u,
         ast::ty_u8 => 9u,
         ast::ty_u16 => 10u,
         ast::ty_u32 => 11u,
         ast::ty_u64 => 12u
       }
-      ty_float(t) => alt t {
+      ty_float(t) => match t {
         ast::ty_f => 13u,
         ast::ty_f32 => 14u,
         ast::ty_f64 => 15u
@@ -2246,7 +2246,7 @@ fn br_hashmap<V:copy>() -> hashmap<bound_region, V> {
 }
 
 fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
-    alt smallintmap::find(*cx.node_types, id as uint) {
+    match smallintmap::find(*cx.node_types, id as uint) {
        some(t) => t,
        none => cx.sess.bug(fmt!{"node_id_to_type: unbound node ID %s",
                                 ast_map::node_id_to_str(cx.items, id)})
@@ -2254,7 +2254,7 @@ fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
 }
 
 fn node_id_to_type_params(cx: ctxt, id: ast::node_id) -> ~[t] {
-    alt cx.node_type_substs.find(id) {
+    match cx.node_type_substs.find(id) {
       none => return ~[],
       some(ts) => return ts
     }
@@ -2266,35 +2266,35 @@ fn node_id_has_type_params(cx: ctxt, id: ast::node_id) -> bool {
 
 // Type accessors for substructures of types
 fn ty_fn_args(fty: t) -> ~[arg] {
-    alt get(fty).struct {
+    match get(fty).struct {
       ty_fn(f) => f.inputs,
       _ => fail ~"ty_fn_args() called on non-fn type"
     }
 }
 
 fn ty_fn_proto(fty: t) -> ast::proto {
-    alt get(fty).struct {
+    match get(fty).struct {
       ty_fn(f) => f.proto,
       _ => fail ~"ty_fn_proto() called on non-fn type"
     }
 }
 
 pure fn ty_fn_ret(fty: t) -> t {
-    alt get(fty).struct {
+    match get(fty).struct {
       ty_fn(f) => f.output,
       _ => fail ~"ty_fn_ret() called on non-fn type"
     }
 }
 
 fn ty_fn_ret_style(fty: t) -> ast::ret_style {
-    alt get(fty).struct {
+    match get(fty).struct {
       ty_fn(f) => f.ret_style,
       _ => fail ~"ty_fn_ret_style() called on non-fn type"
     }
 }
 
 fn is_fn_ty(fty: t) -> bool {
-    alt get(fty).struct {
+    match get(fty).struct {
       ty_fn(_) => return true,
       _ => return false
     }
@@ -2312,14 +2312,14 @@ fn is_pred_ty(fty: t) -> bool {
 }
 
 fn ty_var_id(typ: t) -> tv_vid {
-    alt get(typ).struct {
+    match get(typ).struct {
       ty_var(vid) => return vid,
       _ => { error!{"ty_var_id called on non-var ty"}; fail; }
     }
 }
 
 fn ty_var_integral_id(typ: t) -> tvi_vid {
-    alt get(typ).struct {
+    match get(typ).struct {
       ty_var_integral(vid) => return vid,
       _ => { error!{"ty_var_integral_id called on ty other than \
                   ty_var_integral"};
@@ -2361,7 +2361,7 @@ fn expr_has_ty_params(cx: ctxt, expr: @ast::expr) -> bool {
 }
 
 fn expr_is_lval(method_map: typeck::method_map, e: @ast::expr) -> bool {
-    alt e.node {
+    match e.node {
       ast::expr_path(_) | ast::expr_unary(ast::deref, _) => true,
       ast::expr_field(_, _, _) | ast::expr_index(_, _) => {
         !method_map.contains_key(e.id)
@@ -2371,7 +2371,7 @@ fn expr_is_lval(method_map: typeck::method_map, e: @ast::expr) -> bool {
 }
 
 fn stmt_node_id(s: @ast::stmt) -> ast::node_id {
-    alt s.node {
+    match s.node {
       ast::stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) => {
         return id;
       }
@@ -2385,13 +2385,13 @@ fn field_idx(id: ast::ident, fields: ~[field]) -> option<uint> {
 }
 
 fn get_field(rec_ty: t, id: ast::ident) -> field {
-    alt check vec::find(get_fields(rec_ty), |f| str::eq(f.ident, id)) {
+    match check vec::find(get_fields(rec_ty), |f| str::eq(f.ident, id)) {
       some(f) => f
     }
 }
 
 fn get_fields(rec_ty:t) -> ~[field] {
-    alt check get(rec_ty).struct {
+    match check get(rec_ty).struct {
       ty_rec(fields) => fields
     }
 }
@@ -2408,7 +2408,7 @@ fn method_idx(id: ast::ident, meths: ~[method]) -> option<uint> {
 fn param_tys_in_type(ty: t) -> ~[param_ty] {
     let mut rslt = ~[];
     do walk_ty(ty) |ty| {
-        alt get(ty).struct {
+        match get(ty).struct {
           ty_param(p) => {
             vec::push(rslt, p);
           }
@@ -2425,7 +2425,7 @@ fn occurs_check(tcx: ctxt, sp: span, vid: tv_vid, rt: t) {
     fn vars_in_type(ty: t) -> ~[tv_vid] {
         let mut rslt = ~[];
         do walk_ty(ty) |ty| {
-            alt get(ty).struct {
+            match get(ty).struct {
               ty_var(v) => vec::push(rslt, v),
               _ => ()
             }
@@ -2454,8 +2454,8 @@ fn vars_in_type(ty: t) -> ~[tv_vid] {
 // the current head value for `m0`.
 fn canon<T:copy>(tbl: hashmap<ast::node_id, ast::inferable<T>>,
                  m0: ast::inferable<T>) -> ast::inferable<T> {
-    alt m0 {
-      ast::infer(id) => alt tbl.find(id) {
+    match m0 {
+      ast::infer(id) => match tbl.find(id) {
         none => m0,
         some(m1) => {
             let cm1 = canon(tbl, m1);
@@ -2477,7 +2477,7 @@ fn canon_mode(cx: ctxt, m0: ast::mode) -> ast::mode {
 // Returns the head value for mode, failing if `m` was a infer(_) that
 // was never inferred.  This should be safe for use after typeck.
 fn resolved_mode(cx: ctxt, m: ast::mode) -> ast::rmode {
-    alt canon_mode(cx, m) {
+    match canon_mode(cx, m) {
       ast::infer(_) => {
         cx.sess.bug(fmt!{"mode %? was never resolved", m});
       }
@@ -2490,7 +2490,7 @@ fn arg_mode(cx: ctxt, a: arg) -> ast::rmode { resolved_mode(cx, a.mode) }
 // Unifies `m1` and `m2`.  Returns unified value or failure code.
 fn unify_mode(cx: ctxt, m1: ast::mode, m2: ast::mode)
     -> result<ast::mode, type_err> {
-    alt (canon_mode(cx, m1), canon_mode(cx, m2)) {
+    match (canon_mode(cx, m1), canon_mode(cx, m2)) {
       (m1, m2) if (m1 == m2) => {
         result::ok(m1)
       }
@@ -2511,7 +2511,7 @@ fn unify_mode(cx: ctxt, m1: ast::mode, m2: ast::mode)
 // If `m` was never unified, unifies it with `m_def`.  Returns the final value
 // for `m`.
 fn set_default_mode(cx: ctxt, m: ast::mode, m_def: ast::rmode) {
-    alt canon_mode(cx, m) {
+    match canon_mode(cx, m) {
       ast::infer(id) => {
         cx.inferred_modes.insert(id, ast::expl(m_def));
       }
@@ -2520,7 +2520,7 @@ fn set_default_mode(cx: ctxt, m: ast::mode, m_def: ast::rmode) {
 }
 
 fn ty_sort_str(cx: ctxt, t: t) -> ~str {
-    alt get(t).struct {
+    match get(t).struct {
       ty_nil | ty_bot | ty_bool | ty_int(_) |
       ty_uint(_) | ty_float(_) | ty_estr(_) |
       ty_type | ty_opaque_box | ty_opaque_closure_ptr(_) => {
@@ -2548,14 +2548,14 @@ fn ty_sort_str(cx: ctxt, t: t) -> ~str {
 
 fn type_err_to_str(cx: ctxt, err: type_err) -> ~str {
     fn terr_vstore_kind_to_str(k: terr_vstore_kind) -> ~str {
-        alt k { terr_vec => ~"[]", terr_str => ~"str" }
+        match k { terr_vec => ~"[]", terr_str => ~"str" }
     }
 
-    alt err {
+    match err {
       terr_mismatch => return ~"types differ",
       terr_ret_style_mismatch(expect, actual) => {
         fn to_str(s: ast::ret_style) -> ~str {
-            alt s {
+            match s {
               ast::noreturn => ~"non-returning",
               ast::return_val => ~"return-by-value"
             }
@@ -2631,7 +2631,7 @@ fn to_str(s: ast::ret_style) -> ~str {
 }
 
 fn def_has_ty_params(def: ast::def) -> bool {
-    alt def {
+    match def {
       ast::def_fn(_, _) | ast::def_variant(_, _) | ast::def_class(_, _)
         => true,
       _ => false
@@ -2643,7 +2643,7 @@ fn store_trait_methods(cx: ctxt, id: ast::node_id, ms: @~[method]) {
 }
 
 fn trait_methods(cx: ctxt, id: ast::def_id) -> @~[method] {
-    alt cx.trait_method_cache.find(id) {
+    match cx.trait_method_cache.find(id) {
       some(ms) => return ms,
       _ => ()
     }
@@ -2657,7 +2657,7 @@ fn trait_methods(cx: ctxt, id: ast::def_id) -> @~[method] {
 fn impl_traits(cx: ctxt, id: ast::def_id) -> ~[t] {
     if id.crate == ast::local_crate {
         debug!{"(impl_traits) searching for trait impl %?", id};
-        alt cx.items.find(id.node) {
+        match cx.items.find(id.node) {
            some(ast_map::node_item(@{
                         node: ast::item_impl(_, trait_refs, _, _),
                         _},
@@ -2669,7 +2669,7 @@ fn impl_traits(cx: ctxt, id: ast::def_id) -> ~[t] {
            }
            some(ast_map::node_item(@{node: ast::item_class(*),
                            _},_)) => {
-             alt cx.def_map.find(id.node) {
+             match cx.def_map.find(id.node) {
                some(def_ty(trait_id)) => {
                    // XXX: Doesn't work cross-crate.
                    debug!{"(impl_traits) found trait id %?", trait_id};
@@ -2692,7 +2692,7 @@ fn impl_traits(cx: ctxt, id: ast::def_id) -> ~[t] {
 }
 
 fn ty_to_def_id(ty: t) -> option<ast::def_id> {
-    alt get(ty).struct {
+    match get(ty).struct {
       ty_trait(id, _) | ty_class(id, _) | ty_enum(id, _) => some(id),
       _ => none
     }
@@ -2723,7 +2723,7 @@ fn item_path_str(cx: ctxt, id: ast::def_id) -> ~str {
    Otherwise return none. */
 fn ty_dtor(cx: ctxt, class_id: def_id) -> option<def_id> {
     if is_local(class_id) {
-       alt cx.items.find(class_id.node) {
+       match cx.items.find(class_id.node) {
          some(ast_map::node_item(@{node: ast::item_class(_, _, _, _,
                                      some(dtor)), _}, _))
              => some(local_def(dtor.node.id)),
@@ -2744,9 +2744,9 @@ fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
         csearch::get_item_path(cx, id)
     } else {
         let node = cx.items.get(id.node);
-        alt node {
+        match node {
           ast_map::node_item(item, path) => {
-            let item_elt = alt item.node {
+            let item_elt = match item.node {
               item_mod(_) | item_foreign_mod(_) => {
                 ast_map::path_mod(item.ident)
               }
@@ -2796,14 +2796,14 @@ fn enum_is_univariant(cx: ctxt, id: ast::def_id) -> bool {
 }
 
 fn type_is_empty(cx: ctxt, t: t) -> bool {
-    alt ty::get(t).struct {
+    match ty::get(t).struct {
        ty_enum(did, _) => (*enum_variants(cx, did)).is_empty(),
        _ => false
      }
 }
 
 fn enum_variants(cx: ctxt, id: ast::def_id) -> @~[variant_info] {
-    alt cx.enum_var_cache.find(id) {
+    match cx.enum_var_cache.find(id) {
       some(variants) => return variants,
       _ => { /* fallthrough */ }
     }
@@ -2816,7 +2816,7 @@ fn enum_variants(cx: ctxt, id: ast::def_id) -> @~[variant_info] {
           call eval_const_expr, it should never get called twice for the same
           expr, since check_enum_variants also updates the enum_var_cache
          */
-        alt cx.items.get(id.node) {
+        match cx.items.get(id.node) {
           ast_map::node_item(@{node: ast::item_enum(variants, _), _}, _) => {
             let mut disr_val = -1;
             @vec::map(variants, |variant| {
@@ -2826,10 +2826,10 @@ fn enum_variants(cx: ctxt, id: ast::def_id) -> @~[variant_info] {
                         ty_fn_args(ctor_ty).map(|a| a.ty)
                     } else { ~[] }
                 };
-                alt variant.node.disr_expr {
+                match variant.node.disr_expr {
                   some (ex) => {
                     // FIXME: issue #1417
-                    disr_val = alt const_eval::eval_const_expr(cx, ex) {
+                    disr_val = match const_eval::eval_const_expr(cx, ex) {
                       const_eval::const_int(val) =>val as int,
                       _ => cx.sess.bug(~"tag_variants: bad disr expr")
                     }
@@ -2869,7 +2869,7 @@ fn enum_variant_with_id(cx: ctxt, enum_id: ast::def_id,
 // If the given item is in an external crate, looks up its type and adds it to
 // the type cache. Returns the type parameters and type.
 fn lookup_item_type(cx: ctxt, did: ast::def_id) -> ty_param_bounds_and_ty {
-    alt cx.tcache.find(did) {
+    match cx.tcache.find(did) {
       some(tpt) => return tpt,
       none => {
         // The item is in this crate. The caller should have added it to the
@@ -2891,7 +2891,7 @@ fn lookup_field_type(tcx: ctxt, class_id: def_id, id: def_id,
         node_id_to_type(tcx, id.node)
     }
     else {
-        alt tcx.tcache.find(id) {
+        match tcx.tcache.find(id) {
            some(tpt) => tpt.ty,
            none => {
                let tpt = csearch::get_field_type(tcx, class_id, id);
@@ -2907,9 +2907,9 @@ fn lookup_field_type(tcx: ctxt, class_id: def_id, id: def_id,
 // Fails if the id is not bound to a class.
 fn lookup_class_fields(cx: ctxt, did: ast::def_id) -> ~[field_ty] {
   if did.crate == ast::local_crate {
-    alt cx.items.find(did.node) {
+    match cx.items.find(did.node) {
        some(ast_map::node_item(i,_)) => {
-         alt i.node {
+         match i.node {
                  ast::item_class(_, _, items, _, _) => {
                class_field_tys(items)
            }
@@ -2929,7 +2929,7 @@ fn lookup_class_fields(cx: ctxt, did: ast::def_id) -> ~[field_ty] {
 
 fn lookup_class_field(cx: ctxt, parent: ast::def_id, field_id: ast::def_id)
     -> field_ty {
-    alt vec::find(lookup_class_fields(cx, parent),
+    match vec::find(lookup_class_fields(cx, parent),
                  |f| f.id.node == field_id.node) {
         some(t) => t,
         none => cx.sess.bug(~"class ID not found in parent's fields")
@@ -2962,7 +2962,7 @@ fn lookup_class_method_ids(cx: ctxt, did: ast::def_id)
         -> ~[{name: ident, id: node_id, vis: visibility}] {
 
         assert is_local(did);
-        alt cx.items.find(did.node) {
+        match cx.items.find(did.node) {
           some(ast_map::node_item(@{
             node: item_class(_,_,items,_,_), _
           }, _)) => {
@@ -2994,7 +2994,7 @@ fn lookup_class_method_ids(cx: ctxt, did: ast::def_id)
 fn class_field_tys(items: ~[@class_member]) -> ~[field_ty] {
     let mut rslt = ~[];
     for items.each |it| {
-       alt it.node {
+       match it.node {
           instance_var(nm, _, cm, id, vis) => {
               vec::push(rslt, {ident: nm, id: ast_util::local_def(id),
                         vis: vis, mutability: cm});
@@ -3020,7 +3020,7 @@ fn class_items_as_mutable_fields(cx:ctxt, did: ast::def_id,
 // mutability.
 fn class_items_as_fields(cx:ctxt, did: ast::def_id,
                          substs: substs) -> ~[field] {
-    class_item_fields(cx, did, substs, |mt| alt mt {
+    class_item_fields(cx, did, substs, |mt| match mt {
       class_mutable => m_mutbl,
         class_immutable => m_imm })
 }
@@ -3058,7 +3058,7 @@ fn is_binopable(_cx: ctxt, ty: t, op: ast::binop) -> bool {
     const opcat_logic: int = 7;
 
     fn opcat(op: ast::binop) -> int {
-        alt op {
+        match op {
           ast::add => opcat_add,
           ast::subtract => opcat_sub,
           ast::mul => opcat_mult,
@@ -3081,7 +3081,7 @@ fn opcat(op: ast::binop) -> int {
     }
 
     fn tycat(ty: t) -> int {
-        alt get(ty).struct {
+        match get(ty).struct {
           ty_bool => tycat_bool,
           ty_int(_) | ty_uint(_) | ty_var_integral(_) => tycat_int,
           ty_float(_) => tycat_float,
@@ -3126,7 +3126,7 @@ fn normalize_vstore(vstore: vstore) -> vstore {
         }
     }
 
-    alt cx.normalized_cache.find(t) {
+    match cx.normalized_cache.find(t) {
       some(t) => return t,
       none => ()
     }
index a0c1d1da02f956891c7543260cf43a1d33b63f15..e96fe4e867947b0c0a2306031b997e41e78016dd 100644 (file)
@@ -180,7 +180,7 @@ fn write_substs_to_tcx(tcx: ty::ctxt,
 }
 
 fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::node_id) -> ast::def {
-    alt tcx.def_map.find(id) {
+    match tcx.def_map.find(id) {
       some(x) => x,
       _ => {
         tcx.sess.span_fatal(sp, ~"internal error looking up a definition")
@@ -205,7 +205,7 @@ fn require_same_types(
     msg: fn() -> ~str) -> bool {
 
     let l_tcx, l_infcx;
-    alt maybe_infcx {
+    match maybe_infcx {
       none => {
         l_tcx = tcx;
         l_infcx = infer::new_infer_ctxt(tcx);
@@ -216,7 +216,7 @@ fn require_same_types(
       }
     }
 
-    alt infer::mk_eqty(l_infcx, t1, t2) {
+    match infer::mk_eqty(l_infcx, t1, t2) {
       result::ok(()) => true,
       result::err(terr) => {
         l_tcx.sess.span_err(span, msg() + ~": " +
@@ -227,10 +227,10 @@ fn require_same_types(
 }
 
 fn arg_is_argv_ty(_tcx: ty::ctxt, a: ty::arg) -> bool {
-    alt ty::get(a.ty).struct {
+    match ty::get(a.ty).struct {
       ty::ty_evec(mt, vstore_uniq) => {
         if mt.mutbl != ast::m_imm { return false; }
-        alt ty::get(mt.ty).struct {
+        match ty::get(mt.ty).struct {
           ty::ty_estr(vstore_uniq) => return true,
           _ => return false
         }
@@ -245,12 +245,12 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
 
     let tcx = ccx.tcx;
     let main_t = ty::node_id_to_type(tcx, main_id);
-    alt ty::get(main_t).struct {
+    match ty::get(main_t).struct {
       ty::ty_fn({purity: ast::impure_fn, proto: ast::proto_bare,
                  inputs, output, ret_style: ast::return_val}) => {
-        alt tcx.items.find(main_id) {
+        match tcx.items.find(main_id) {
          some(ast_map::node_item(it,_)) => {
-             alt it.node {
+             match it.node {
                ast::item_fn(_,ps,_) if vec::is_not_empty(ps) => {
                   tcx.sess.span_err(main_span,
                     ~"main function is not allowed to have type parameters");
@@ -284,7 +284,7 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
 fn check_for_main_fn(ccx: @crate_ctxt) {
     let tcx = ccx.tcx;
     if !tcx.sess.building_library {
-        alt copy tcx.sess.main_fn {
+        match copy tcx.sess.main_fn {
           some((id, sp)) => check_main_fn_ty(ccx, id, sp),
           none => tcx.sess.err(~"main function not found")
         }
index 1211c5aa8d647dec6e1f9ed362c68af0d7660052..fffc70e95259b3e979c83a60b19928c0df2a36e9 100644 (file)
@@ -59,7 +59,7 @@ fn get_region_reporting_err(tcx: ty::ctxt,
                             span: span,
                             res: result<ty::region, ~str>) -> ty::region {
 
-    alt res {
+    match res {
       result::ok(r) => r,
       result::err(e) => {
         tcx.sess.span_err(span, e);
@@ -71,7 +71,7 @@ fn get_region_reporting_err(tcx: ty::ctxt,
 fn ast_region_to_region<AC: ast_conv, RS: region_scope copy owned>(
     self: AC, rscope: RS, span: span, a_r: @ast::region) -> ty::region {
 
-    let res = alt a_r.node {
+    let res = match a_r.node {
       ast::re_anon => rscope.anon_region(),
       ast::re_named(id) => rscope.named_region(id)
     };
@@ -93,7 +93,7 @@ fn ast_path_to_substs_and_ty<AC: ast_conv, RS: region_scope copy owned>(
     // If the type is parameterized by the self region, then replace self
     // region with the current anon region binding (in other words,
     // whatever & would get replaced with).
-    let self_r = alt (decl_rp, path.rp) {
+    let self_r = match (decl_rp, path.rp) {
       (false, none) => {
         none
       }
@@ -168,14 +168,14 @@ fn mk_maybe_vstore<AC: ast_conv, RS: region_scope copy owned>(
 
         let tcx = self.tcx();
 
-        alt a_seq_ty.ty.node {
+        match a_seq_ty.ty.node {
           // to convert to an e{vec,str}, there can't be a mutability argument
           _ if a_seq_ty.mutbl != ast::m_imm => (),
           ast::ty_vec(mt) => {
             return ty::mk_evec(tcx, ast_mt_to_mt(self, rscope, mt), vst);
           }
           ast::ty_path(path, id) => {
-            alt tcx.def_map.find(id) {
+            match tcx.def_map.find(id) {
               some(ast::def_prim_ty(ast::ty_str)) => {
                 check_path_args(tcx, path, NO_TPS | NO_REGIONS);
                 return ty::mk_estr(tcx, vst);
@@ -212,7 +212,7 @@ fn check_path_args(tcx: ty::ctxt,
 
     let tcx = self.tcx();
 
-    alt tcx.ast_ty_to_ty_cache.find(ast_ty) {
+    match tcx.ast_ty_to_ty_cache.find(ast_ty) {
       some(ty::atttce_resolved(ty)) => return ty,
       some(ty::atttce_unresolved) => {
         tcx.sess.span_fatal(ast_ty.span, ~"illegal recursive type; \
@@ -223,7 +223,7 @@ fn check_path_args(tcx: ty::ctxt,
     }
 
     tcx.ast_ty_to_ty_cache.insert(ast_ty, ty::atttce_unresolved);
-    let typ = alt ast_ty.node {
+    let typ = match ast_ty.node {
       ast::ty_nil => ty::mk_nil(tcx),
       ast::ty_bot => ty::mk_bot(tcx),
       ast::ty_box(mt) => {
@@ -265,17 +265,17 @@ fn check_path_args(tcx: ty::ctxt,
         ty::mk_fn(tcx, ty_of_fn_decl(self, rscope, proto, decl, none))
       }
       ast::ty_path(path, id) => {
-        let a_def = alt tcx.def_map.find(id) {
+        let a_def = match tcx.def_map.find(id) {
           none => tcx.sess.span_fatal(ast_ty.span, fmt!{"unbound path %s",
                                                         path_to_str(path)}),
           some(d) => d
         };
-        alt a_def {
+        match a_def {
           ast::def_ty(did) | ast::def_class(did, _) => {
             ast_path_to_ty(self, rscope, did, path, id).ty
           }
           ast::def_prim_ty(nty) => {
-            alt nty {
+            match nty {
               ast::ty_bool => {
                 check_path_args(tcx, path, NO_TPS | NO_REGIONS);
                 ty::mk_bool(tcx)
@@ -356,20 +356,20 @@ fn ty_of_arg<AC: ast_conv, RS: region_scope copy owned>(
     self: AC, rscope: RS, a: ast::arg,
     expected_ty: option<ty::arg>) -> ty::arg {
 
-    let ty = alt a.ty.node {
+    let ty = match a.ty.node {
       ast::ty_infer if expected_ty.is_some() => expected_ty.get().ty,
       ast::ty_infer => self.ty_infer(a.ty.span),
       _ => ast_ty_to_ty(self, rscope, a.ty)
     };
 
     let mode = {
-        alt a.mode {
+        match a.mode {
           ast::infer(_) if expected_ty.is_some() => {
             result::get(ty::unify_mode(self.tcx(), a.mode,
                                        expected_ty.get().mode))
           }
           ast::infer(_) => {
-            alt ty::get(ty).struct {
+            match ty::get(ty).struct {
               // If the type is not specified, then this must be a fn expr.
               // Leave the mode as infer(_), it will get inferred based
               // on constraints elsewhere.
@@ -417,7 +417,7 @@ fn ty_of_fn_decl<AC: ast_conv, RS: region_scope copy owned>(
         };
 
         let expected_ret_ty = expected_tys.map(|e| e.output);
-        let output_ty = alt decl.output.node {
+        let output_ty = match decl.output.node {
           ast::ty_infer if expected_ret_ty.is_some() => expected_ret_ty.get(),
           ast::ty_infer => self.ty_infer(decl.output.span),
           _ => ast_ty_to_ty(self, rb, decl.output)
index c875ac8c386404ec4dd88c0b5d7cdf28ab954329..efe728f9e127a4cb8c3d363686ceeec6b7422547 100644 (file)
@@ -177,7 +177,7 @@ fn check_bare_fn(ccx: @crate_ctxt,
                  id: ast::node_id,
                  self_info: option<self_info>) {
     let fty = ty::node_id_to_type(ccx.tcx, id);
-    let fn_ty = alt check ty::get(fty).struct { ty::ty_fn(f) => f };
+    let fn_ty = match check ty::get(fty).struct { ty::ty_fn(f) => f };
     check_fn(ccx, self_info, fn_ty, decl, body, false, none);
 }
 
@@ -216,7 +216,7 @@ fn check_fn(ccx: @crate_ctxt,
     // in the case of function expressions, based on the outer context.
     let fcx: @fn_ctxt = {
         let {infcx, locals, purity, node_types, node_type_substs} =
-        alt old_fcx {
+        match old_fcx {
           none => {
             {infcx: infer::new_infer_ctxt(tcx),
              locals: int_hash(),
@@ -236,7 +236,7 @@ fn check_fn(ccx: @crate_ctxt,
 
         let indirect_ret_ty = if indirect_ret {
             let ofcx = option::get(old_fcx);
-            alt ofcx.indirect_ret_ty {
+            match ofcx.indirect_ret_ty {
               some(t) => some(t),
               none => some(ofcx.ret_ty)
             }
@@ -260,7 +260,7 @@ fn check_fn(ccx: @crate_ctxt,
 
     // We unify the tail expr's type with the
     // function result type, if there is a tail expr.
-    alt body.node.expr {
+    match body.node.expr {
       some(tail_expr) => {
         let tail_expr_ty = fcx.expr_ty(tail_expr);
         demand::suptype(fcx, tail_expr.span, fcx.ret_ty, tail_expr_ty);
@@ -293,7 +293,7 @@ fn gather_locals(fcx: @fn_ctxt,
         let assign = fn@(nid: ast::node_id, ty_opt: option<ty::t>) {
             let var_id = fcx.infcx.next_ty_var_id();
             fcx.locals.insert(nid, var_id);
-            alt ty_opt {
+            match ty_opt {
               none => {/* nothing to do */ }
               some(typ) => {
                 infer::mk_eqty(fcx.infcx, ty::mk_var(tcx, var_id), typ);
@@ -311,7 +311,7 @@ fn gather_locals(fcx: @fn_ctxt,
         // Add explicitly-declared locals.
         let visit_local = fn@(local: @ast::local,
                               &&e: (), v: visit::vt<()>) {
-            let o_ty = alt local.node.ty.node {
+            let o_ty = match local.node.ty.node {
               ast::ty_infer => none,
               _ => some(fcx.to_ty(local.node.ty))
             };
@@ -324,7 +324,7 @@ fn gather_locals(fcx: @fn_ctxt,
 
         // Add pattern bindings.
         let visit_pat = fn@(p: @ast::pat, &&e: (), v: visit::vt<()>) {
-            alt p.node {
+            match p.node {
               ast::pat_ident(_, path, _)
                   if !pat_util::pat_is_variant(fcx.ccx.tcx.def_map, p) => {
                 assign(p.id, none);
@@ -371,7 +371,7 @@ fn check_method(ccx: @crate_ctxt, method: @ast::method,
 
 fn check_class_member(ccx: @crate_ctxt, class_t: self_info,
                       cm: @ast::class_member) {
-    alt cm.node {
+    match cm.node {
       ast::instance_var(_,t,_,_,_) => (),
       ast::class_method(m) => check_method(ccx, m, class_t)
     }
@@ -383,7 +383,7 @@ fn check_no_duplicate_fields(tcx: ty::ctxt, fields:
                                              |x,y| str::eq(*x, *y));
     for fields.each |p| {
         let (id, sp) = p;
-        alt field_names.find(id) {
+        match field_names.find(id) {
           some(orig_sp) => {
             tcx.sess.span_err(sp, fmt!{"Duplicate field \
                                    name %s in record type declaration",
@@ -401,7 +401,7 @@ fn check_no_duplicate_fields(tcx: ty::ctxt, fields:
 }
 
 fn check_item(ccx: @crate_ctxt, it: @ast::item) {
-    alt it.node {
+    match it.node {
       ast::item_const(_, e) => check_const(ccx, it.span, e, it.id),
       ast::item_enum(vs, _) => {
         check_enum_variants(ccx, it.span, vs, it.id);
@@ -419,7 +419,7 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
       }
       ast::item_trait(_, _, trait_methods) => {
         for trait_methods.each |trait_method| {
-            alt trait_method {
+            match trait_method {
               required(ty_m) => {
                 // Nothing to do, since required methods don't have
                 // bodies to check.
@@ -471,7 +471,7 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
         let tpt_ty = ty::node_id_to_type(ccx.tcx, it.id);
         check_bounds_are_used(ccx, t.span, tps, tpt_ty);
         // If this is a record ty, check for duplicate fields
-        alt t.node {
+        match t.node {
             ast::ty_rec(fields) => {
               check_no_duplicate_fields(ccx.tcx, fields.map(|f|
                                               (f.node.ident, f.span)));
@@ -519,7 +519,7 @@ fn anon_region() -> result<ty::region, ~str> {
     }
     fn named_region(id: ast::ident) -> result<ty::region, ~str> {
         do empty_rscope.named_region(id).chain_err |_e| {
-            alt self.in_scope_regions.find(ty::br_named(id)) {
+            match self.in_scope_regions.find(ty::br_named(id)) {
               some(r) => result::ok(r),
               none if *id == ~"blk" => self.block_region(),
               none => {
@@ -564,7 +564,7 @@ fn to_ty(ast_t: @ast::ty) -> ty::t {
     }
 
     fn expr_ty(ex: @ast::expr) -> ty::t {
-        alt self.node_types.find(ex.id) {
+        match self.node_types.find(ex.id) {
           some(t) => t,
           none => {
             self.tcx().sess.bug(fmt!{"no type for expr %d (%s) in fcx %s",
@@ -573,7 +573,7 @@ fn expr_ty(ex: @ast::expr) -> ty::t {
         }
     }
     fn node_ty(id: ast::node_id) -> ty::t {
-        alt self.node_types.find(id) {
+        match self.node_types.find(id) {
           some(t) => t,
           none => {
             self.tcx().sess.bug(
@@ -584,7 +584,7 @@ fn node_ty(id: ast::node_id) -> ty::t {
         }
     }
     fn node_ty_substs(id: ast::node_id) -> ty::substs {
-        alt self.node_type_substs.find(id) {
+        match self.node_type_substs.find(id) {
           some(ts) => ts,
           none => {
             self.tcx().sess.bug(
@@ -637,7 +637,7 @@ fn mk_subr(sub: ty::region, sup: ty::region) -> result<(), ty::type_err> {
     }
 
     fn require_unsafe(sp: span, op: ~str) {
-        alt self.purity {
+        match self.purity {
           ast::unsafe_fn => {/*ok*/}
           _ => {
             self.ccx.tcx.sess.span_err(
@@ -662,9 +662,9 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> ty::t {
         let sty = structure_of(fcx, sp, t1);
 
         // Some extra checks to detect weird cycles and so forth:
-        alt sty {
+        match sty {
           ty::ty_box(inner) | ty::ty_uniq(inner) | ty::ty_rptr(_, inner) => {
-            alt ty::get(t1).struct {
+            match ty::get(t1).struct {
               ty::ty_var(v1) => {
                 ty::occurs_check(fcx.ccx.tcx, sp, v1,
                                  ty::mk_box(fcx.ccx.tcx, inner));
@@ -687,7 +687,7 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> ty::t {
         }
 
         // Otherwise, deref if type is derefable:
-        alt ty::deref_sty(fcx.ccx.tcx, sty, false) {
+        match ty::deref_sty(fcx.ccx.tcx, sty, false) {
           none => return t1,
           some(mt) => t1 = mt.ty
         }
@@ -698,7 +698,7 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> ty::t {
 fn check_lit(fcx: @fn_ctxt, lit: @ast::lit) -> ty::t {
     let tcx = fcx.ccx.tcx;
 
-    alt lit.node {
+    match lit.node {
       ast::lit_str(s) => ty::mk_estr(tcx, ty::vstore_slice(ty::re_static)),
       ast::lit_int(_, t) => ty::mk_mach_int(tcx, t),
       ast::lit_uint(_, t) => ty::mk_mach_uint(tcx, t),
@@ -740,7 +740,7 @@ fn impl_self_ty(fcx: @fn_ctxt, did: ast::def_id) -> ty_param_substs_and_ty {
 
     let {n_tps, rp, raw_ty} = if did.crate == ast::local_crate {
         let rp = fcx.tcx().region_paramd_items.contains_key(did.node);
-        alt check tcx.items.find(did.node) {
+        match check tcx.items.find(did.node) {
           some(ast_map::node_item(@{node: ast::item_impl(ts, _, st, _),
                                   _}, _)) => {
             {n_tps: ts.len(),
@@ -818,7 +818,7 @@ fn check_call_inner(
         // process the types bound by the function but not by any nested
         // functions.  Therefore, we match one level of structure.
         let fn_ty =
-            alt structure_of(fcx, sp, in_fty) {
+            match structure_of(fcx, sp, in_fty) {
               sty @ ty::ty_fn(fn_ty) => {
                 replace_bound_regions_in_fn_ty(
                     fcx.ccx.tcx, @nil, none, fn_ty,
@@ -872,7 +872,7 @@ fn check_call_inner(
         // right way to do this.
         for [false, true]/_.each |check_blocks| {
             for args.eachi |i, a| {
-                let is_block = alt a.node {
+                let is_block = match a.node {
                   ast::expr_fn_block(*) => true,
                   _ => false
                 };
@@ -905,7 +905,7 @@ fn check_call(fcx: @fn_ctxt, sp: span, call_expr_id: ast::node_id,
 
         // Index expressions need to be handled seperately, to inform
         // them that they appear in call position.
-        let mut bot = alt f.node {
+        let mut bot = match f.node {
           ast::expr_field(base, field, tys) => {
             check_field(fcx, f, true, base, field, tys)
           }
@@ -922,7 +922,7 @@ fn check_call(fcx: @fn_ctxt, sp: span, call_expr_id: ast::node_id,
         };
 
         // Pull the return type out of the type of the function.
-        alt structure_of(fcx, sp, fty) {
+        match structure_of(fcx, sp, fty) {
           ty::ty_fn(f) => {
             bot |= (f.ret_style == ast::noreturn);
             fcx.write_ty(call_expr_id, f.output);
@@ -952,7 +952,7 @@ fn check_then_else(fcx: @fn_ctxt, thn: ast::blk,
                        elsopt: option<@ast::expr>, id: ast::node_id,
                        _sp: span) -> bool {
         let (if_t, if_bot) =
-            alt elsopt {
+            match elsopt {
               some(els) => {
                 let if_t = fcx.infcx.next_ty_var();
                 let thn_bot = check_block(fcx, thn);
@@ -976,7 +976,7 @@ fn lookup_op_method(fcx: @fn_ctxt, op_ex: @ast::expr,
         -> option<(ty::t, bool)> {
         let lkup = method::lookup(fcx, op_ex, self_ex, op_ex.id,
                      op_ex.callee_id, @opname, self_t, ~[], false);
-        alt lkup.method() {
+        match lkup.method() {
           some(origin) => {
             let {fty: method_ty, bot: bot} = {
                 let method_ty = fcx.node_ty(op_ex.callee_id);
@@ -998,7 +998,7 @@ fn check_binop(fcx: @fn_ctxt, expr: @ast::expr,
         let lhs_bot = check_expr(fcx, lhs, none);
         let lhs_t = fcx.expr_ty(lhs);
         let lhs_t = structurally_resolved_type(fcx, lhs.span, lhs_t);
-        return alt (op, ty::get(lhs_t).struct) {
+        return match (op, ty::get(lhs_t).struct) {
           (_, _) if ty::type_is_integral(lhs_t) &&
           ast_util::is_shift_binop(op) => {
             // Shift is a special case: rhs can be any integral type
@@ -1013,7 +1013,7 @@ fn check_binop(fcx: @fn_ctxt, expr: @ast::expr,
             let tvar = fcx.infcx.next_ty_var();
             demand::suptype(fcx, expr.span, tvar, lhs_t);
             let rhs_bot = check_expr_with(fcx, rhs, tvar);
-            let rhs_t = alt op {
+            let rhs_t = match op {
               ast::eq | ast::lt | ast::le | ast::ne | ast::ge |
               ast::gt => {
                 // these comparison operators are handled in a
@@ -1042,9 +1042,9 @@ fn check_user_binop(fcx: @fn_ctxt, ex: @ast::expr,
                         lhs_expr: @ast::expr, lhs_resolved_t: ty::t,
                         op: ast::binop, rhs: @ast::expr) -> (ty::t, bool) {
         let tcx = fcx.ccx.tcx;
-        alt ast_util::binop_to_method_name(op) {
+        match ast_util::binop_to_method_name(op) {
           some(name) => {
-            alt lookup_op_method(fcx, ex,
+            match lookup_op_method(fcx, ex,
                                  lhs_expr, lhs_resolved_t,
                                  name, ~[rhs]) {
               some(pair) => return pair,
@@ -1064,7 +1064,7 @@ fn check_user_binop(fcx: @fn_ctxt, ex: @ast::expr,
         // If the or operator is used it might be that the user forgot to
         // supply the do keyword.  Let's be more helpful in that situation.
         if op == ast::or {
-          alt ty::get(lhs_resolved_t).struct {
+          match ty::get(lhs_resolved_t).struct {
             ty::ty_fn(f) => {
               tcx.sess.span_note(
                   ex.span, ~"did you forget the 'do' keyword for the call?");
@@ -1078,7 +1078,7 @@ fn check_user_binop(fcx: @fn_ctxt, ex: @ast::expr,
     fn check_user_unop(fcx: @fn_ctxt, op_str: ~str, mname: ~str,
                        ex: @ast::expr,
                        rhs_expr: @ast::expr, rhs_t: ty::t) -> ty::t {
-        alt lookup_op_method(fcx, ex, rhs_expr, rhs_t, mname, ~[]) {
+        match lookup_op_method(fcx, ex, rhs_expr, rhs_t, mname, ~[]) {
           some((ret_ty, _)) => ret_ty,
           _ => {
             fcx.ccx.tcx.sess.span_err(
@@ -1096,9 +1096,9 @@ fn check_user_unop(fcx: @fn_ctxt, op_str: ~str, mname: ~str,
     fn unpack_expected<O: copy>(fcx: @fn_ctxt, expected: option<ty::t>,
                                 unpack: fn(ty::sty) -> option<O>)
         -> option<O> {
-        alt expected {
+        match expected {
           some(t) => {
-            alt resolve_type(fcx.infcx, t, force_tvar) {
+            match resolve_type(fcx.infcx, t, force_tvar) {
               result::ok(t) => unpack(ty::get(t).struct),
               _ => none
             }
@@ -1121,7 +1121,7 @@ fn check_expr_fn(fcx: @fn_ctxt,
         // def'n of br_cap_avoid() for a more lengthy explanation of
         // what's going on here.
         let expected_tys = do unpack_expected(fcx, expected) |sty| {
-            alt sty {
+            match sty {
               ty::ty_fn(fn_ty) => {
                 let {fn_ty, _} =
                     replace_bound_regions_in_fn_ty(
@@ -1160,9 +1160,9 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
         let base_t = do_autoderef(fcx, expr.span, expr_t);
         let mut handled = false;
         let n_tys = vec::len(tys);
-        alt structure_of(fcx, expr.span, base_t) {
+        match structure_of(fcx, expr.span, base_t) {
           ty::ty_rec(fields) => {
-            alt ty::field_idx(field, fields) {
+            match ty::field_idx(field, fields) {
               some(ix) => {
                 if n_tys > 0u {
                     tcx.sess.span_err(expr.span,
@@ -1194,7 +1194,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
               else {
                   lookup_public_fields(tcx, base_id)
               };
-              alt lookup_field_ty(tcx, base_id, cls_items, field, substs) {
+              match lookup_field_ty(tcx, base_id, cls_items, field, substs) {
                  some(field_ty) => {
                     // (2) look up what field's type is, and return it
                      fcx.write_ty(expr.id, field_ty);
@@ -1216,7 +1216,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
             let lkup = method::lookup(fcx, expr, base, borrow_lb,
                                       expr.id, field, expr_t, tps,
                                       is_self_ref);
-            alt lkup.method() {
+            match lkup.method() {
               some(entry) => {
                 fcx.ccx.method_map.insert(expr.id, entry);
 
@@ -1248,9 +1248,9 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
     let tcx = fcx.ccx.tcx;
     let id = expr.id;
     let mut bot = false;
-    alt expr.node {
+    match expr.node {
       ast::expr_vstore(ev, vst) => {
-        let typ = alt ev.node {
+        let typ = match ev.node {
           ast::expr_lit(@{node: ast::lit_str(s), span:_}) => {
             let tt = ast_expr_vstore_to_vstore(fcx, ev, str::len(*s), vst);
             ty::mk_estr(tcx, tt)
@@ -1315,8 +1315,8 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
       }
       ast::expr_unary(unop, oprnd) => {
         let exp_inner = do unpack_expected(fcx, expected) |sty| {
-            alt unop {
-              ast::box(_) | ast::uniq(_) => alt sty {
+            match unop {
+              ast::box(_) | ast::uniq(_) => match sty {
                 ty::ty_box(mt) | ty::ty_uniq(mt) => some(mt.ty),
                 _ => none
               }
@@ -1326,7 +1326,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
         };
         bot = check_expr(fcx, oprnd, exp_inner);
         let mut oprnd_t = fcx.expr_ty(oprnd);
-        alt unop {
+        match unop {
           ast::box(mutbl) => {
             oprnd_t = ty::mk_box(tcx, {ty: oprnd_t, mutbl: mutbl});
           }
@@ -1338,7 +1338,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
 
             // deref'ing an unsafe pointer requires that we be in an unsafe
             // context
-            alt sty {
+            match sty {
               ty::ty_ptr(*) => {
                 fcx.require_unsafe(
                     expr.span,
@@ -1347,10 +1347,10 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
               _ => { /*ok*/ }
             }
 
-            alt ty::deref_sty(tcx, sty, true) {
+            match ty::deref_sty(tcx, sty, true) {
               some(mt) => { oprnd_t = mt.ty }
               none => {
-                alt sty {
+                match sty {
                   ty::ty_enum(*) => {
                     tcx.sess.span_err(
                         expr.span,
@@ -1389,7 +1389,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
       }
       ast::expr_addr_of(mutbl, oprnd) => {
         bot = check_expr(fcx, oprnd, unpack_expected(fcx, expected, |ty|
-            alt ty { ty::ty_rptr(_, mt) => some(mt.ty), _ => none }
+            match ty { ty::ty_rptr(_, mt) => some(mt.ty), _ => none }
         ));
         //let region = region_of(fcx, oprnd);
         let region = fcx.infcx.next_region_var_with_scope_lb(expr.id);
@@ -1406,7 +1406,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
       ast::expr_mac(_) => tcx.sess.bug(~"unexpanded macro"),
       ast::expr_fail(expr_opt) => {
         bot = true;
-        alt expr_opt {
+        match expr_opt {
           none => {/* do nothing */ }
           some(e) => {
             check_expr_with(fcx, e,
@@ -1419,11 +1419,11 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
       ast::expr_again => { fcx.write_bot(id); bot = true; }
       ast::expr_ret(expr_opt) => {
         bot = true;
-        let ret_ty = alt fcx.indirect_ret_ty {
+        let ret_ty = match fcx.indirect_ret_ty {
           some(t) =>  t, none => fcx.ret_ty
         };
-        alt expr_opt {
-          none => alt fcx.mk_eqty(ret_ty, ty::mk_nil(tcx)) {
+        match expr_opt {
+          none => match fcx.mk_eqty(ret_ty, ty::mk_nil(tcx)) {
             result::ok(_) => { /* fall through */ }
             result::err(_) => {
                 tcx.sess.span_err(
@@ -1482,7 +1482,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
       ast::expr_fn_block(decl, body, cap_clause) => {
          // Take the prototype from the expected type, but default to block:
           let proto = unpack_expected(fcx, expected, |sty|
-              alt sty { ty::ty_fn({proto, _}) => some(proto), _ => none }
+              match sty { ty::ty_fn({proto, _}) => some(proto), _ => none }
           ).get_default(ast::proto_box);
         check_expr_fn(fcx, expr, proto, decl, body, false, expected);
         capture::check_capture_clause(tcx, expr.id, cap_clause);
@@ -1495,9 +1495,9 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
         // 1. a closure that returns a bool is expected
         // 2. the cloure that was given returns unit
         let expected_sty = unpack_expected(fcx, expected, |x| some(x));
-        let (inner_ty, proto) = alt expected_sty {
+        let (inner_ty, proto) = match expected_sty {
           some(ty::ty_fn(fty)) => {
-            alt infer::mk_subty(fcx.infcx, fty.output, ty::mk_bool(tcx)) {
+            match infer::mk_subty(fcx.infcx, fty.output, ty::mk_bool(tcx)) {
               result::ok(_) => (),
               result::err(err) => {
                 tcx.sess.span_fatal(
@@ -1514,7 +1514,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
                                             type");
           }
         };
-        alt check b.node {
+        match check b.node {
           ast::expr_fn_block(decl, body, cap_clause) => {
             check_expr_fn(fcx, b, proto, decl, body, true, some(inner_ty));
             demand::suptype(fcx, b.span, inner_ty, fcx.expr_ty(b));
@@ -1523,7 +1523,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
         }
         let block_ty = structurally_resolved_type(
             fcx, expr.span, fcx.node_ty(b.id));
-        alt check ty::get(block_ty).struct {
+        match check ty::get(block_ty).struct {
           ty::ty_fn(fty) => {
             fcx.write_ty(expr.id, ty::mk_fn(tcx, {output: ty::mk_bool(tcx)
                                                   with fty}));
@@ -1532,7 +1532,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
       }
       ast::expr_do_body(b) => {
         let expected_sty = unpack_expected(fcx, expected, |x| some(x));
-        let (inner_ty, proto) = alt expected_sty {
+        let (inner_ty, proto) = match expected_sty {
           some(ty::ty_fn(fty)) => {
             (ty::mk_fn(tcx, fty), fty.proto)
           }
@@ -1542,7 +1542,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
               passed to a `do` function");
           }
         };
-        alt check b.node {
+        match check b.node {
           ast::expr_fn_block(decl, body, cap_clause) => {
             check_expr_fn(fcx, b, proto, decl, body, true, some(inner_ty));
             demand::suptype(fcx, b.span, inner_ty, fcx.expr_ty(b));
@@ -1551,7 +1551,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
         }
         let block_ty = structurally_resolved_type(
             fcx, expr.span, fcx.node_ty(b.id));
-        alt check ty::get(block_ty).struct {
+        match check ty::get(block_ty).struct {
           ty::ty_fn(fty) => {
             fcx.write_ty(expr.id, ty::mk_fn(tcx, fty));
           }
@@ -1561,7 +1561,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
         // If this is an unchecked block, turn off purity-checking
         bot = check_block(fcx, b);
         let typ =
-            alt b.node.expr {
+            match b.node.expr {
               some(expr) => fcx.expr_ty(expr),
               none => ty::mk_nil(tcx)
             };
@@ -1578,7 +1578,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
         debug!{"t_1=%s", fcx.infcx.ty_to_str(t_1)};
         debug!{"t_e=%s", fcx.infcx.ty_to_str(t_e)};
 
-        alt ty::get(t_1).struct {
+        match ty::get(t_1).struct {
           // This will be looked up later on
           ty::ty_trait(*) => (),
 
@@ -1631,7 +1631,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
         let mut elt_ts = ~[];
         vec::reserve(elt_ts, vec::len(elts));
         let flds = unpack_expected(fcx, expected, |sty| {
-            alt sty { ty::ty_tup(flds) => some(flds), _ => none }
+            match sty { ty::ty_tup(flds) => some(flds), _ => none }
         });
         for elts.eachi |i, e| {
             check_expr(fcx, e, flds.map(|fs| fs[i]));
@@ -1647,7 +1647,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
             some(fcx.expr_ty(base.get()))
         } else { expected };
         let flds = unpack_expected(fcx, expected, |sty|
-            alt sty { ty::ty_rec(flds) => some(flds), _ => none }
+            match sty { ty::ty_rec(flds) => some(flds), _ => none }
         );
         let fields_t = vec::map(fields, |f| {
             bot |= check_expr(fcx, f.node.expr, flds.chain(|flds|
@@ -1659,7 +1659,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
             // should be f.node.expr.span, not f.span
             respan(f.node.expr.span, {ident: f.node.ident, mt: expr_mt})
         });
-        alt base {
+        match base {
           none => {
             fn get_node(f: spanned<field>) -> field { f.node }
             let typ = ty::mk_rec(tcx, vec::map(fields_t, get_node));
@@ -1674,7 +1674,7 @@ fn get_node(f: spanned<field>) -> field { f.node }
           }
           some(bexpr) => {
             let bexpr_t = fcx.expr_ty(bexpr);
-            let base_fields =  alt structure_of(fcx, expr.span, bexpr_t) {
+            let base_fields =  match structure_of(fcx, expr.span, bexpr_t) {
               ty::ty_rec(flds) => flds,
               _ => {
                 tcx.sess.span_fatal(expr.span,
@@ -1702,7 +1702,7 @@ fn get_node(f: spanned<field>) -> field { f.node }
       ast::expr_struct(path, fields, base_expr) => {
         // Resolve the path.
         let class_id;
-        alt tcx.def_map.find(id) {
+        match tcx.def_map.find(id) {
             some(ast::def_class(type_def_id, _)) => {
                 class_id = type_def_id;
             }
@@ -1718,7 +1718,7 @@ fn get_node(f: spanned<field>) -> field { f.node }
         if class_id.crate == ast::local_crate {
             region_parameterized =
                 tcx.region_paramd_items.contains_key(class_id.node);
-            alt tcx.items.find(class_id.node) {
+            match tcx.items.find(class_id.node) {
                 some(ast_map::node_item(@{
                         node: ast::item_class(type_parameters, _, _, _, _),
                         _
@@ -1779,7 +1779,7 @@ fn get_node(f: spanned<field>) -> field { f.node }
 
         // Typecheck each field.
         for fields.each |field| {
-            alt class_field_map.find(*field.node.ident) {
+            match class_field_map.find(*field.node.ident) {
                 none => {
                     tcx.sess.span_err(field.span,
                                       fmt!{"structure has no field named \
@@ -1848,7 +1848,7 @@ fn get_node(f: spanned<field>) -> field { f.node }
         let base_t = do_autoderef(fcx, expr.span, raw_base_t);
         bot |= check_expr(fcx, idx, none);
         let idx_t = fcx.expr_ty(idx);
-        alt ty::index_sty(tcx, structure_of(fcx, expr.span, base_t)) {
+        match ty::index_sty(tcx, structure_of(fcx, expr.span, base_t)) {
           some(mt) => {
             require_integral(fcx, idx.span, idx_t);
             fcx.write_ty(id, mt.ty);
@@ -1856,7 +1856,7 @@ fn get_node(f: spanned<field>) -> field { f.node }
           none => {
             let resolved = structurally_resolved_type(fcx, expr.span,
                                                       raw_base_t);
-            alt lookup_op_method(fcx, expr, base, resolved, ~"index",
+            match lookup_op_method(fcx, expr, base, resolved, ~"index",
                                  ~[idx]) {
               some((ret_ty, _)) => fcx.write_ty(id, ret_ty),
               _ => {
@@ -1874,7 +1874,7 @@ fn get_node(f: spanned<field>) -> field { f.node }
     debug!{"type of expr %s is %s, expected is %s",
            syntax::print::pprust::expr_to_str(expr),
            ty_to_str(tcx, fcx.expr_ty(expr)),
-           alt expected {
+           match expected {
                some(t) => ty_to_str(tcx, t),
                _ => ~"empty"
            }};
@@ -1904,7 +1904,7 @@ fn check_decl_local(fcx: @fn_ctxt, local: @ast::local) -> bool {
 
     let t = ty::mk_var(fcx.ccx.tcx, fcx.locals.get(local.node.id));
     fcx.write_ty(local.node.id, t);
-    alt local.node.init {
+    match local.node.init {
       some(init) => {
         bot = check_decl_initializer(fcx, local.node.id, init);
       }
@@ -1927,10 +1927,10 @@ fn check_decl_local(fcx: @fn_ctxt, local: @ast::local) -> bool {
 fn check_stmt(fcx: @fn_ctxt, stmt: @ast::stmt) -> bool {
     let mut node_id;
     let mut bot = false;
-    alt stmt.node {
+    match stmt.node {
       ast::stmt_decl(decl, id) => {
         node_id = id;
-        alt decl.node {
+        match decl.node {
           ast::decl_local(ls) => for ls.each |l| {
             bot |= check_decl_local(fcx, l);
           }
@@ -1961,7 +1961,7 @@ fn check_block_no_value(fcx: @fn_ctxt, blk: ast::blk) -> bool {
 }
 
 fn check_block(fcx0: @fn_ctxt, blk: ast::blk) -> bool {
-    let fcx = alt blk.node.rules {
+    let fcx = match blk.node.rules {
       ast::unchecked_blk => @fn_ctxt_({purity: ast::impure_fn with **fcx0}),
       ast::unsafe_blk => @fn_ctxt_({purity: ast::unsafe_fn with **fcx0}),
       ast::default_blk => fcx0
@@ -1971,7 +1971,7 @@ fn check_block(fcx0: @fn_ctxt, blk: ast::blk) -> bool {
         let mut warned = false;
         for blk.node.stmts.each |s| {
             if bot && !warned &&
-                alt s.node {
+                match s.node {
                   ast::stmt_decl(@{node: ast::decl_local(_), _}, _) |
                   ast::stmt_expr(_, _) | ast::stmt_semi(_, _) => {
                     true
@@ -1983,7 +1983,7 @@ fn check_block(fcx0: @fn_ctxt, blk: ast::blk) -> bool {
             }
             bot |= check_stmt(fcx, s);
         }
-        alt blk.node.expr {
+        match blk.node.expr {
           none => fcx.write_nil(blk.node.id),
           some(e) => {
             if bot && !warned {
@@ -2044,7 +2044,7 @@ fn check_enum_variants(ccx: @crate_ctxt,
     let mut disr_val = 0;
     let mut variants = ~[];
     for vs.each |v| {
-        alt v.node.disr_expr {
+        match v.node.disr_expr {
           some(e) => {
             let fcx = blank_fn_ctxt(ccx, rty, e.id);
             check_expr(fcx, e, none);
@@ -2055,7 +2055,7 @@ fn check_enum_variants(ccx: @crate_ctxt,
             // Also, check_expr (from check_const pass) doesn't guarantee that
             // the expression in an form that eval_const_expr can handle, so
             // we may still get an internal compiler error
-            alt const_eval::eval_const_expr(ccx.tcx, e) {
+            match const_eval::eval_const_expr(ccx.tcx, e) {
               const_eval::const_int(val) => {
                 disr_val = val as int;
               }
@@ -2088,7 +2088,7 @@ fn check_enum_variants(ccx: @crate_ctxt,
     // Check that it is possible to represent this enum:
     let mut outer = true, did = local_def(id);
     if ty::type_structurally_contains(ccx.tcx, rty, |sty| {
-        alt sty {
+        match sty {
           ty::ty_enum(id, _) if id == did => {
             if outer { outer = false; false }
             else { true }
@@ -2119,7 +2119,7 @@ fn self_ref(fcx: @fn_ctxt, id: ast::node_id) -> bool {
 }
 
 fn lookup_local(fcx: @fn_ctxt, sp: span, id: ast::node_id) -> tv_vid {
-    alt fcx.locals.find(id) {
+    match fcx.locals.find(id) {
       some(x) => x,
       _ => {
         fcx.ccx.tcx.sess.span_fatal(sp,
@@ -2136,7 +2136,7 @@ fn lookup_def(fcx: @fn_ctxt, sp: span, id: ast::node_id) -> ast::def {
 fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) ->
     ty_param_bounds_and_ty {
 
-    alt defn {
+    match defn {
       ast::def_arg(nid, _) => {
         assert (fcx.locals.contains_key(nid));
         let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, nid));
@@ -2148,7 +2148,7 @@ fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) ->
         return no_params(typ);
       }
       ast::def_self(_) => {
-        alt fcx.self_info {
+        match fcx.self_info {
           some(self_info) => {
             return no_params(self_info.self_ty);
           }
@@ -2223,7 +2223,7 @@ fn instantiate_path(fcx: @fn_ctxt,
 
     // determine the region bound, using the value given by the user
     // (if any) and otherwise using a fresh region variable
-    let self_r = alt pth.rp {
+    let self_r = match pth.rp {
       some(r) if !tpt.rp => {
         fcx.ccx.tcx.sess.span_err
             (sp, ~"this item is not region-parameterized");
@@ -2267,7 +2267,7 @@ fn instantiate_path(fcx: @fn_ctxt,
 // Resolves `typ` by a single level if `typ` is a type variable.  If no
 // resolution is possible, then an error is reported.
 fn structurally_resolved_type(fcx: @fn_ctxt, sp: span, tp: ty::t) -> ty::t {
-    alt infer::resolve_type(fcx.infcx, tp, force_tvar) {
+    match infer::resolve_type(fcx.infcx, tp, force_tvar) {
       result::ok(t_s) if !ty::type_is_var(t_s) => return t_s,
       _ => {
         fcx.ccx.tcx.sess.span_fatal
@@ -2298,7 +2298,7 @@ fn type_is_c_like_enum(fcx: @fn_ctxt, sp: span, typ: ty::t) -> bool {
 
 fn ast_expr_vstore_to_vstore(fcx: @fn_ctxt, e: @ast::expr, n: uint,
                              v: ast::vstore) -> ty::vstore {
-    alt v {
+    match v {
       ast::vstore_fixed(none) => ty::vstore_fixed(n),
       ast::vstore_fixed(some(u)) => {
         if n != u {
@@ -2309,7 +2309,7 @@ fn ast_expr_vstore_to_vstore(fcx: @fn_ctxt, e: @ast::expr, n: uint,
       }
       ast::vstore_uniq => ty::vstore_uniq,
       ast::vstore_box => ty::vstore_box,
-      ast::vstore_slice(a_r) =>  alt fcx.block_region() {
+      ast::vstore_slice(a_r) =>  match fcx.block_region() {
         result::ok(b_r) => {
             let rscope = in_anon_rscope(fcx, b_r);
             let r = astconv::ast_region_to_region(fcx, rscope, e.span, a_r);
@@ -2335,7 +2335,7 @@ fn check_bounds_are_used(ccx: @crate_ctxt,
         ccx.tcx, ty,
         |_r| {},
         |t| {
-            alt ty::get(t).struct {
+            match ty::get(t).struct {
               ty::ty_param({idx, _}) => { tps_used[idx] = true; }
               _ => ()
             }
@@ -2358,7 +2358,7 @@ fn arg(m: ast::rmode, ty: ty::t) -> ty::arg {
         {mode: ast::expl(m), ty: ty}
     }
     let tcx = ccx.tcx;
-    let (n_tps, inputs, output) = alt *it.ident {
+    let (n_tps, inputs, output) = match *it.ident {
       ~"size_of" |
       ~"pref_align_of" | ~"min_align_of" => (1u, ~[], ty::mk_uint(ccx.tcx)),
       ~"init" => (1u, ~[], param(ccx, 0u)),
index 316ef5a89278f9100c1d1fda8527e6f09e3825f6..2de26873316ef12617b4ecd8be9939d262af3251 100644 (file)
@@ -29,7 +29,7 @@ fn check_alt(fcx: @fn_ctxt,
     let mut result_ty = fcx.infcx.next_ty_var();
     let mut arm_non_bot = false;
     for arms.each |arm| {
-        alt arm.guard {
+        match arm.guard {
           some(e) => { check_expr_with(fcx, e, ty::mk_bool(tcx)); },
           none => ()
         }
@@ -68,7 +68,7 @@ fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path,
     instantiate_path(pcx.fcx, path, enum_tpt, pat.span, pat.id);
 
     // Take the enum type params out of `expected`.
-    alt structure_of(pcx.fcx, pat.span, expected) {
+    match structure_of(pcx.fcx, pat.span, expected) {
       ty::ty_enum(_, expected_substs) => {
         // check that the type of the value being matched is a subtype
         // of the type of the pattern:
@@ -82,7 +82,7 @@ fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path,
                     tcx, v_def_ids.enm, v_def_ids.var);
             vinfo.args.map(|t| { ty::subst(tcx, expected_substs, t) })
         };
-        let arg_len = arg_types.len(), subpats_len = alt subpats {
+        let arg_len = arg_types.len(), subpats_len = match subpats {
             none => arg_len,
             some(ps) => ps.len()
         };
@@ -127,7 +127,7 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
     let fcx = pcx.fcx;
     let tcx = pcx.fcx.ccx.tcx;
 
-    alt pat.node {
+    match pat.node {
       ast::pat_wild => {
         fcx.write_ty(pat.id, expected);
       }
@@ -167,7 +167,7 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
             demand::suptype(fcx, pat.span, ct, typ);
         }
         fcx.write_ty(pat.id, typ);
-        alt sub {
+        match sub {
           some(p) => check_pat(pcx, p, expected),
           _ => ()
         }
@@ -179,7 +179,7 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
         check_pat_variant(pcx, pat, path, subpats, expected);
       }
       ast::pat_rec(fields, etc) => {
-        let ex_fields = alt structure_of(fcx, pat.span, expected) {
+        let ex_fields = match structure_of(fcx, pat.span, expected) {
           ty::ty_rec(fields) => fields,
           _ => {
             tcx.sess.span_fatal
@@ -201,7 +201,7 @@ fn matches(name: ast::ident, f: ty::field) -> bool {
             str::eq(name, f.ident)
         }
         for fields.each |f| {
-            alt vec::find(ex_fields, |a| matches(f.ident, a)) {
+            match vec::find(ex_fields, |a| matches(f.ident, a)) {
               some(field) => {
                 check_pat(pcx, f.pat, field.mt.ty);
               }
@@ -216,7 +216,7 @@ fn matches(name: ast::ident, f: ty::field) -> bool {
         fcx.write_ty(pat.id, expected);
       }
       ast::pat_tup(elts) => {
-        let ex_elts = alt structure_of(fcx, pat.span, expected) {
+        let ex_elts = match structure_of(fcx, pat.span, expected) {
           ty::ty_tup(elts) => elts,
           _ => {
             tcx.sess.span_fatal
@@ -241,7 +241,7 @@ fn matches(name: ast::ident, f: ty::field) -> bool {
         fcx.write_ty(pat.id, expected);
       }
       ast::pat_box(inner) => {
-        alt structure_of(fcx, pat.span, expected) {
+        match structure_of(fcx, pat.span, expected) {
           ty::ty_box(e_inner) => {
             check_pat(pcx, inner, e_inner.ty);
             fcx.write_ty(pat.id, expected);
@@ -256,7 +256,7 @@ fn matches(name: ast::ident, f: ty::field) -> bool {
         }
       }
       ast::pat_uniq(inner) => {
-        alt structure_of(fcx, pat.span, expected) {
+        match structure_of(fcx, pat.span, expected) {
           ty::ty_uniq(e_inner) => {
             check_pat(pcx, inner, e_inner.ty);
             fcx.write_ty(pat.id, expected);
index e1cf67e94e6c1e063266ac8a4e98de5d28ad102f..17f171bdf908080ceb616f4267d77371e613bb6b 100644 (file)
@@ -6,7 +6,7 @@ fn suptype(fcx: @fn_ctxt, sp: span,
            expected: ty::t, actual: ty::t) {
 
     // n.b.: order of actual, expected is reversed
-    alt infer::mk_subty(fcx.infcx, actual, expected) {
+    match infer::mk_subty(fcx.infcx, actual, expected) {
       result::ok(()) => { /* ok */ }
       result::err(err) => {
         fcx.report_mismatched_types(sp, expected, actual, err);
@@ -17,7 +17,7 @@ fn suptype(fcx: @fn_ctxt, sp: span,
 fn eqtype(fcx: @fn_ctxt, sp: span,
           expected: ty::t, actual: ty::t) {
 
-    alt infer::mk_eqty(fcx.infcx, actual, expected) {
+    match infer::mk_eqty(fcx.infcx, actual, expected) {
       result::ok(()) => { /* ok */ }
       result::err(err) => {
         fcx.report_mismatched_types(sp, expected, actual, err);
@@ -29,7 +29,7 @@ fn eqtype(fcx: @fn_ctxt, sp: span,
 fn assign(fcx: @fn_ctxt, sp: span, borrow_lb: ast::node_id,
           expected: ty::t, expr: @ast::expr) {
     let expr_ty = fcx.expr_ty(expr);
-    alt fcx.mk_assignty(expr, borrow_lb, expr_ty, expected) {
+    match fcx.mk_assignty(expr, borrow_lb, expr_ty, expected) {
       result::ok(()) => { /* ok */ }
       result::err(err) => {
         fcx.report_mismatched_types(sp, expected, expr_ty, err);
index f86d5bf3a7a6e4db760a630d3d03e8b3d7cbca9a..442920a0681bcfe468f2ceeb634364340198095e 100644 (file)
@@ -24,7 +24,7 @@ fn transform_self_type_for_method(fcx: @fn_ctxt,
                                   impl_ty: ty::t,
                                   method_info: MethodInfo)
                                -> ty::t {
-    alt method_info.self_type {
+    match method_info.self_type {
         sty_by_ref | sty_value => {
             impl_ty
         }
@@ -88,7 +88,7 @@ fn method() -> option<method_map_entry> {
 
         // Determine if there are any inherent methods we can call.
         let optional_inherent_methods;
-        alt get_base_type_def_id(self.fcx.infcx,
+        match get_base_type_def_id(self.fcx.infcx,
                                  self.self_expr.span,
                                  self.self_ty) {
             none => {
@@ -110,7 +110,7 @@ fn method() -> option<method_map_entry> {
 
         loop {
             // First, see whether this is a bounded parameter.
-            alt ty::get(self.self_ty).struct {
+            match ty::get(self.self_ty).struct {
               ty::ty_param(p) => {
                 self.add_candidates_from_param(p.idx, p.def_id);
               }
@@ -151,7 +151,7 @@ fn method() -> option<method_map_entry> {
             if self.candidates.len() > 0u { break; }
 
             // check whether we can autoderef and if so loop around again.
-            alt ty::deref(self.tcx(), self.self_ty, false) {
+            match ty::deref(self.tcx(), self.self_ty, false) {
               none => break,
               some(mt) => {
                 self.self_ty = mt.ty;
@@ -168,7 +168,7 @@ fn method() -> option<method_map_entry> {
                 ~"multiple applicable methods in scope");
 
             for self.candidates.eachi |i, candidate| {
-                alt candidate.entry.origin {
+                match candidate.entry.origin {
                   method_static(did) => {
                     self.report_static_candidate(i, did);
                   }
@@ -189,7 +189,7 @@ fn tcx() -> ty::ctxt { self.fcx.ccx.tcx }
 
     fn report_static_candidate(idx: uint, did: ast::def_id) {
         let span = if did.crate == ast::local_crate {
-            alt check self.tcx().items.get(did.node) {
+            match check self.tcx().items.get(did.node) {
               ast_map::node_method(m, _, _) => m.span,
             }
         } else {
@@ -226,20 +226,20 @@ fn add_candidates_from_param(n: uint, did: ast::def_id) {
         let mut trait_bnd_idx = 0u; // count only trait bounds
         let bounds = tcx.ty_param_bounds.get(did.node);
         for vec::each(*bounds) |bound| {
-            let (iid, bound_substs) = alt bound {
+            let (iid, bound_substs) = match bound {
               ty::bound_copy | ty::bound_send | ty::bound_const |
               ty::bound_owned => {
                 again; /* ok */
               }
               ty::bound_trait(bound_t) => {
-                alt check ty::get(bound_t).struct {
+                match check ty::get(bound_t).struct {
                   ty::ty_trait(i, substs) => (i, substs)
                 }
               }
             };
 
             let trt_methods = ty::trait_methods(tcx, iid);
-            alt vec::position(*trt_methods, |m| m.ident == self.m_name) {
+            match vec::position(*trt_methods, |m| m.ident == self.m_name) {
               none => {
                 /* check next bound */
                 trait_bnd_idx += 1u;
@@ -329,14 +329,14 @@ fn add_candidates_from_class(did: ast::def_id, class_substs: ty::substs) {
     }
 
     fn ty_from_did(did: ast::def_id) -> ty::t {
-        alt check ty::get(ty::lookup_item_type(self.tcx(), did).ty).struct {
+        match check ty::get(ty::lookup_item_type(self.tcx(), did).ty).struct {
           ty::ty_fn(fty) => {
             ty::mk_fn(self.tcx(), {proto: ast::proto_box with fty})
           }
         }
         /*
         if did.crate == ast::local_crate {
-            alt check self.tcx().items.get(did.node) {
+            match check self.tcx().items.get(did.node) {
               ast_map::node_method(m, _, _) {
                 // NDM trait/impl regions
                 let mt = ty_of_method(self.fcx.ccx, m, ast::rp_none);
@@ -344,7 +344,9 @@ fn ty_from_did(did: ast::def_id) -> ty::t {
               }
             }
         } else {
-            alt check ty::get(csearch::get_type(self.tcx(), did).ty).struct {
+            match check ty::get(csearch::get_type(self.tcx(), did).ty)
+              .struct {
+
               ty::ty_fn(fty) {
                 ty::mk_fn(self.tcx(), {proto: ast::proto_box with fty})
               }
@@ -408,7 +410,7 @@ fn add_candidates_from_impl(im: @resolve3::Impl,
                 self.fcx.can_mk_subty(self.self_ty, impl_ty)
             };
             debug!{"matches = %?", matches};
-            alt matches {
+            match matches {
               result::err(_) => { /* keep looking */ }
               result::ok(_) => {
                 if !self.candidate_impls.contains_key(im.did) {
@@ -454,7 +456,7 @@ fn add_inherent_and_extension_candidates(optional_inherent_methods:
                                              use_assignability: bool) {
 
         // Add inherent methods.
-        alt optional_inherent_methods {
+        match optional_inherent_methods {
             none => {
                 // Continue.
             }
@@ -473,7 +475,7 @@ fn add_inherent_and_extension_candidates(optional_inherent_methods:
         }
 
         // Add trait methods.
-        alt self.fcx.ccx.trait_map.find(self.expr.id) {
+        match self.fcx.ccx.trait_map.find(self.expr.id) {
             none => {
                 // Should only happen for placement new right now.
             }
@@ -484,7 +486,7 @@ fn add_inherent_and_extension_candidates(optional_inherent_methods:
                            self.def_id_to_str(trait_id)};
 
                     let coherence_info = self.fcx.ccx.coherence_info;
-                    alt coherence_info.extension_methods.find(trait_id) {
+                    match coherence_info.extension_methods.find(trait_id) {
                         none => {
                             // Do nothing.
                         }
@@ -523,7 +525,7 @@ fn write_mty_from_candidate(cand: candidate) -> method_map_entry {
         // Make the actual receiver type (cand.self_ty) assignable to the
         // required receiver type (cand.rcvr_ty).  If this method is not
         // from an impl, this'll basically be a no-nop.
-        alt self.fcx.mk_assignty(self.self_expr, self.borrow_lb,
+        match self.fcx.mk_assignty(self.self_expr, self.borrow_lb,
                                  cand.self_ty, cand.rcvr_ty) {
           result::ok(_) => (),
           result::err(_) => {
index 7871e1802ea64273f996806f872a9919bc8dd990..03a27e88c9784cce5bde52cf9ed1edf164e9fe1f 100644 (file)
@@ -104,7 +104,7 @@ fn visit_local(l: @ast::local, &&rcx: @rcx, v: rvt) {
 
 fn visit_pat(p: @ast::pat, &&rcx: @rcx, v: rvt) {
     let fcx = rcx.fcx;
-    alt p.node {
+    match p.node {
       ast::pat_ident(_, path, _)
       if !pat_util::pat_is_variant(fcx.ccx.tcx.def_map, p) => {
         debug!{"visit_pat binding=%s", *path.idents[0]};
@@ -123,14 +123,14 @@ fn visit_block(b: ast::blk, &&rcx: @rcx, v: rvt) {
 fn visit_expr(e: @ast::expr, &&rcx: @rcx, v: rvt) {
     debug!{"visit_expr(e=%s)", pprust::expr_to_str(e)};
 
-    alt e.node {
+    match e.node {
       ast::expr_path(*) => {
         // Avoid checking the use of local variables, as we already
         // check their definitions.  The def'n always encloses the
         // use.  So if the def'n is enclosed by the region, then the
         // uses will also be enclosed (and otherwise, an error will
         // have been reported at the def'n site).
-        alt lookup_def(rcx.fcx, e.span, e.id) {
+        match lookup_def(rcx.fcx, e.span, e.id) {
           ast::def_local(*) | ast::def_arg(*) | ast::def_upvar(*) => return,
           _ => ()
         }
@@ -150,12 +150,12 @@ fn visit_expr(e: @ast::expr, &&rcx: @rcx, v: rvt) {
         // is an extensive comment on the function
         // check_cast_for_escaping_regions() in kind.rs explaining how
         // it goes about doing that.
-        alt rcx.resolve_node_type(e.id) {
+        match rcx.resolve_node_type(e.id) {
           result::err(_) => { return; /* typeck will fail anyhow */ }
           result::ok(target_ty) => {
-            alt ty::get(target_ty).struct {
+            match ty::get(target_ty).struct {
               ty::ty_trait(_, substs) => {
-                let trait_region = alt substs.self_r {
+                let trait_region = match substs.self_r {
                   some(r) => {r}
                   none => {ty::re_static}
                 };
@@ -191,7 +191,7 @@ fn visit_node(id: ast::node_id, span: span, rcx: @rcx) -> bool {
     // Try to resolve the type.  If we encounter an error, then typeck
     // is going to fail anyway, so just stop here and let typeck
     // report errors later on in the writeback phase.
-    let ty = alt rcx.resolve_node_type(id) {
+    let ty = match rcx.resolve_node_type(id) {
       result::err(_) => return true,
       result::ok(ty) => ty
     };
@@ -232,7 +232,7 @@ fn constrain_region(rcx: @rcx,
                ppaux::region_to_str(tcx, encl_region),
                ppaux::region_to_str(tcx, region)};
 
-        alt region {
+        match region {
           ty::re_bound(_) => {
             // a bound region is one which appears inside an fn type.
             // (e.g., the `&` in `fn(&T)`).  Such regions need not be
@@ -243,7 +243,7 @@ fn constrain_region(rcx: @rcx,
           _ => ()
         }
 
-        alt rcx.fcx.mk_subr(encl_region, region) {
+        match rcx.fcx.mk_subr(encl_region, region) {
           result::err(_) => {
             let region1 = rcx.fcx.infcx.resolve_region_if_possible(region);
             tcx.sess.span_err(
index aee2a62d9471f8262020f4c0fd3daead9982ee1c..b9073f97399a04e1ad9d2291dcfc3918a3b8b63d 100644 (file)
@@ -12,7 +12,7 @@ fn replace_bound_regions_in_fn_ty(
 
     // Take self_info apart; the self_ty part is the only one we want
     // to update here.
-    let self_ty = alt self_info {
+    let self_ty = match self_info {
       some(s) => some(s.self_ty),
       none => none
     };
@@ -44,8 +44,8 @@ fn replace_bound_regions_in_fn_ty(
 
 
     // Glue updated self_ty back together with its original node_id.
-    let new_self_info = alt self_info {
-        some(s) => alt check t_self {
+    let new_self_info = match self_info {
+        some(s) => match check t_self {
           some(t) => some({self_ty: t, node_id: s.node_id})
           // this 'none' case shouldn't happen
         }
@@ -54,7 +54,7 @@ fn replace_bound_regions_in_fn_ty(
 
     return {isr: isr,
          self_info: new_self_info,
-         fn_ty: alt check ty::get(t_fn).struct { ty::ty_fn(o) => o }};
+         fn_ty: match check ty::get(t_fn).struct { ty::ty_fn(o) => o }};
 
 
     // Takes `isr`, a (possibly empty) mapping from in-scope region
@@ -82,13 +82,13 @@ fn create_bound_region_mapping(
         fn append_isr(isr: isr_alist,
                       to_r: fn(ty::bound_region) -> ty::region,
                       r: ty::region) -> isr_alist {
-            alt r {
+            match r {
               ty::re_free(_, _) | ty::re_static | ty::re_scope(_) |
               ty::re_var(_) => {
                 isr
               }
               ty::re_bound(br) => {
-                alt isr.find(br) {
+                match isr.find(br) {
                   some(_) => isr,
                   none => @cons((br, to_r(br)), isr)
                 }
@@ -124,14 +124,14 @@ fn replace_bound_regions(
         ty: ty::t) -> ty::t {
 
         do ty::fold_regions(tcx, ty) |r, in_fn| {
-            alt r {
+            match r {
               // As long as we are not within a fn() type, `&T` is
               // mapped to the free region anon_r.  But within a fn
               // type, it remains bound.
               ty::re_bound(ty::br_anon) if in_fn => r,
 
               ty::re_bound(br) => {
-                alt isr.find(br) {
+                match isr.find(br) {
                   // In most cases, all named, bound regions will be
                   // mapped to some free region.
                   some(fr) => fr,
index e1d85828c139d611200e56b357867eee11cbb8b0..ec8e89ef2ada2396acbe6e1529dca9dda556249c 100644 (file)
@@ -6,7 +6,7 @@
 fn has_trait_bounds(tps: ~[ty::param_bounds]) -> bool {
     vec::any(tps, |bs| {
         vec::any(*bs, |b| {
-            alt b { ty::bound_trait(_) => true, _ => false }
+            match b { ty::bound_trait(_) => true, _ => false }
         })
     })
 }
@@ -18,7 +18,7 @@ fn lookup_vtables(fcx: @fn_ctxt, sp: span,
     let mut result = ~[], i = 0u;
     for substs.tps.each |ty| {
         for vec::each(*bounds[i]) |bound| {
-            alt bound {
+            match bound {
               ty::bound_trait(i_ty) => {
                 let i_ty = ty::subst(tcx, substs, i_ty);
                 vec::push(result, lookup_vtable(fcx, sp, ty, i_ty,
@@ -38,7 +38,7 @@ fn fixup_substs(fcx: @fn_ctxt, sp: span,
     // use a dummy type just to package up the substs that need fixing up
     let t = ty::mk_trait(tcx, id, substs);
     let t_f = fixup_ty(fcx, sp, t);
-    alt check ty::get(t_f).struct {
+    match check ty::get(t_f).struct {
       ty::ty_trait(_, substs_f) => substs_f,
     }
 }
@@ -61,21 +61,21 @@ fn lookup_vtable(fcx: @fn_ctxt, sp: span, ty: ty::t, trait_ty: ty::t,
     let _i = indenter();
 
     let tcx = fcx.ccx.tcx;
-    let (trait_id, trait_substs) = alt check ty::get(trait_ty).struct {
+    let (trait_id, trait_substs) = match check ty::get(trait_ty).struct {
       ty::ty_trait(did, substs) => (did, substs)
     };
     let ty = fixup_ty(fcx, sp, ty);
-    alt ty::get(ty).struct {
+    match ty::get(ty).struct {
       ty::ty_param({idx: n, def_id: did}) => {
         let mut n_bound = 0u;
         for vec::each(*tcx.ty_param_bounds.get(did.node)) |bound| {
-            alt bound {
+            match bound {
               ty::bound_send | ty::bound_copy | ty::bound_const |
               ty::bound_owned => {
                 /* ignore */
               }
               ty::bound_trait(ity) => {
-                alt check ty::get(ity).struct {
+                match check ty::get(ity).struct {
                   ty::ty_trait(idid, substs) => {
                     if trait_id == idid {
                         debug!{"(checking vtable) @0 relating ty to trait ty
@@ -118,7 +118,7 @@ fn lookup_vtable(fcx: @fn_ctxt, sp: span, ty: ty::t, trait_ty: ty::t,
 
         let mut impls_seen = new_def_hash();
 
-        alt fcx.ccx.coherence_info.extension_methods.find(trait_id) {
+        match fcx.ccx.coherence_info.extension_methods.find(trait_id) {
             none => {
                 // Nothing found. Continue.
             }
@@ -137,7 +137,7 @@ fn lookup_vtable(fcx: @fn_ctxt, sp: span, ty: ty::t, trait_ty: ty::t,
                     // find the trait that im implements (if any)
                     for vec::each(ty::impl_traits(tcx, im.did)) |of_ty| {
                         // it must have the same id as the expected one
-                        alt ty::get(of_ty).struct {
+                        match ty::get(of_ty).struct {
                           ty::ty_trait(id, _) if id != trait_id => again,
                           _ => { /* ok */ }
                         }
@@ -147,7 +147,7 @@ fn lookup_vtable(fcx: @fn_ctxt, sp: span, ty: ty::t, trait_ty: ty::t,
                         let {substs: substs, ty: for_ty} =
                             impl_self_ty(fcx, im.did);
                         let im_bs = ty::lookup_item_type(tcx, im.did).bounds;
-                        alt fcx.mk_subty(ty, for_ty) {
+                        match fcx.mk_subty(ty, for_ty) {
                           result::err(_) => again,
                           result::ok(()) => ()
                         }
@@ -176,7 +176,7 @@ fn lookup_vtable(fcx: @fn_ctxt, sp: span, ty: ty::t, trait_ty: ty::t,
             }
         }
 
-        alt found.len() {
+        match found.len() {
           0u => { /* fallthrough */ }
           1u => { return found[0]; }
           _ => {
@@ -196,7 +196,7 @@ fn lookup_vtable(fcx: @fn_ctxt, sp: span, ty: ty::t, trait_ty: ty::t,
 
 fn fixup_ty(fcx: @fn_ctxt, sp: span, ty: ty::t) -> ty::t {
     let tcx = fcx.ccx.tcx;
-    alt resolve_type(fcx.infcx, ty, resolve_all | force_all) {
+    match resolve_type(fcx.infcx, ty, resolve_all | force_all) {
       result::ok(new_type) => new_type,
       result::err(e) => {
         tcx.sess.span_fatal(
@@ -217,7 +217,7 @@ fn connect_trait_tps(fcx: @fn_ctxt, sp: span, impl_tys: ~[ty::t],
     let trait_ty = ty::subst_tps(tcx, impl_tys, ity);
     debug!{"(connect trait tps) trait type is %?, impl did is %?",
            ty::get(trait_ty).struct, impl_did};
-    alt check ty::get(trait_ty).struct {
+    match check ty::get(trait_ty).struct {
       ty::ty_trait(_, substs) => {
         vec::iter2(substs.tps, trait_tys,
                    |a, b| demand::suptype(fcx, sp, a, b));
@@ -227,9 +227,9 @@ fn connect_trait_tps(fcx: @fn_ctxt, sp: span, impl_tys: ~[ty::t],
 
 fn resolve_expr(ex: @ast::expr, &&fcx: @fn_ctxt, v: visit::vt<@fn_ctxt>) {
     let cx = fcx.ccx;
-    alt ex.node {
+    match ex.node {
       ast::expr_path(*) => {
-        alt fcx.opt_node_ty_substs(ex.id) {
+        match fcx.opt_node_ty_substs(ex.id) {
           some(substs) => {
             let did = ast_util::def_id_of_def(cx.tcx.def_map.get(ex.id));
             let item_ty = ty::lookup_item_type(cx.tcx, did);
@@ -248,11 +248,11 @@ fn resolve_expr(ex: @ast::expr, &&fcx: @fn_ctxt, v: visit::vt<@fn_ctxt>) {
       ast::expr_field(*) | ast::expr_binary(*) |
       ast::expr_unary(*) | ast::expr_assign_op(*) |
       ast::expr_index(*) => {
-        alt cx.method_map.find(ex.id) {
+        match cx.method_map.find(ex.id) {
           some({origin: method_static(did), _}) => {
             let bounds = ty::lookup_item_type(cx.tcx, did).bounds;
             if has_trait_bounds(*bounds) {
-                let callee_id = alt ex.node {
+                let callee_id = match ex.node {
                   ast::expr_field(_, _, _) => ex.id,
                   _ => ex.callee_id
                 };
@@ -269,7 +269,7 @@ fn resolve_expr(ex: @ast::expr, &&fcx: @fn_ctxt, v: visit::vt<@fn_ctxt>) {
       }
       ast::expr_cast(src, _) => {
         let target_ty = fcx.expr_ty(ex);
-        alt ty::get(target_ty).struct {
+        match ty::get(target_ty).struct {
           ty::ty_trait(*) => {
             /*
             Look up vtables for the type we're casting to,
index bafcfc4855d207e5df4c46a5a4c123e16f5810f1..fc5a376361551bc615f95ffc0112e8a71907223c 100644 (file)
@@ -10,7 +10,7 @@
 fn resolve_type_vars_in_type(fcx: @fn_ctxt, sp: span, typ: ty::t) ->
     option<ty::t> {
     if !ty::type_needs_infer(typ) { return some(typ); }
-    alt resolve_type(fcx.infcx, typ, resolve_all | force_all) {
+    match resolve_type(fcx.infcx, typ, resolve_all | force_all) {
       result::ok(new_type) => return some(new_type),
       result::err(e) => {
         if !fcx.ccx.tcx.sess.has_errors() {
@@ -28,7 +28,7 @@ fn resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span, id: ast::node_id)
     -> option<ty::t> {
     let fcx = wbcx.fcx, tcx = fcx.ccx.tcx;
     let n_ty = fcx.node_ty(id);
-    alt resolve_type_vars_in_type(fcx, sp, n_ty) {
+    match resolve_type_vars_in_type(fcx, sp, n_ty) {
       none => {
         wbcx.success = false;
         return none;
@@ -38,11 +38,11 @@ fn resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span, id: ast::node_id)
         debug!{"resolve_type_vars_for_node(id=%d, n_ty=%s, t=%s)",
                id, ty_to_str(tcx, n_ty), ty_to_str(tcx, t)};
         write_ty_to_tcx(tcx, id, t);
-        alt fcx.opt_node_ty_substs(id) {
+        match fcx.opt_node_ty_substs(id) {
           some(substs) => {
             let mut new_tps = ~[];
             for substs.tps.each |subst| {
-                alt resolve_type_vars_in_type(fcx, sp, subst) {
+                match resolve_type_vars_in_type(fcx, sp, subst) {
                   some(t) => vec::push(new_tps, t),
                   none => { wbcx.success = false; return none; }
                 }
@@ -80,7 +80,7 @@ fn visit_stmt(s: @ast::stmt, wbcx: wb_ctxt, v: wb_vt) {
 fn visit_expr(e: @ast::expr, wbcx: wb_ctxt, v: wb_vt) {
     if !wbcx.success { return; }
     resolve_type_vars_for_node(wbcx, e.span, e.id);
-    alt e.node {
+    match e.node {
       ast::expr_fn(_, decl, _, _) |
       ast::expr_fn_block(decl, _, _) => {
         do vec::iter(decl.inputs) |input| {
@@ -88,7 +88,7 @@ fn visit_expr(e: @ast::expr, wbcx: wb_ctxt, v: wb_vt) {
 
             // Just in case we never constrained the mode to anything,
             // constrain it to the default for the type in question.
-            alt (r_ty, input.mode) {
+            match (r_ty, input.mode) {
               (some(t), ast::infer(_)) => {
                 let tcx = wbcx.fcx.ccx.tcx;
                 let m_def = ty::default_arg_mode_for_ty(t);
@@ -127,7 +127,7 @@ fn visit_local(l: @ast::local, wbcx: wb_ctxt, v: wb_vt) {
     if !wbcx.success { return; }
     let var_id = lookup_local(wbcx.fcx, l.span, l.node.id);
     let var_ty = ty::mk_var(wbcx.fcx.tcx(), var_id);
-    alt resolve_type(wbcx.fcx.infcx, var_ty, resolve_all | force_all) {
+    match resolve_type(wbcx.fcx.infcx, var_ty, resolve_all | force_all) {
       result::ok(lty) => {
         debug!{"Type for local %s (id %d) resolved to %s",
                pat_to_str(l.node.pat), l.node.id,
index 74f9b6c306165fd95ca33d8e28fc8eb818f28c90..c6633efe43f9f2eeb4ae84b394fe272d2c088693 100644 (file)
@@ -40,7 +40,7 @@ fn get_base_type(inference_context: infer_ctxt, span: span, original_type: t)
               -> option<t> {
 
     let resolved_type;
-    alt resolve_type(inference_context,
+    match resolve_type(inference_context,
                      original_type,
                      resolve_ivar) {
         ok(resulting_type) if !type_is_var(resulting_type) => {
@@ -55,7 +55,7 @@ fn get_base_type(inference_context: infer_ctxt, span: span, original_type: t)
         }
     }
 
-    alt get(resolved_type).struct {
+    match get(resolved_type).struct {
         ty_box(base_mutability_and_type) |
         ty_uniq(base_mutability_and_type) |
         ty_ptr(base_mutability_and_type) |
@@ -88,12 +88,12 @@ fn get_base_type_def_id(inference_context: infer_ctxt,
                         original_type: t)
                      -> option<def_id> {
 
-    alt get_base_type(inference_context, span, original_type) {
+    match get_base_type(inference_context, span, original_type) {
         none => {
             return none;
         }
         some(base_type) => {
-            alt get(base_type).struct {
+            match get(base_type).struct {
                 ty_enum(def_id, _) |
                 ty_class(def_id, _) |
                 ty_trait(def_id, _) => {
@@ -160,7 +160,7 @@ fn check_coherence(crate: @crate) {
             visit_item: |item| {
                 debug!{"(checking coherence) item '%s'", *item.ident};
 
-                alt item.node {
+                match item.node {
                     item_impl(_, associated_traits, _, _) => {
                         self.check_implementation(item, associated_traits);
                     }
@@ -203,7 +203,7 @@ fn check_implementation(item: @item, associated_traits: ~[@trait_ref]) {
                     '%s'",
                    *item.ident};
 
-            alt get_base_type_def_id(self.inference_context,
+            match get_base_type_def_id(self.inference_context,
                                      item.span,
                                      self_type.ty) {
                 none => {
@@ -235,7 +235,7 @@ fn check_implementation(item: @item, associated_traits: ~[@trait_ref]) {
         // Add the implementation to the mapping from implementation to base
         // type def ID, if there is a base type for this implementation.
 
-        alt get_base_type_def_id(self.inference_context,
+        match get_base_type_def_id(self.inference_context,
                                  item.span,
                                  self_type.ty) {
             none => {
@@ -253,7 +253,7 @@ fn check_implementation(item: @item, associated_traits: ~[@trait_ref]) {
 
     fn add_inherent_method(base_def_id: def_id, implementation: @Impl) {
         let implementation_list;
-        alt self.crate_context.coherence_info.inherent_methods
+        match self.crate_context.coherence_info.inherent_methods
             .find(base_def_id) {
 
             none => {
@@ -271,7 +271,7 @@ fn add_inherent_method(base_def_id: def_id, implementation: @Impl) {
 
     fn add_trait_method(trait_id: def_id, implementation: @Impl) {
         let implementation_list;
-        alt self.crate_context.coherence_info.extension_methods
+        match self.crate_context.coherence_info.extension_methods
                 .find(trait_id) {
 
             none => {
@@ -363,7 +363,7 @@ fn check_privileged_scopes(crate: @crate) {
 
         visit_crate(*crate, (), mk_vt(@{
             visit_item: |item, _context, visitor| {
-                alt item.node {
+                match item.node {
                     item_mod(module_) => {
                         // First, gather up all privileged types.
                         let privileged_types =
@@ -386,7 +386,9 @@ fn check_privileged_scopes(crate: @crate) {
                         }
                     }
                     item_impl(_, associated_traits, _, _) => {
-                        alt self.base_type_def_ids.find(local_def(item.id)) {
+                        match self.base_type_def_ids.find(
+                            local_def(item.id)) {
+
                             none => {
                                 // Nothing to do.
                             }
@@ -468,7 +470,7 @@ fn check_privileged_scopes(crate: @crate) {
     fn gather_privileged_types(items: ~[@item]) -> @dvec<def_id> {
         let results = @dvec();
         for items.each |item| {
-            alt item.node {
+            match item.node {
                 item_class(*) | item_enum(*) | item_trait(*) => {
                     results.push(local_def(item.id));
                 }
@@ -486,7 +488,7 @@ fn gather_privileged_types(items: ~[@item]) -> @dvec<def_id> {
 
     // Converts an implementation in the AST to an Impl structure.
     fn create_impl_from_item(item: @item) -> @Impl {
-        alt item.node {
+        match item.node {
             item_impl(ty_params, _, _, ast_methods) => {
                 let mut methods = ~[];
                 for ast_methods.each |ast_method| {
@@ -507,7 +509,7 @@ fn create_impl_from_item(item: @item) -> @Impl {
             item_class(ty_params, _, class_members, _, _) => {
                 let mut methods = ~[];
                 for class_members.each |class_member| {
-                    alt class_member.node {
+                    match class_member.node {
                         instance_var(*) => {
                             // Nothing to do.
                         }
@@ -538,7 +540,7 @@ fn create_impl_from_item(item: @item) -> @Impl {
 
     fn span_of_impl(implementation: @Impl) -> span {
         assert implementation.did.crate == local_crate;
-        alt self.crate_context.tcx.items.find(implementation.did.node) {
+        match self.crate_context.tcx.items.find(implementation.did.node) {
             some(node_item(item, _)) => {
                 return item.span;
             }
@@ -562,7 +564,7 @@ fn add_impls_for_module(impls_seen: hashmap<def_id,()>,
         for (*implementations).each |implementation| {
             // Make sure we don't visit the same implementation
             // multiple times.
-            alt impls_seen.find(implementation.did) {
+            match impls_seen.find(implementation.did) {
                 none => {
                     // Good. Continue.
                     impls_seen.insert(implementation.did, ());
@@ -582,7 +584,7 @@ fn add_impls_for_module(impls_seen: hashmap<def_id,()>,
             // types.
 
             if associated_traits.len() == 0 {
-                alt get_base_type_def_id(self.inference_context,
+                match get_base_type_def_id(self.inference_context,
                                          dummy_sp(),
                                          self_type.ty) {
                     none => {
@@ -601,7 +603,7 @@ fn add_impls_for_module(impls_seen: hashmap<def_id,()>,
 
             // Record all the trait methods.
             for associated_traits.each |trait_type| {
-                alt get(trait_type).struct {
+                match get(trait_type).struct {
                     ty_trait(trait_id, _) => {
                         self.add_trait_method(trait_id, implementation);
                     }
@@ -617,7 +619,7 @@ fn add_impls_for_module(impls_seen: hashmap<def_id,()>,
             // implementation to base type def ID, if there is a base
             // type for this implementation.
 
-            alt get_base_type_def_id(self.inference_context,
+            match get_base_type_def_id(self.inference_context,
                                      dummy_sp(),
                                      self_type.ty) {
                 none => {
@@ -645,7 +647,7 @@ fn add_external_crates() {
 
             for each_path(crate_store, crate_number) |path_entry| {
                 let module_def_id;
-                alt path_entry.def_like {
+                match path_entry.def_like {
                     dl_def(def_mod(def_id)) => {
                         module_def_id = def_id;
                     }
index 5a13d1d8efcf03413fbb1fd47ffe9bb77451ad8d..c1211d79a7e4dde5f7cf7a23e4284477e65930fc 100644 (file)
@@ -30,14 +30,14 @@ fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) {
 
     for crate.node.module.items.each |crate_item| {
         if *crate_item.ident == ~"intrinsic" {
-            alt crate_item.node {
+            match crate_item.node {
               ast::item_mod(m) => {
                 for m.items.each |intrinsic_item| {
                     let def_id = { crate: ast::local_crate,
                                   node: intrinsic_item.id };
                     let substs = {self_r: none, self_ty: none, tps: ~[]};
 
-                    alt intrinsic_item.node {
+                    match intrinsic_item.node {
                       ast::item_trait(*) => {
                         let ty = ty::mk_trait(ccx.tcx, def_id, substs);
                         ccx.tcx.intrinsic_defs.insert
@@ -83,7 +83,7 @@ fn get_item_ty(id: ast::def_id) -> ty::ty_param_bounds_and_ty {
         if id.crate != ast::local_crate {
             csearch::get_type(self.tcx, id)
         } else {
-            alt self.tcx.items.find(id.node) {
+            match self.tcx.items.find(id.node) {
               some(ast_map::node_item(item, _)) => {
                 ty_of_item(self, item)
               }
@@ -145,10 +145,10 @@ fn store_methods<T>(ccx: @crate_ctxt, id: ast::node_id,
 
     let tcx = ccx.tcx;
     let rp = tcx.region_paramd_items.contains_key(id);
-    alt check tcx.items.get(id) {
+    match check tcx.items.get(id) {
       ast_map::node_item(@{node: ast::item_trait(_, _, ms), _}, _) => {
         store_methods::<ast::trait_method>(ccx, id, ms, |m| {
-            alt m {
+            match m {
               required(ty_m) => {
                 ty_of_ty_method(ccx, ty_m, rp)
               }
@@ -253,7 +253,7 @@ fn check_methods_against_trait(ccx: @crate_ctxt,
         ensure_trait_methods(ccx, did.node);
     }
     for vec::each(*ty::trait_methods(tcx, did)) |trait_m| {
-        alt vec::find(impl_ms, |impl_m| trait_m.ident == impl_m.mty.ident) {
+        match vec::find(impl_ms, |impl_m| trait_m.ident == impl_m.mty.ident) {
           some({mty: impl_m, id, span}) => {
             if impl_m.purity != trait_m.purity {
                 ccx.tcx.sess.span_err(
@@ -271,13 +271,13 @@ fn check_methods_against_trait(ccx: @crate_ctxt,
               // implementation in the trait itself.  If not, raise a
               // "missing method" error.
 
-              alt tcx.items.get(did.node) {
+              match tcx.items.get(did.node) {
                 ast_map::node_item(
                     @{node: ast::item_trait(_, _, trait_methods), _}, _) => {
                   let (_, provided_methods) =
                       split_trait_methods(trait_methods);
 
-                  alt vec::find(provided_methods, |provided_method|
+                  match vec::find(provided_methods, |provided_method|
                                 provided_method.ident == trait_m.ident) {
                     some(m) => {
                       // If there's a provided method with the name we
@@ -339,7 +339,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
     let tcx = ccx.tcx;
     let rp = tcx.region_paramd_items.contains_key(it.id);
     debug!{"convert: item %s with id %d rp %b", *it.ident, it.id, rp};
-    alt it.node {
+    match it.node {
       // These don't define types.
       ast::item_foreign_mod(_) | ast::item_mod(_) => {}
       ast::item_enum(variants, ty_params) => {
@@ -449,7 +449,7 @@ fn convert_foreign(ccx: @crate_ctxt, i: @ast::foreign_item) {
     // type of the foreign item. We simply write it into the node type
     // table.
     let tpt = ty_of_foreign_item(ccx, i);
-    alt i.node {
+    match i.node {
       ast::foreign_item_fn(_, _) => {
         write_ty_to_tcx(ccx.tcx, i.id, tpt.ty);
         ccx.tcx.tcache.insert(local_def(i.id), tpt);
@@ -494,11 +494,11 @@ fn instantiate_trait_ref(ccx: @crate_ctxt, t: @ast::trait_ref, rp: bool)
 
     let rscope = type_rscope(rp);
 
-    alt lookup_def_tcx(ccx.tcx, t.path.span, t.ref_id) {
+    match lookup_def_tcx(ccx.tcx, t.path.span, t.ref_id) {
       ast::def_ty(t_id) => {
         let tpt = astconv::ast_path_to_ty(ccx, rscope, t_id, t.path,
                                           t.ref_id);
-        alt ty::get(tpt.ty).struct {
+        match ty::get(tpt.ty).struct {
            ty::ty_trait(*) => {
               (t_id, tpt)
            }
@@ -514,12 +514,12 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item)
 
     let def_id = local_def(it.id);
     let tcx = ccx.tcx;
-    alt tcx.tcache.find(def_id) {
+    match tcx.tcache.find(def_id) {
       some(tpt) => return tpt,
       _ => {}
     }
     let rp = tcx.region_paramd_items.contains_key(it.id);
-    alt it.node {
+    match it.node {
       ast::item_const(t, _) => {
         let typ = ccx.to_ty(empty_rscope, t);
         let tpt = no_params(typ);
@@ -539,7 +539,7 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item)
         return tpt;
       }
       ast::item_ty(t, tps) => {
-        alt tcx.tcache.find(local_def(it.id)) {
+        match tcx.tcache.find(local_def(it.id)) {
           some(tpt) => return tpt,
           none => { }
         }
@@ -592,7 +592,7 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item)
 
 fn ty_of_foreign_item(ccx: @crate_ctxt, it: @ast::foreign_item)
     -> ty::ty_param_bounds_and_ty {
-    alt it.node {
+    match it.node {
       ast::foreign_item_fn(fn_decl, params) => {
         return ty_of_foreign_fn_decl(ccx, fn_decl, params,
                                   local_def(it.id));
@@ -605,14 +605,14 @@ fn ty_param_bounds(ccx: @crate_ctxt,
     fn compute_bounds(ccx: @crate_ctxt,
                       param: ast::ty_param) -> ty::param_bounds {
         @do vec::flat_map(*param.bounds) |b| {
-            alt b {
+            match b {
               ast::bound_send => ~[ty::bound_send],
               ast::bound_copy => ~[ty::bound_copy],
               ast::bound_const => ~[ty::bound_const],
               ast::bound_owned => ~[ty::bound_owned],
               ast::bound_trait(t) => {
                 let ity = ast_ty_to_ty(ccx, empty_rscope, t);
-                alt ty::get(ity).struct {
+                match ty::get(ity).struct {
                   ty::ty_trait(*) => {
                     ~[ty::bound_trait(ity)]
                   }
@@ -629,7 +629,7 @@ fn compute_bounds(ccx: @crate_ctxt,
     }
 
     @do params.map |param| {
-        alt ccx.tcx.ty_param_bounds.find(param.id) {
+        match ccx.tcx.ty_param_bounds.find(param.id) {
           some(bs) => bs,
           none => {
             let bounds = compute_bounds(ccx, param);
index d13a18dfcc672e5f645f132830381a1e321d56a7..8c9cbc0759873ea79d9be76467fa4cca518abbde 100644 (file)
@@ -249,8 +249,8 @@ fn single_type_contained_in(tcx: ty::ctxt, a: int_ty_set) ->
 fn convert_integral_ty_to_int_ty_set(tcx: ty::ctxt, t: ty::t)
     -> int_ty_set {
 
-    alt get(t).struct {
-      ty_int(int_ty) => alt int_ty {
+    match get(t).struct {
+      ty_int(int_ty) => match int_ty {
         ast::ty_i8   => int_ty_set(INT_TY_SET_i8),
         ast::ty_i16  => int_ty_set(INT_TY_SET_i16),
         ast::ty_i32  => int_ty_set(INT_TY_SET_i32),
@@ -259,7 +259,7 @@ fn convert_integral_ty_to_int_ty_set(tcx: ty::ctxt, t: ty::t)
         ast::ty_char => tcx.sess.bug(
             ~"char type passed to convert_integral_ty_to_int_ty_set()")
       }
-      ty_uint(uint_ty) => alt uint_ty {
+      ty_uint(uint_ty) => match uint_ty {
         ast::ty_u8  => int_ty_set(INT_TY_SET_u8),
         ast::ty_u16 => int_ty_set(INT_TY_SET_u16),
         ast::ty_u32 => int_ty_set(INT_TY_SET_u32),
@@ -335,7 +335,7 @@ enum fixup_err {
 }
 
 fn fixup_err_to_str(f: fixup_err) -> ~str {
-    alt f {
+    match f {
       unresolved_int_ty(_) => ~"unconstrained integral type",
       unresolved_ty(_) => ~"unconstrained type",
       cyclic_ty(_) => ~"cyclic type of infinite size",
@@ -418,7 +418,7 @@ fn resolve_region(cx: infer_ctxt, r: ty::region, modes: uint)
 
 fn resolve_borrowings(cx: infer_ctxt) {
     for cx.borrowings.each |item| {
-        alt resolve_region(cx, item.scope, resolve_all|force_all) {
+        match resolve_region(cx, item.scope, resolve_all|force_all) {
           ok(region) => {
             debug!{"borrowing for expr %d resolved to region %?, mutbl %?",
                    item.expr_id, region, item.mutbl};
@@ -455,7 +455,7 @@ trait cres_helpers<T> {
 
 impl methods<T:copy> of cres_helpers<T> for cres<T> {
     fn to_ures() -> ures {
-        alt self {
+        match self {
           ok(_v) => ok(()),
           err(e) => err(e)
         }
@@ -496,7 +496,7 @@ fn to_str(cx: infer_ctxt) -> ~str {
 
 impl<V:copy to_str> of to_str for bound<V> {
     fn to_str(cx: infer_ctxt) -> ~str {
-        alt self {
+        match self {
           some(v) => v.to_str(cx),
           none => ~"none"
         }
@@ -513,7 +513,7 @@ fn to_str(cx: infer_ctxt) -> ~str {
 
 impl of to_str for int_ty_set {
     fn to_str(_cx: infer_ctxt) -> ~str {
-        alt self {
+        match self {
           int_ty_set(v) => uint::to_str(v, 10u)
         }
     }
@@ -521,7 +521,7 @@ fn to_str(_cx: infer_ctxt) -> ~str {
 
 impl<V:copy vid, T:copy to_str> of to_str for var_value<V,T> {
     fn to_str(cx: infer_ctxt) -> ~str {
-        alt self {
+        match self {
           redirect(vid) => fmt!{"redirect(%s)", vid.to_str()},
           root(pt, rk) => fmt!{"root(%s, %s)", pt.to_str(cx),
                                uint::to_str(rk, 10u)}
@@ -602,7 +602,7 @@ fn try<T,E>(f: fn() -> result<T,E>) -> result<T,E> {
 
         debug!{"try(tvbl=%u, rbl=%u)", tvbl, rbl};
         let r <- f();
-        alt r {
+        match r {
           result::ok(_) => debug!{"try--ok"},
           result::err(_) => {
             debug!{"try--rollback"};
@@ -681,14 +681,14 @@ fn ty_to_str(t: ty::t) -> ~str {
     }
 
     fn resolve_type_vars_if_possible(typ: ty::t) -> ty::t {
-        alt resolve_type(self, typ, resolve_all) {
+        match resolve_type(self, typ, resolve_all) {
           result::ok(new_type) => return new_type,
           result::err(_) => return typ
         }
     }
 
     fn resolve_region_if_possible(oldr: ty::region) -> ty::region {
-        alt resolve_region(self, oldr, resolve_all) {
+        match resolve_region(self, oldr, resolve_all) {
           result::ok(newr) => return newr,
           result::err(_) => return oldr
         }
@@ -714,12 +714,12 @@ fn get<V:copy vid, T:copy>(
         -> node<V, T> {
 
         let vid_u = vid.to_uint();
-        alt vb.vals.find(vid_u) {
+        match vb.vals.find(vid_u) {
           none => {
             self.tcx.sess.bug(fmt!{"failed lookup of vid `%u`", vid_u});
           }
           some(var_val) => {
-            alt var_val {
+            match var_val {
               redirect(vid) => {
                 let nde = self.get(vb, vid);
                 if nde.root != vid {
@@ -744,7 +744,7 @@ fn merge_bnd<V:copy to_str>(
         debug!{"merge_bnd(%s,%s)", a.to_str(self), b.to_str(self)};
         let _r = indenter();
 
-        alt (a, b) {
+        match (a, b) {
           (none, none) => ok(none),
           (some(_), none) => ok(a),
           (none, some(_)) => ok(b),
@@ -853,10 +853,10 @@ fn vars<V:copy vid, T:copy to_str st>(
 
         // If both A's UB and B's LB have already been bound to types,
         // see if we can make those types subtypes.
-        alt (a_bounds.ub, b_bounds.lb) {
+        match (a_bounds.ub, b_bounds.lb) {
           (some(a_ub), some(b_lb)) => {
             let r = self.try(|| a_ub.sub(self, b_lb));
-            alt r {
+            match r {
               ok(()) => return result::ok(()),
               err(_) => { /*fallthrough */ }
             }
@@ -1022,7 +1022,7 @@ fn bnds<T:copy to_str st>(
 
         debug!{"bnds(%s <: %s)", a.to_str(self), b.to_str(self)};
         do indent {
-            alt (a, b) {
+            match (a, b) {
               (none, none) |
               (some(_), none) |
               (none, some(_)) => {
@@ -1141,7 +1141,7 @@ fn resolve_type_chk(typ: ty::t) -> fres<ty::t> {
         assert vec::is_empty(self.v_seen);
         let rty = indent(|| self.resolve_type(typ) );
         assert vec::is_empty(self.v_seen);
-        alt self.err {
+        match self.err {
           none => {
             debug!{"Resolved to %s (modes=%x)",
                    ty_to_str(self.infcx.tcx, rty),
@@ -1155,7 +1155,7 @@ fn resolve_type_chk(typ: ty::t) -> fres<ty::t> {
     fn resolve_region_chk(orig: ty::region) -> fres<ty::region> {
         self.err = none;
         let resolved = indent(|| self.resolve_region(orig) );
-        alt self.err {
+        match self.err {
           none => ok(resolved),
           some(e) => err(e)
         }
@@ -1166,7 +1166,7 @@ fn resolve_type(typ: ty::t) -> ty::t {
         indent(fn&() -> ty::t {
             if !ty::type_needs_infer(typ) { return typ; }
 
-            alt ty::get(typ).struct {
+            match ty::get(typ).struct {
               ty::ty_var(vid) => {
                 self.resolve_ty_var(vid)
               }
@@ -1201,7 +1201,7 @@ fn resolve_nested_tvar(typ: ty::t) -> ty::t {
 
     fn resolve_region(orig: ty::region) -> ty::region {
         debug!{"Resolve_region(%s)", orig.to_str(self.infcx)};
-        alt orig {
+        match orig {
           ty::re_var(rid) => self.resolve_region_var(rid),
           _ => orig
         }
@@ -1213,7 +1213,7 @@ fn resolve_region_var(rid: region_vid) -> ty::region {
         }
         let nde = self.infcx.get(self.infcx.rb, rid);
         let bounds = nde.possible_types;
-        alt bounds {
+        match bounds {
           { ub:_, lb:some(r) } => { self.assert_not_rvar(rid, r); r }
           { ub:some(r), lb:_ } => { self.assert_not_rvar(rid, r); r }
           { ub:none, lb:none } => {
@@ -1226,7 +1226,7 @@ fn resolve_region_var(rid: region_vid) -> ty::region {
     }
 
     fn assert_not_rvar(rid: region_vid, r: ty::region) {
-        alt r {
+        match r {
           ty::re_var(rid2) => {
             self.err = some(region_var_bound_by_region_var(rid, rid2));
           }
@@ -1251,7 +1251,7 @@ fn resolve_ty_var(vid: tv_vid) -> ty::t {
             let nde = self.infcx.get(self.infcx.tvb, vid);
             let bounds = nde.possible_types;
 
-            let t1 = alt bounds {
+            let t1 = match bounds {
               { ub:_, lb:some(t) } if !type_is_bot(t) => self.resolve_type(t),
               { ub:some(t), lb:_ } => self.resolve_type(t),
               { ub:_, lb:some(t) } => self.resolve_type(t),
@@ -1277,7 +1277,7 @@ fn resolve_ty_var_integral(vid: tvi_vid) -> ty::t {
 
         // If there's only one type in the set of possible types, then
         // that's the answer.
-        alt single_type_contained_in(self.infcx.tcx, pt) {
+        match single_type_contained_in(self.infcx.tcx, pt) {
           some(t) => t,
           none => {
             if self.should(force_ivar) {
@@ -1351,9 +1351,9 @@ impl assignment for infer_ctxt {
     fn assign_tys(anmnt: assignment, a: ty::t, b: ty::t) -> ures {
 
         fn select(fst: option<ty::t>, snd: option<ty::t>) -> option<ty::t> {
-            alt fst {
+            match fst {
               some(t) => some(t),
-              none => alt snd {
+              none => match snd {
                 some(t) => some(t),
                 none => none
               }
@@ -1364,7 +1364,7 @@ fn select(fst: option<ty::t>, snd: option<ty::t>) -> option<ty::t> {
                anmnt, a.to_str(self), b.to_str(self)};
         let _r = indenter();
 
-        alt (ty::get(a).struct, ty::get(b).struct) {
+        match (ty::get(a).struct, ty::get(b).struct) {
           (ty::ty_bot, _) => {
             uok()
           }
@@ -1413,15 +1413,15 @@ fn assign_tys_or_sub(
         let _r = indenter();
 
         fn is_borrowable(v: ty::vstore) -> bool {
-            alt v {
+            match v {
               ty::vstore_fixed(_) | ty::vstore_uniq | ty::vstore_box => true,
               ty::vstore_slice(_) => false
             }
         }
 
-        alt (a_bnd, b_bnd) {
+        match (a_bnd, b_bnd) {
           (some(a_bnd), some(b_bnd)) => {
-            alt (ty::get(a_bnd).struct, ty::get(b_bnd).struct) {
+            match (ty::get(a_bnd).struct, ty::get(b_bnd).struct) {
               (ty::ty_box(mt_a), ty::ty_rptr(r_b, mt_b)) => {
                 let nr_b = ty::mk_box(self.tcx, {ty: mt_b.ty,
                                                  mutbl: m_const});
@@ -1569,7 +1569,7 @@ fn super_substs<C:combine>(
     fn eq_opt_regions(infcx: infer_ctxt,
                       a: option<ty::region>,
                       b: option<ty::region>) -> cres<option<ty::region>> {
-        alt (a, b) {
+        match (a, b) {
           (none, none) => {
             ok(none)
           }
@@ -1625,7 +1625,7 @@ fn super_self_tys<C:combine>(
     // Note: the self type parameter is (currently) always treated as
     // *invariant* (otherwise the type system would be unsound).
 
-    alt (a, b) {
+    match (a, b) {
       (none, none) => {
         ok(none)
       }
@@ -1677,7 +1677,7 @@ fn super_vstores<C:combine>(
     self: C, vk: ty::terr_vstore_kind,
     a: ty::vstore, b: ty::vstore) -> cres<ty::vstore> {
 
-    alt (a, b) {
+    match (a, b) {
       (ty::vstore_slice(a_r), ty::vstore_slice(b_r)) => {
         do self.contraregions(a_r, b_r).chain |r| {
             ok(ty::vstore_slice(r))
@@ -1732,7 +1732,7 @@ fn super_tys<C:combine>(
     self: C, a: ty::t, b: ty::t) -> cres<ty::t> {
 
     let tcx = self.infcx().tcx;
-    alt (ty::get(a).struct, ty::get(b).struct) {
+    match (ty::get(a).struct, ty::get(b).struct) {
       // The "subtype" ought to be handling cases involving bot or var:
       (ty::ty_bot, _) |
       (_, ty::ty_bot) |
@@ -1897,7 +1897,7 @@ fn regions(a: ty::region, b: ty::region) -> cres<ty::region> {
                a.to_str(self.infcx()),
                b.to_str(self.infcx())};
         do indent {
-            alt (a, b) {
+            match (a, b) {
               (ty::re_var(a_id), ty::re_var(b_id)) => {
                 do self.infcx().vars(self.rb, a_id, b_id).then {
                     ok(a)
@@ -1929,7 +1929,7 @@ fn mts(a: ty::mt, b: ty::mt) -> cres<ty::mt> {
             return err(ty::terr_mutability);
         }
 
-        alt b.mutbl {
+        match b.mutbl {
           m_mutbl => {
             // If supertype is mut, subtype must match exactly
             // (i.e., invariant if mut):
@@ -1965,7 +1965,7 @@ fn tys(a: ty::t, b: ty::t) -> cres<ty::t> {
                a.to_str(*self), b.to_str(*self)};
         if a == b { return ok(a); }
         do indent {
-            alt (ty::get(a).struct, ty::get(b).struct) {
+            match (ty::get(a).struct, ty::get(b).struct) {
               (ty::ty_bot, _) => {
                 ok(a)
               }
@@ -2077,7 +2077,7 @@ fn mts(a: ty::mt, b: ty::mt) -> cres<ty::mt> {
             m_const
         };
 
-        alt m {
+        match m {
           m_imm | m_const => {
             self.tys(a.ty, b.ty).chain(|t| ok({ty: t, mutbl: m}) )
           }
@@ -2113,7 +2113,7 @@ fn protos(p1: ast::proto, p2: ast::proto) -> cres<ast::proto> {
     }
 
     fn purities(f1: purity, f2: purity) -> cres<purity> {
-        alt (f1, f2) {
+        match (f1, f2) {
           (unsafe_fn, _) | (_, unsafe_fn) => ok(unsafe_fn),
           (impure_fn, _) | (_, impure_fn) => ok(impure_fn),
           (extern_fn, _) | (_, extern_fn) => ok(extern_fn),
@@ -2122,7 +2122,7 @@ fn purities(f1: purity, f2: purity) -> cres<purity> {
     }
 
     fn ret_styles(r1: ret_style, r2: ret_style) -> cres<ret_style> {
-        alt (r1, r2) {
+        match (r1, r2) {
           (ast::return_val, _) |
           (_, ast::return_val) => ok(ast::return_val),
           (ast::noreturn, ast::noreturn) => ok(ast::noreturn)
@@ -2140,7 +2140,7 @@ fn regions(a: ty::region, b: ty::region) -> cres<ty::region> {
                b.to_str(self.infcx())};
 
         do indent {
-            alt (a, b) {
+            match (a, b) {
               (ty::re_static, _) | (_, ty::re_static) => {
                 ok(ty::re_static) // nothing lives longer than static
               }
@@ -2155,7 +2155,7 @@ fn regions(a: ty::region, b: ty::region) -> cres<ty::region> {
                 // at least as big as the block f_id".  So, we can
                 // reasonably compare free regions and scopes:
                 let rm = self.infcx().tcx.region_map;
-                alt region::nearest_common_ancestor(rm, f_id, s_id) {
+                match region::nearest_common_ancestor(rm, f_id, s_id) {
                   // if the free region's scope `f_id` is bigger than
                   // the scope region `s_id`, then the LUB is the free
                   // region itself:
@@ -2172,7 +2172,7 @@ fn regions(a: ty::region, b: ty::region) -> cres<ty::region> {
                 // subtype of the region corresponding to an inner
                 // block.
                 let rm = self.infcx().tcx.region_map;
-                alt region::nearest_common_ancestor(rm, a_id, b_id) {
+                match region::nearest_common_ancestor(rm, a_id, b_id) {
                   some(r_id) => ok(ty::re_scope(r_id)),
                   _ => ok(ty::re_static)
                 }
@@ -2248,7 +2248,7 @@ fn mts(a: ty::mt, b: ty::mt) -> cres<ty::mt> {
                mt_to_str(tcx, a),
                mt_to_str(tcx, b)};
 
-        alt (a.mutbl, b.mutbl) {
+        match (a.mutbl, b.mutbl) {
           // If one side or both is mut, then the GLB must use
           // the precise type from the mut side.
           (m_mutbl, m_const) => {
@@ -2310,7 +2310,7 @@ fn protos(p1: ast::proto, p2: ast::proto) -> cres<ast::proto> {
     }
 
     fn purities(f1: purity, f2: purity) -> cres<purity> {
-        alt (f1, f2) {
+        match (f1, f2) {
           (pure_fn, _) | (_, pure_fn) => ok(pure_fn),
           (extern_fn, _) | (_, extern_fn) => ok(extern_fn),
           (impure_fn, _) | (_, impure_fn) => ok(impure_fn),
@@ -2319,7 +2319,7 @@ fn purities(f1: purity, f2: purity) -> cres<purity> {
     }
 
     fn ret_styles(r1: ret_style, r2: ret_style) -> cres<ret_style> {
-        alt (r1, r2) {
+        match (r1, r2) {
           (ast::return_val, ast::return_val) => {
             ok(ast::return_val)
           }
@@ -2337,7 +2337,7 @@ fn regions(a: ty::region, b: ty::region) -> cres<ty::region> {
                b.to_str(self.infcx())};
 
         do indent {
-            alt (a, b) {
+            match (a, b) {
               (ty::re_static, r) | (r, ty::re_static) => {
                 // static lives longer than everything else
                 ok(r)
@@ -2355,7 +2355,7 @@ fn regions(a: ty::region, b: ty::region) -> cres<ty::region> {
                 // is the scope `s_id`.  Otherwise, as we do not know
                 // big the free region is precisely, the GLB is undefined.
                 let rm = self.infcx().tcx.region_map;
-                alt region::nearest_common_ancestor(rm, f_id, s_id) {
+                match region::nearest_common_ancestor(rm, f_id, s_id) {
                   some(r_id) if r_id == f_id => ok(s),
                   _ => err(ty::terr_regions_differ(b, a))
                 }
@@ -2367,7 +2367,7 @@ fn regions(a: ty::region, b: ty::region) -> cres<ty::region> {
                 // these: so, if one of these scopes is a subscope of the
                 // other, return it.  Otherwise fail.
                 let rm = self.infcx().tcx.region_map;
-                alt region::nearest_common_ancestor(rm, a_id, b_id) {
+                match region::nearest_common_ancestor(rm, a_id, b_id) {
                   some(r_id) if a_id == r_id => ok(b),
                   some(r_id) if b_id == r_id => ok(a),
                   _ => err(ty::terr_regions_differ(b, a))
@@ -2475,7 +2475,7 @@ fn lattice_tys<L:lattice_ops combine>(
            b.to_str(self.infcx())};
     if a == b { return ok(a); }
     do indent {
-        alt (ty::get(a).struct, ty::get(b).struct) {
+        match (ty::get(a).struct, ty::get(b).struct) {
           (ty::ty_bot, _) => self.ty_bot(b),
           (_, ty::ty_bot) => self.ty_bot(a),
 
@@ -2505,7 +2505,7 @@ fn lattice_tys<L:lattice_ops combine>(
 fn lattice_rvars<L:lattice_ops combine>(
     self: L, a: ty::region, b: ty::region) -> cres<ty::region> {
 
-    alt (a, b) {
+    match (a, b) {
       (ty::re_var(a_id), ty::re_var(b_id)) => {
         lattice_vars(self, self.infcx().rb,
                      a, a_id, b_id,
@@ -2558,9 +2558,9 @@ fn lattice_vars<V:copy vid, T:copy to_str st, L:lattice_ops combine>(
     // If both A and B have an UB type, then we can just compute the
     // LUB of those types:
     let a_bnd = self.bnd(a_bounds), b_bnd = self.bnd(b_bounds);
-    alt (a_bnd, b_bnd) {
+    match (a_bnd, b_bnd) {
       (some(a_ty), some(b_ty)) => {
-        alt self.infcx().try(|| c_ts(a_ty, b_ty) ) {
+        match self.infcx().try(|| c_ts(a_ty, b_ty) ) {
             ok(t) => return ok(t),
             err(_) => { /*fallthrough */ }
         }
@@ -2590,7 +2590,7 @@ fn lattice_var_t<V:copy vid, T:copy to_str st, L:lattice_ops combine>(
            a_id.to_str(), a_bounds.to_str(self.infcx()),
            b.to_str(self.infcx())};
 
-    alt self.bnd(a_bounds) {
+    match self.bnd(a_bounds) {
       some(a_bnd) => {
         // If a has an upper bound, return the LUB(a.ub, b)
         debug!{"bnd=some(%s)", a_bnd.to_str(self.infcx())};
index d471ba677b550e6091c3ba6b4343b9359c2cfc88..906f3b7bdb3ec557056d95e798a6d6b68d436c51 100644 (file)
@@ -42,7 +42,7 @@ fn loop_query(b: ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
     let visit_expr =
         |e: @ast::expr, &&flag: @mut bool, v: visit::vt<@mut bool>| {
         *flag |= p(e.node);
-        alt e.node {
+        match e.node {
           // Skip inner loops, since a break in the inner loop isn't a
           // break inside the outer loop
           ast::expr_loop(*) | ast::expr_while(*)
@@ -58,7 +58,7 @@ fn loop_query(b: ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
 
 fn has_nonlocal_exits(b: ast::blk) -> bool {
     do loop_query(b) |e| {
-        alt e {
+        match e {
           ast::expr_break | ast::expr_again => true,
           _ => false
         }
@@ -67,7 +67,7 @@ fn has_nonlocal_exits(b: ast::blk) -> bool {
 
 fn may_break(b: ast::blk) -> bool {
     do loop_query(b) |e| {
-        alt e {
+        match e {
           ast::expr_break => true,
           _ => false
         }
@@ -75,7 +75,7 @@ fn may_break(b: ast::blk) -> bool {
 }
 
 fn local_rhs_span(l: @ast::local, def: span) -> span {
-    alt l.node.init {
+    match l.node.init {
       some(i) => return i.expr.span,
       _ => return def
     }
index 571da9db0699de8f2942e04aa9f103ad34026659..1f180bfb76428fa9227cbec1ba4b510eee99a64f 100644 (file)
 /// that attempts to explain a lifetime in a way it might plausibly be
 /// understood.
 fn explain_region(cx: ctxt, region: ty::region) -> ~str {
-    return alt region {
+    return match region {
       re_scope(node_id) => {
-        let scope_str = alt cx.items.find(node_id) {
+        let scope_str = match cx.items.find(node_id) {
           some(ast_map::node_block(blk)) => {
             explain_span(cx, ~"block", blk.span)
           }
           some(ast_map::node_expr(expr)) => {
-            alt expr.node {
+            match expr.node {
               ast::expr_call(*) => { explain_span(cx, ~"call", expr.span) }
               ast::expr_alt(*) => { explain_span(cx, ~"alt", expr.span) }
               _ => { explain_span(cx, ~"expression", expr.span) }
@@ -47,7 +47,7 @@ fn explain_region(cx: ctxt, region: ty::region) -> ~str {
       }
 
       re_free(id, br) => {
-        alt cx.items.find(id) {
+        match cx.items.find(id) {
           some(ast_map::node_block(blk)) => {
             fmt!{"reference with lifetime %s as defined on %s",
                  bound_region_to_str(cx, br),
@@ -76,7 +76,7 @@ fn explain_span(cx: ctxt, heading: ~str, span: span) -> ~str {
 }
 
 fn bound_region_to_str(cx: ctxt, br: bound_region) -> ~str {
-    alt br {
+    match br {
       br_anon                        => { ~"&" }
       br_named(str)                  => { fmt!{"&%s", *str} }
       br_self if cx.sess.ppregions() => { ~"&<self>" }
@@ -95,13 +95,13 @@ fn bound_region_to_str(cx: ctxt, br: bound_region) -> ~str {
 }
 
 fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
-    alt cx.items.find(node_id) {
+    match cx.items.find(node_id) {
       some(ast_map::node_block(blk)) => {
         fmt!{"<block at %s>",
              codemap::span_to_str(blk.span, cx.sess.codemap)}
       }
       some(ast_map::node_expr(expr)) => {
-        alt expr.node {
+        match expr.node {
           ast::expr_call(*) => {
             fmt!{"<call at %s>",
                  codemap::span_to_str(expr.span, cx.sess.codemap)}
@@ -134,7 +134,7 @@ fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
 }
 
 fn region_to_str(cx: ctxt, region: region) -> ~str {
-    alt region {
+    match region {
       re_scope(node_id) => {
         if cx.sess.ppregions() {
             fmt!{"&%s", re_scope_id_to_str(cx, node_id)}
@@ -162,7 +162,7 @@ fn region_to_str(cx: ctxt, region: region) -> ~str {
 }
 
 fn mt_to_str(cx: ctxt, m: mt) -> ~str {
-    let mstr = alt m.mutbl {
+    let mstr = match m.mutbl {
       ast::m_mutbl => ~"mut ",
       ast::m_imm => ~"",
       ast::m_const => ~"const "
@@ -171,7 +171,7 @@ fn mt_to_str(cx: ctxt, m: mt) -> ~str {
 }
 
 fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
-    alt vs {
+    match vs {
       ty::vstore_fixed(n) => fmt!{"%u", n},
       ty::vstore_uniq => ~"~",
       ty::vstore_box => ~"@",
@@ -180,7 +180,7 @@ fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
 }
 
 fn vstore_ty_to_str(cx: ctxt, ty: ~str, vs: ty::vstore) -> ~str {
-    alt vs {
+    match vs {
       ty::vstore_fixed(_) => {
         fmt!{"%s/%s", ty, vstore_to_str(cx, vs)}
       }
@@ -198,7 +198,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str {
     fn fn_input_to_str(cx: ctxt, input: {mode: ast::mode, ty: t}) ->
        ~str {
         let {mode, ty} = input;
-        let modestr = alt canon_mode(cx, mode) {
+        let modestr = match canon_mode(cx, mode) {
           ast::infer(_) => ~"",
           ast::expl(m) => {
             if !ty::type_needs_infer(ty) &&
@@ -216,12 +216,12 @@ fn fn_to_str(cx: ctxt, purity: ast::purity, proto: ast::proto,
                  inputs: ~[arg], output: t, cf: ast::ret_style) -> ~str {
         let mut s;
 
-        s = alt purity {
+        s = match purity {
           ast::impure_fn => ~"",
           _ => purity_to_str(purity) + ~" "
         };
         s += proto_to_str(proto);
-        alt ident {
+        match ident {
           some(i) => { s += ~" "; s += *i; }
           _ => { }
         }
@@ -232,7 +232,7 @@ fn fn_to_str(cx: ctxt, purity: ast::purity, proto: ast::proto,
         s += ~")";
         if ty::get(output).struct != ty_nil {
             s += ~" -> ";
-            alt cf {
+            match cf {
               ast::noreturn => { s += ~"!"; }
               ast::return_val => { s += ty_to_str(cx, output); }
             }
@@ -255,7 +255,7 @@ fn field_to_str(cx: ctxt, f: field) -> ~str {
     }
 
     // pretty print the structural type representation:
-    return alt ty::get(typ).struct {
+    return match ty::get(typ).struct {
       ty_nil => ~"()",
       ty_bot => ~"_|_",
       ty_bool => ~"bool",
@@ -325,7 +325,7 @@ fn parameterized(cx: ctxt,
                  self_r: option<ty::region>,
                  tps: ~[ty::t]) -> ~str {
 
-    let r_str = alt self_r {
+    let r_str = match self_r {
       none => ~"",
       some(r) => {
         fmt!{"/%s", region_to_str(cx, r)}
index 58341e2152ddb6f7dd2edceb4bdab7ef011b08b5..655587b165d264d0b328df980cf9a10d59d8aee1 100644 (file)
@@ -77,7 +77,7 @@ fn act(po: comm::port<msg>, source: ~str, parse: parser) {
 
     let mut keep_going = true;
     while keep_going {
-        alt comm::recv(po) {
+        match comm::recv(po) {
           handle_request(f) => {
             f(ctxt);
           }
index ba633111a6a01adcbe95cf7d41e7837644770973..c590a1ac61ecfacc0e7e9ea6593659752a75fab4 100644 (file)
@@ -93,7 +93,7 @@ fn should_not_extract_crate_name_if_no_name_value_in_link_attribute() {
 }
 
 fn parse_desc(attrs: ~[ast::attribute]) -> option<~str> {
-    alt doc_meta(attrs) {
+    match doc_meta(attrs) {
       some(meta) => {
         attr::get_meta_item_value_str(meta).map(|x| *x )
       }
@@ -118,9 +118,9 @@ fn parse_desc_should_parse_simple_doc_attributes() {
 }
 
 fn parse_hidden(attrs: ~[ast::attribute]) -> bool {
-    alt doc_meta(attrs) {
+    match doc_meta(attrs) {
       some(meta) => {
-        alt attr::get_meta_item_list(meta) {
+        match attr::get_meta_item_list(meta) {
           some(metas) => {
             let hiddens = attr::find_meta_items_by_name(metas, ~"hidden");
             vec::is_not_empty(hiddens)
index 9c55ebc4a95e06d0451f7c46beca073cfb30827f..0a404ce1f51cea82033bd86e761cc376124c6545 100644 (file)
@@ -93,7 +93,7 @@ fn parse_item_attrs<T:send>(
     id: doc::ast_id,
     +parse_attrs: fn~(~[ast::attribute]) -> T) -> T {
     do astsrv::exec(srv) |ctxt| {
-        let attrs = alt ctxt.ast_map.get(id) {
+        let attrs = match ctxt.ast_map.get(id) {
           ast_map::node_item(item, _) => item.attrs,
           ast_map::node_foreign_item(item, _, _) => item.attrs,
           _ => fail ~"parse_item_attrs: not an item"
@@ -144,7 +144,7 @@ fn fold_enum(
     {
         variants: do par::map(doc.variants) |variant| {
             let desc = do astsrv::exec(srv) |ctxt| {
-                alt check ctxt.ast_map.get(doc_id) {
+                match check ctxt.ast_map.get(doc_id) {
                   ast_map::node_item(@{
                     node: ast::item_enum(ast_variants, _), _
                   }, _) => {
@@ -201,12 +201,12 @@ fn merge_method_attrs(
 
     // Create an assoc list from method name to attributes
     let attrs: ~[(~str, option<~str>)] = do astsrv::exec(srv) |ctxt| {
-        alt ctxt.ast_map.get(item_id) {
+        match ctxt.ast_map.get(item_id) {
           ast_map::node_item(@{
             node: ast::item_trait(_, _, methods), _
           }, _) => {
             vec::map(methods, |method| {
-                alt method {
+                match method {
                   ast::required(ty_m) => {
                     (*ty_m.ident, attr_parser::parse_desc(ty_m.attrs))
                   }
index 398892d715f0d101abc105b0485c03dc0dd409df..9a03a3e44558c115758ee6024f73ba341a9744f8 100644 (file)
@@ -100,7 +100,7 @@ fn parse_config_(
 ) -> result<config, ~str> {
     let args = vec::tail(args);
     let opts = vec::unzip(opts()).first();
-    alt getopts::getopts(args, opts) {
+    match getopts::getopts(args, opts) {
         result::ok(matches) => {
             if vec::len(matches.free) == 1u {
                 let input_crate = vec::head(matches.free);
@@ -176,7 +176,7 @@ fn config_from_opts(
 }
 
 fn parse_output_format(output_format: ~str) -> result<output_format, ~str> {
-    alt output_format {
+    match output_format {
       ~"markdown" => result::ok(markdown),
       ~"html" => result::ok(pandoc_html),
       _ => result::err(fmt!{"unknown output format '%s'", output_format})
@@ -184,7 +184,7 @@ fn parse_output_format(output_format: ~str) -> result<output_format, ~str> {
 }
 
 fn parse_output_style(output_style: ~str) -> result<output_style, ~str> {
-    alt output_style {
+    match output_style {
       ~"doc-per-crate" => result::ok(doc_per_crate),
       ~"doc-per-mod" => result::ok(doc_per_mod),
       _ => result::err(fmt!{"unknown output style '%s'", output_style})
@@ -200,10 +200,10 @@ fn maybe_find_pandoc(
         return result::ok(maybe_pandoc_cmd);
     }
 
-    let possible_pandocs = alt maybe_pandoc_cmd {
+    let possible_pandocs = match maybe_pandoc_cmd {
       some(pandoc_cmd) => ~[pandoc_cmd],
       none => {
-        ~[~"pandoc"] + alt os::homedir() {
+        ~[~"pandoc"] + match os::homedir() {
           some(dir) => {
             ~[path::connect(dir, ~".cabal/bin/pandoc")]
           }
index 76c74c71ef4ff362b0f6873e42ca68055d8741f1..661eb3f879ec2723d95423624f2c26d795a9a5bb 100644 (file)
@@ -104,7 +104,7 @@ fn parse_desc(desc: ~str) -> option<~str> {
 
     const max_brief_len: uint = 120u;
 
-    alt first_sentence(desc) {
+    match first_sentence(desc) {
       some(first_sentence) => {
         if str::len(first_sentence) <= max_brief_len {
             some(first_sentence)
@@ -143,7 +143,7 @@ fn first_sentence_(s: ~str) -> ~str {
             }
         }
     };
-    alt idx {
+    match idx {
       some(idx) if idx > 2u => {
         str::slice(s, 0u, idx - 1u)
       }
index 723bcff5fb04c9626a00c901348a025fa9a555ba..6fb1faa44832aecd4df0e7500f411d128fe86b5f 100644 (file)
@@ -141,7 +141,7 @@ enum moddoc {
 impl util for doc {
     fn cratedoc() -> cratedoc {
         option::get(vec::foldl(none, self.pages, |_m, page| {
-            alt page {
+            match page {
               doc::cratepage(doc) => some(doc),
               _ => none
             }
@@ -158,7 +158,7 @@ impl util for moddoc {
 
     fn mods() -> ~[moddoc] {
         do vec::filter_map(self.items) |itemtag| {
-            alt itemtag {
+            match itemtag {
               modtag(moddoc) => some(moddoc),
               _ => none
             }
@@ -167,7 +167,7 @@ fn mods() -> ~[moddoc] {
 
     fn nmods() -> ~[nmoddoc] {
         do vec::filter_map(self.items) |itemtag| {
-            alt itemtag {
+            match itemtag {
               nmodtag(nmoddoc) => some(nmoddoc),
               _ => none
             }
@@ -176,7 +176,7 @@ fn nmods() -> ~[nmoddoc] {
 
     fn fns() -> ~[fndoc] {
         do vec::filter_map(self.items) |itemtag| {
-            alt itemtag {
+            match itemtag {
               fntag(fndoc) => some(fndoc),
               _ => none
             }
@@ -185,7 +185,7 @@ fn fns() -> ~[fndoc] {
 
     fn consts() -> ~[constdoc] {
         do vec::filter_map(self.items) |itemtag| {
-            alt itemtag {
+            match itemtag {
               consttag(constdoc) => some(constdoc),
               _ => none
             }
@@ -194,7 +194,7 @@ fn consts() -> ~[constdoc] {
 
     fn enums() -> ~[enumdoc] {
         do vec::filter_map(self.items) |itemtag| {
-            alt itemtag {
+            match itemtag {
               enumtag(enumdoc) => some(enumdoc),
               _ => none
             }
@@ -203,7 +203,7 @@ fn enums() -> ~[enumdoc] {
 
     fn traits() -> ~[traitdoc] {
         do vec::filter_map(self.items) |itemtag| {
-            alt itemtag {
+            match itemtag {
               traittag(traitdoc) => some(traitdoc),
               _ => none
             }
@@ -212,7 +212,7 @@ fn traits() -> ~[traitdoc] {
 
     fn impls() -> ~[impldoc] {
         do vec::filter_map(self.items) |itemtag| {
-            alt itemtag {
+            match itemtag {
               impltag(impldoc) => some(impldoc),
               _ => none
             }
@@ -221,7 +221,7 @@ fn impls() -> ~[impldoc] {
 
     fn types() -> ~[tydoc] {
         do vec::filter_map(self.items) |itemtag| {
-            alt itemtag {
+            match itemtag {
               tytag(tydoc) => some(tydoc),
               _ => none
             }
@@ -244,7 +244,7 @@ impl util of page_utils for ~[page] {
 
     fn mods() -> ~[moddoc] {
         do vec::filter_map(self) |page| {
-            alt page {
+            match page {
               itempage(modtag(moddoc)) => some(moddoc),
               _ => none
             }
@@ -253,7 +253,7 @@ fn mods() -> ~[moddoc] {
 
     fn nmods() -> ~[nmoddoc] {
         do vec::filter_map(self) |page| {
-            alt page {
+            match page {
               itempage(nmodtag(nmoddoc)) => some(nmoddoc),
               _ => none
             }
@@ -262,7 +262,7 @@ fn nmods() -> ~[nmoddoc] {
 
     fn fns() -> ~[fndoc] {
         do vec::filter_map(self) |page| {
-            alt page {
+            match page {
               itempage(fntag(fndoc)) => some(fndoc),
               _ => none
             }
@@ -271,7 +271,7 @@ fn fns() -> ~[fndoc] {
 
     fn consts() -> ~[constdoc] {
         do vec::filter_map(self) |page| {
-            alt page {
+            match page {
               itempage(consttag(constdoc)) => some(constdoc),
               _ => none
             }
@@ -280,7 +280,7 @@ fn consts() -> ~[constdoc] {
 
     fn enums() -> ~[enumdoc] {
         do vec::filter_map(self) |page| {
-            alt page {
+            match page {
               itempage(enumtag(enumdoc)) => some(enumdoc),
               _ => none
             }
@@ -289,7 +289,7 @@ fn enums() -> ~[enumdoc] {
 
     fn traits() -> ~[traitdoc] {
         do vec::filter_map(self) |page| {
-            alt page {
+            match page {
               itempage(traittag(traitdoc)) => some(traitdoc),
               _ => none
             }
@@ -298,7 +298,7 @@ fn traits() -> ~[traitdoc] {
 
     fn impls() -> ~[impldoc] {
         do vec::filter_map(self) |page| {
-            alt page {
+            match page {
               itempage(impltag(impldoc)) => some(impldoc),
               _ => none
             }
@@ -307,7 +307,7 @@ fn impls() -> ~[impldoc] {
 
     fn types() -> ~[tydoc] {
         do vec::filter_map(self) |page| {
-            alt page {
+            match page {
               itempage(tytag(tydoc)) => some(tydoc),
               _ => none
             }
@@ -321,7 +321,7 @@ trait item {
 
 impl of item for itemtag {
     pure fn item() -> itemdoc {
-        alt self {
+        match self {
           doc::modtag(doc) => doc.item,
           doc::nmodtag(doc) => doc.item,
           doc::fntag(doc) => doc.item,
index 7d56efcc4ee80bdc3be129e22fc0d44470ac2e65..b8be338bffd4bc62b7785bd7bcd71069dab21e73 100644 (file)
@@ -58,7 +58,7 @@ fn moddoc_from_mod(
         item: itemdoc,
         items: do vec::filter_map(module_.items) |item| {
             let itemdoc = mk_itemdoc(item.id, item.ident);
-            alt item.node {
+            match item.node {
               ast::item_mod(m) => {
                 some(doc::modtag(
                     moddoc_from_mod(itemdoc, m)
@@ -114,7 +114,7 @@ fn nmoddoc_from_mod(
         item: itemdoc,
         fns: do vec::map(module_.items) |item| {
             let itemdoc = mk_itemdoc(item.id, item.ident);
-            alt item.node {
+            match item.node {
               ast::foreign_item_fn(_, _) => {
                 fndoc_from_fn(itemdoc)
               }
@@ -189,7 +189,7 @@ fn traitdoc_from_trait(
     {
         item: itemdoc,
         methods: do vec::map(methods) |method| {
-            alt method {
+            match method {
               ast::required(ty_m) => {
                 {
                     name: *ty_m.ident,
index b848c6b88999d1d90930ba93fcabeea08d22f7b5..45d4882a87b7ab16975fd1bcf6a55ad7e83548c4 100644 (file)
@@ -134,7 +134,7 @@ fn default_par_fold<T:send copy>(ctxt: T) -> fold<T> {
 fn default_seq_fold_doc<T>(fold: fold<T>, doc: doc::doc) -> doc::doc {
     doc::doc_({
         pages: do vec::map(doc.pages) |page| {
-            alt page {
+            match page {
               doc::cratepage(doc) => {
                 doc::cratepage(fold.fold_crate(fold, doc))
               }
@@ -242,7 +242,7 @@ fn default_par_fold_nmod<T:send copy>(
 }
 
 fn fold_itemtag<T>(fold: fold<T>, doc: doc::itemtag) -> doc::itemtag {
-    alt doc {
+    match doc {
       doc::modtag(moddoc) => {
         doc::modtag(fold.fold_mod(fold, moddoc))
       }
index 123ad89ecd4b484a4acfc19759bd4527298d78e9..9a58d0c917975b08f87e54657ee45b225fd57f3f 100644 (file)
@@ -78,7 +78,7 @@ fn item_to_entry(
     doc: doc::itemtag,
     config: config::config
 ) -> doc::index_entry {
-    let link = alt doc {
+    let link = match doc {
       doc::modtag(_) | doc::nmodtag(_)
       if config.output_style == config::doc_per_mod => {
         markdown_writer::make_filename(config, doc::itempage(doc))
index 90d00d292b103b4095bb5f8df8a83aaf01389085..dbba57960c0d686033f4c06903d6c0763e9e2b37 100644 (file)
@@ -28,7 +28,7 @@ fn run(
 
     pure fn mods_last(item1: &doc::itemtag, item2: &doc::itemtag) -> bool {
         pure fn is_mod(item: &doc::itemtag) -> bool {
-            alt *item {
+            match *item {
               doc::modtag(_) => true,
               _ => false
             }
@@ -94,7 +94,7 @@ fn write_markdown(
 
 fn write_page(ctxt: ctxt, page: doc::page) {
     write_title(ctxt, page);
-    alt page {
+    match page {
       doc::cratepage(doc) => {
         write_crate(ctxt, doc);
       }
@@ -128,7 +128,7 @@ fn write_title(ctxt: ctxt, page: doc::page) {
 }
 
 fn make_title(page: doc::page) -> ~str {
-    let item = alt page {
+    let item = match page {
       doc::cratepage(cratedoc) => {
         doc::modtag(cratedoc.topmod)
       }
@@ -150,7 +150,7 @@ fn should_write_title_for_each_page() {
     write_markdown(doc, writer_factory);
     for iter::repeat(2u) {
         let (page, markdown) = comm::recv(po);
-        alt page {
+        match page {
           doc::cratepage(_) => {
             assert str::contains(markdown, ~"% Crate core");
           }
@@ -180,7 +180,7 @@ fn write_header_(ctxt: ctxt, lvl: hlvl, title: ~str) {
 }
 
 fn header_kind(doc: doc::itemtag) -> ~str {
-    alt doc {
+    match doc {
       doc::modtag(_) => {
         if doc.id() == syntax::ast::crate_node_id {
             ~"Crate"
@@ -214,7 +214,7 @@ fn header_kind(doc: doc::itemtag) -> ~str {
 
 fn header_name(doc: doc::itemtag) -> ~str {
     let fullpath = str::connect(doc.path() + ~[doc.name()], ~"::");
-    alt doc {
+    match doc {
       doc::modtag(_) if doc.id() != syntax::ast::crate_node_id => {
         fullpath
       }
@@ -289,7 +289,7 @@ fn write_desc(
     ctxt: ctxt,
     desc: option<~str>
 ) {
-    alt desc {
+    match desc {
         some(desc) => {
             ctxt.w.write_line(desc);
             ctxt.w.write_line(~"");
@@ -347,7 +347,7 @@ fn write_item_(ctxt: ctxt, doc: doc::itemtag, write_header: bool) {
         write_item_header(ctxt, doc);
     }
 
-    alt doc {
+    match doc {
       doc::modtag(moddoc) => write_mod(ctxt, moddoc),
       doc::nmodtag(nmoddoc) => write_nmod(ctxt, nmoddoc),
       doc::fntag(fndoc) => write_fn(ctxt, fndoc),
@@ -364,7 +364,7 @@ fn write_item_header(ctxt: ctxt, doc: doc::itemtag) {
 }
 
 fn item_header_lvl(doc: doc::itemtag) -> hlvl {
-    alt doc {
+    match doc {
       doc::modtag(_) | doc::nmodtag(_) => h1,
       _ => h2
     }
@@ -481,7 +481,7 @@ fn write_fnlike(
 }
 
 fn write_sig(ctxt: ctxt, sig: option<~str>) {
-    alt sig {
+    match sig {
       some(sig) => {
         ctxt.w.write_line(code_block_indent(sig));
         ctxt.w.write_line(~"");
@@ -602,7 +602,7 @@ fn write_variants(
 fn write_variant(ctxt: ctxt, doc: doc::variantdoc) {
     assert option::is_some(doc.sig);
     let sig = option::get(doc.sig);
-    alt doc.desc {
+    match doc.desc {
       some(desc) => {
         ctxt.w.write_line(fmt!{"* `%s` - %s", sig, desc});
       }
index 3f46f8f3d5b19e63590706bd58a313794ff7fd3d..a3b40a1caaab6d8efb1ac978081c1aa8da22f441 100644 (file)
@@ -38,7 +38,7 @@ fn write_done() {
 }
 
 fn make_writer_factory(config: config::config) -> writer_factory {
-    alt config.output_format {
+    match config.output_format {
       config::markdown => {
         markdown_writer_factory(config)
       }
@@ -150,7 +150,7 @@ fn generic_writer(+process: fn~(markdown: ~str)) -> writer {
         let mut markdown = ~"";
         let mut keep_going = true;
         while keep_going {
-            alt comm::recv(po) {
+            match comm::recv(po) {
               write(s) => markdown += s,
               done => keep_going = false
             }
@@ -176,7 +176,7 @@ fn make_filename(
     page: doc::page
 ) -> ~str {
     let filename = {
-        alt page {
+        match page {
           doc::cratepage(doc) => {
             if config.output_format == config::pandoc_html &&
                 config.output_style == config::doc_per_mod {
@@ -191,7 +191,7 @@ fn make_filename(
           }
         }
     };
-    let ext = alt config.output_format {
+    let ext = match config.output_format {
       config::markdown => ~"md",
       config::pandoc_html => ~"html"
     };
@@ -256,7 +256,7 @@ fn mk_doc(name: ~str, source: ~str) -> doc::doc {
 fn write_file(path: ~str, s: ~str) {
     import io::writer_util;
 
-    alt io::file_writer(path, ~[io::create, io::truncate]) {
+    match io::file_writer(path, ~[io::create, io::truncate]) {
       result::ok(writer) => {
         writer.write_str(s);
       }
@@ -292,7 +292,7 @@ fn future_writer() -> (writer, future::future<~str>) {
     let future = do future::from_fn {
         let mut res = ~"";
         loop {
-            alt comm::recv(port) {
+            match comm::recv(port) {
               write(s) => res += s,
               done => break
             }
index 11cf4f735cf91f463039aba8b32a01f6cb918097..09543ae59ca364328d04e37c546888be5813ae37 100644 (file)
@@ -106,7 +106,7 @@ fn fold_mod(
 fn strip_mod(doc: doc::moddoc) -> doc::moddoc {
     doc::moddoc_({
         items: do vec::filter(doc.items) |item| {
-            alt item {
+            match item {
               doc::modtag(_) => false,
               doc::nmodtag(_) => false,
               _ => true
index d8060257a63fe175b0864876d7486333119b02fe..970c081903aec6ad79f653cb9dbc0763bca551d2 100644 (file)
@@ -38,7 +38,7 @@ fn is_hidden(srv: astsrv::srv, doc: doc::itemdoc) -> bool {
 
     let id = doc.id;
     do astsrv::exec(srv) |ctxt| {
-        let attrs = alt ctxt.ast_map.get(id) {
+        let attrs = match ctxt.ast_map.get(id) {
           ast_map::node_item(item, _) => item.attrs,
           _ => ~[]
         };
index 015da4b52d881c649e8aaab82a5ca9621d282124..eb6c88c62e795109d97e0cf2a8a961ae2c0cafd5 100755 (executable)
@@ -107,7 +107,7 @@ fn main(args: ~[~str]) {
         return;
     }
 
-    let config = alt config::parse_config(args) {
+    let config = match config::parse_config(args) {
       result::ok(config) => config,
       result::err(err) => {
         io::println(fmt!{"error: %s", err});
index 29bebdf10e5cec2b8dcce9fb097661844f1f585f..0ff86ecbcbeff030cf45f5426673b237012f2a71 100644 (file)
@@ -95,7 +95,7 @@ fn sectionalize(desc: option<~str>) -> (option<~str>, ~[doc::section]) {
     let mut sections = ~[];
 
     for lines.each |line| {
-        alt parse_header(line) {
+        match parse_header(line) {
           some(header) => {
             if option::is_some(current_section) {
                 sections += ~[option::get(current_section)];
@@ -106,7 +106,7 @@ fn sectionalize(desc: option<~str>) -> (option<~str>, ~[doc::section]) {
             });
           }
           none => {
-            alt copy current_section {
+            match copy current_section {
               some(section) => {
                 current_section = some({
                     body: section.body + ~"\n" + line
@@ -114,7 +114,7 @@ fn sectionalize(desc: option<~str>) -> (option<~str>, ~[doc::section]) {
                 });
               }
               none => {
-                new_desc = alt new_desc {
+                new_desc = match new_desc {
                   some(desc) => {
                     some(desc + ~"\n" + line)
                   }
index afa299345dcb2425ac363bec234dd85f38805e51..1d619f0a8f117da4bfe7bee293a802549c80d61c 100644 (file)
@@ -7,7 +7,7 @@
 fn mk_pass() -> pass {
     pure fn by_score(item1: &doc::itemtag, item2: &doc::itemtag) -> bool {
         pure fn score(item: &doc::itemtag) -> int {
-            alt *item {
+            match *item {
               doc::consttag(_) => 0,
               doc::tytag(_) => 1,
               doc::enumtag(_) => 2,
index a2ae6d5eba499ebe807514360d80e1b57ed92038..ba3b9f74ab3d79d554c0b151336c1a8a6c8aefd3 100644 (file)
@@ -46,7 +46,7 @@ fn fold_fn(
 
 fn get_fn_sig(srv: astsrv::srv, fn_id: doc::ast_id) -> option<~str> {
     do astsrv::exec(srv) |ctxt| {
-        alt check ctxt.ast_map.get(fn_id) {
+        match check ctxt.ast_map.get(fn_id) {
           ast_map::node_item(@{
             ident: ident,
             node: ast::item_fn(decl, tys, _), _
@@ -81,7 +81,7 @@ fn fold_const(
 
     {
         sig: some(do astsrv::exec(srv) |ctxt| {
-            alt check ctxt.ast_map.get(doc.id()) {
+            match check ctxt.ast_map.get(doc.id()) {
               ast_map::node_item(@{
                 node: ast::item_const(ty, _), _
               }, _) => {
@@ -109,7 +109,7 @@ fn fold_enum(
     {
         variants: do par::map(doc.variants) |variant| {
             let sig = do astsrv::exec(srv) |ctxt| {
-                alt check ctxt.ast_map.get(doc_id) {
+                match check ctxt.ast_map.get(doc_id) {
                   ast_map::node_item(@{
                     node: ast::item_enum(ast_variants, _), _
                   }, _) => {
@@ -167,18 +167,18 @@ fn get_method_sig(
     method_name: ~str
 ) -> option<~str> {
     do astsrv::exec(srv) |ctxt| {
-        alt check ctxt.ast_map.get(item_id) {
+        match check ctxt.ast_map.get(item_id) {
           ast_map::node_item(@{
             node: ast::item_trait(_, _, methods), _
           }, _) => {
-            alt check vec::find(methods, |method| {
-                alt method {
+            match check vec::find(methods, |method| {
+                match method {
                   ast::required(ty_m) => *ty_m.ident == method_name,
                   ast::provided(m) => *m.ident == method_name,
                 }
             }) {
                 some(method) => {
-                  alt method {
+                  match method {
                     ast::required(ty_m) => {
                       some(pprust::fun_to_str(
                           ty_m.decl,
@@ -200,7 +200,7 @@ fn get_method_sig(
           ast_map::node_item(@{
             node: ast::item_impl(_, _, _, methods), _
           }, _) => {
-            alt check vec::find(methods, |method| {
+            match check vec::find(methods, |method| {
                 *method.ident == method_name
             }) {
                 some(method) => {
@@ -231,7 +231,7 @@ fn fold_impl(
     let srv = fold.ctxt;
 
     let (trait_types, self_ty) = do astsrv::exec(srv) |ctxt| {
-        alt ctxt.ast_map.get(doc.id()) {
+        match ctxt.ast_map.get(doc.id()) {
           ast_map::node_item(@{
             node: ast::item_impl(_, trait_types, self_ty, _), _
           }, _) => {
@@ -286,7 +286,7 @@ fn fold_type(
 
     {
         sig: do astsrv::exec(srv) |ctxt| {
-            alt ctxt.ast_map.get(doc.id()) {
+            match ctxt.ast_map.get(doc.id()) {
               ast_map::node_item(@{
                 ident: ident,
                 node: ast::item_ty(ty, params), _
index 3a681ef7a3bd635d6c2e384dafd54a5935904d6f..b34ba63404ca253846c8c2a238532435d4b41cdc 100644 (file)
@@ -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; }
         }
index 3c7057320ec9dadcd0745939b6a29809a8b2da49..dd92b28c41c9d0c4ba4f5b1381efb966b7b0f839 100644 (file)
@@ -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 => { }
         }
index dfc74f12cefe184f3afb9a5667e03f701189a52f..d510b978f93ba6f35877651e35ecbd521ae18197 100644 (file)
@@ -157,7 +157,7 @@ enum color {
     };
 
     fn is_gray(c: color) -> bool {
-        alt c {
+        match c {
           gray(_) => { true }
           _ => { false }
         }
@@ -170,7 +170,7 @@ fn is_gray(c: color) -> bool {
         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 is_gray(c: color) -> bool {
 
     // 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 @@ enum color {
 
     #[inline(always)]
     fn is_gray(c: color) -> bool {
-        alt c {
+        match c {
           gray(_) => { true }
           _ => { false }
         }
@@ -249,7 +249,7 @@ fn is_gray(c: color) -> bool {
                 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 is_gray(c: color) -> bool {
 
     // Convert the results.
     do par::map(colors) |c| {
-        alt c {
+        match c {
           white => { -1i64 }
           black(parent) => { parent }
           _ => { fail ~"Found remaining gray nodes in BFS" }
index e0ebda079f744ba031546a9584b07da98bff0f45..423cec10f5aa36bcd0512e4e10e2f6a59aec1a89 100644 (file)
@@ -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};
index 067bd710b3d09edc663b92536c5c85f87052c460..60cc52825e84d5ffaa930211fdb56a2806a529f7 100644 (file)
@@ -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};
index c494bfc485a3868fabda8355ac03345c9f5c5530..42df57f5bf3640ec0ff4c27c7739aa15c6463ce0 100644 (file)
@@ -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});
index 5b2488efa2f0a0fad9ff27e0377f1fa94ba27c51..adbf62532141673120a6086dbe8661b00fca4b24 100644 (file)
@@ -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; }
index 2a9a20fc07d18a056a863dccea7c118905657bb6..17830af6869f6746601ad4d6b02f4d2869f9d855 100644 (file)
@@ -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.
index be3a868beb2ad82569901238ee8959e40ecf353a..c9a984117daf40ca707ee2ed497f1b8cd8f8135e 100644 (file)
@@ -5,7 +5,7 @@
 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);
index 7adc176bcffb9193027db87c390d1d13a9c03de9..fd367181df47368d1c44e74e054817af6dd1a078 100644 (file)
@@ -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);
 
index ca014b6145511638d405694cad8db76256bd0694..7aed4749eed5f4b6fe15250f99a1494726d8486d 100644 (file)
@@ -59,7 +59,7 @@ fn sortKV<TT: copy, UU: copy>(orig: ~[(TT,UU)]) -> ~[(TT,UU)] {
 
 // 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    => { }
             }
index 5ffa7cc4f2698380a5c752ba25e27f376b72b114..6eeb50d52f5e01316a71e3374bfe445f7491ecd5 100644 (file)
@@ -57,7 +57,7 @@ fn sortKV<TT: copy, UU: copy>(orig: ~[(TT,UU)]) -> ~[(TT,UU)] {
 
 // 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    => ()
             }
index f00396f9b1499a1f82cc1bdadea7560fc99ecd63..93a1d60ff7f605067f91c49374918c793916c007 100644 (file)
@@ -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
         }
index 3889fa00ff0e9d59450c2f60fcfb2cb296ca08ae..4b4d41e72ba1c4e556f2a514644785b3f29bd7f4 100644 (file)
@@ -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; }
     }
index e99d2946e814afd33286ecc89be496c80f0b3552..26bc2b739fab83ebbf5199c323d5261818dd0d10 100644 (file)
@@ -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;
index 2a8750b64bdc13881750a35044667c1316e37358..eac1f67dcaa1b5c8e7f430ac2ac79ec2ef518c4c 100644 (file)
@@ -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,
index 85008b0daf981024c10aaa3676d0d8d932ab46c4..7b434a5f255c846f86f7b10cc61245f4db72d351 100644 (file)
@@ -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};
index c31ccde2ca644bc0e920f70a29c66a7c485f8047..2281939b57a956b86d31ca90f71fcaa171714d64 100644 (file)
@@ -79,7 +79,7 @@ fn read_word() -> option<~str> { read_word(self) }
 }
 
 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 @@ fn map_task<K1: copy send, K2: const copy send hash_key, V: copy send>(
 
         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 @@ fn get<V: copy send>(p: port<reduce_proto<V>>,
                              &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 @@ fn map_reduce<K1: copy send, K2: const copy send hash_key, V: copy send>(
 
         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 @@ fn map_reduce<K1: copy send, K2: const copy send hash_key, V: copy send>(
               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);
index 037e0c8b517011a24f64ab3c19838acacee191bb..7b973633c7d39c44c7a41f9ef21957b418972ee1 100644 (file)
@@ -1,6 +1,6 @@
 fn main() {
 
-    alt 0 {
+    match 0 {
       0 => {
       } + 5 //~ ERROR unexpected token: `+`
     }
index 1557ff120902ccfa9bddb56b17ca552d96b2dd51..83dcc69609e51f6161df936ce2734f133d54bcf0 100644 (file)
@@ -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;
index 6ba942decfc0b3ef017343d48565a7ade846be2c..617bb16862900ebf313b1339eafa2f802b9ea36d 100644 (file)
@@ -6,7 +6,7 @@ enum color {
     }
 
     fn foo(c: color) {
-        alt c {
+        match c {
           rgb(_, _, _) => { }
           cmyk(_, _, _, _) => { }
           no_color(_) => { }
index 71f44764e1446ae9b238d83d372151accdbf5581..9a54985efc17e932d90150f3657c3b7e64951bf0 100644 (file)
@@ -6,7 +6,7 @@ enum color {
     }
 
     fn foo(c: color) {
-        alt c {
+        match c {
           rgb(_, _) => { }
           //~^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields
           cmyk(_, _, _, _) => { }
index d1ba0f625b161c3605541032ef5e6897cb1dca42..f58d08652656a35d3549a1399eac8376bbbd8456 100644 (file)
@@ -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 => {}
     };
index afda6d7015ebf3a40ea3c80188a42bf752c6824f..229b5c47eba8037b4af11f9706e43a1b025c5bdc 100644 (file)
@@ -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 => { }
       _ => { }
     };
index 4f34c675cefc44ab4de64357fd947b4dcf44479a..9f7b471221dd75c019dec7d167dbdca14d5afd43 100644 (file)
@@ -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 => { } } }
 
index f0546574912e392a75af0edf58c65df23d079779..5902454c46155098f83599c44400236f15617b90 100644 (file)
@@ -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) => { } } }
 
index 4d8de65492f4d8dfc0c6bb055910512a69fe8654..041f84bc6ee0ed3ce6c4dfdcc3e9f49facdef865 100644 (file)
@@ -2,5 +2,5 @@
 
 fn main() {
   let int x = 5;
-  alt x;
+  match x;
 }
index 4c8d72444c1c241f6305237c5e746e590a026543..c043a07604292f8a685f05d56f065c5bd1af2e8b 100644 (file)
@@ -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} => { } } }
index 48155a0b529063a7b3247996e7ba389f10e6def4..d7e7fb16ad82d584750ce50a222415a09a79d662 100644 (file)
@@ -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} => { } } }
index 0414bb5e8676ca67eee6d93ef703ed990c67f804..06cfb60e1a81ca0ca0886a386d3b7c9d62448700 100644 (file)
@@ -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"}; }
     }
index 8a188fe92396ab72017e46be5876e01d702f9d0d..57c0375f4e4b25fb2c07e820043f34f41ee94958 100644 (file)
@@ -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
index 2d396bd591ca10b055f1c94ca5c62dc260b2f312..f8cbb52d996396bd58d87f2ef904d9bcb5c05409 100644 (file)
@@ -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
   }
index 85d062dd98cc982ae2a4c6514b370fd5b2471a91..ab6e63174aa2f76287038093695dfde2bbcfef75 100644 (file)
@@ -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
   }
index acb018dbb2d852b336c8152b6e1ca029e568e267..ef696048219a5e64fa0ca5cf7b65c73b889c9237 100644 (file)
@@ -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
       }
index 103de904609bd4e27929d74371fac95b643690d5..cd4893f87f2a9b4fca2df9dff50a52949d70f2f9 100644 (file)
@@ -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
       }
index 6dd37e647ac97059953b2bd7da686b445a523f6b..b29321ed818e3a6b38a783cf677e7ae00f5e0dcb 100644 (file)
@@ -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 => {}
     }
index 2d7f33e662024714e5b52afd65741790c3a5d1be..02604f6522712d6a74fd687da7c3c4bae105f3b4 100644 (file)
@@ -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.
index 12c2d0ef6e8d32672cd739e3b96b085ee016e8b2..42dd5024603c3fa18b6bfc43e904be08fe5585a3 100644 (file)
@@ -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!
index 34031aa70d6421ce395a25eb0d1db9a346a419ed..86a855de6f18b7ea1def6a5ef761fbb352261d46 100644 (file)
@@ -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);
index 5468a46a6a749e80ca616bede27f46a97ff04712..8c23b1db2dec004d7c4bf693112e3cda92e265d9 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern:cannot be dereferenced
 fn main() {
-  alt *1 {
+  match *1 {
       _ => { fail; }
   }
 }
\ No newline at end of file
index 4ac885e5b1010ed477fdb5807ac07a31cfa6728e..e9a5d91c9d2b514fbd345657eb8c08071aea1c62 100644 (file)
@@ -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; }
         }
index f5639a887f06b960f2d1e7e004426d71725cc91d..7c7ec4f5f8fa7aa183088da5a1f933158a056963 100644 (file)
@@ -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(_)) => { }
index cf7a36224bb50236f9cf0730bf7d5cb8370ae10d..ebda510e87983d2f557b56f3c38a7949343ef2ab 100644 (file)
@@ -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; }
 }
index 376426bb82e4c2021790e01793e24ff1e46caff5..c721887e496f0f7b2346c1e6c86081238a1b94d8 100644 (file)
@@ -8,7 +8,7 @@ enum foo {
 
 fn main() {
     import bar::{alpha, charlie};
-    alt alpha {
+    match alpha {
       alpha | beta => {} //~ ERROR: inconsistent number of bindings
       charlie => {}
     }
index 6085fc9fe8f3587697de2092698b91c4c17cbcf6..5e8a9905c2fdd158f8d3d002badb00556c552d10 100644 (file)
@@ -1,7 +1,7 @@
 enum foo { alpha, beta(int) }
 
 fn main() {
-    alt alpha {
+    match alpha {
       alpha | beta(i) => {} //~ ERROR inconsistent number of bindings
     }
 }
index f5aa30c1416a996a27f0ddc57dbae1b04ce6549a..ec66d3bafe6f78a85a5826849e50cc0bd4d9e382 100644 (file)
@@ -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
     };
 
index e1803b0248a5adad98aaafcc9b067db4ffe11a45..5f488c4dc5a9906760d6c2eada3525d589c0b8a4 100644 (file)
@@ -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() { }
index 4f9e62e0502b799a7591e71524ff6c563f0714c7..c1d4cdb4a57d5a885b6fc3bdcc0c264a2d876cd5 100644 (file)
@@ -27,7 +27,7 @@ fn f3b() {
 }
 
 fn f4() {
-    alt some(3) {
+    match some(3) {
       some(i) => {
       }
       none => {}
index dea250a734c5df04f0f9af661cf1f8551358a76b..01641f5b9c7d482443f623d98895bf239beef189 100644 (file)
@@ -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"; }
     }
index e712406ba19f64b1bcf6582f9fc5b8a8c5649cc0..173fd2b41097064fb1b38a161a634da272bec752 100644 (file)
@@ -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) => {}
index 207bbd91cc5245e0b6176022efb925c2a44cdcf2..e8c8f32b72fdf828465eee8e658da2155450ebd1 100644 (file)
@@ -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>(_) => { } } }
index 37d194cbd509387a2df4539dece5142143fc5e77..f309ead4623bd200676bf94d6263c789596e3e31 100644 (file)
@@ -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) => { } } }
index 1dee20e0ef656164be0e0efaa5114b9e1dc2d8a9..f1e8224efc5c15339fc7e988c529a880768a506d 100644 (file)
@@ -8,6 +8,6 @@
 
 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() { }
index 2622dadc040f9b533e7071a169b75b295700c1cf..8b7c065dbf71175aa65440e1095e4dae1b835d9b 100644 (file)
@@ -8,7 +8,7 @@
 enum bar { t1((), option<~[int]>), t2, }
 
 fn foo(t: bar) {
-    alt t {
+    match t {
       t1(_, some::<int>(x)) => {
         log(debug, x);
       }
index 0702618c68c5fdc0b5f7daf1064d2cd559b32d39..6cacf49300dda150060765db0d19ba7276ce5b38 100644 (file)
@@ -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
       }
index 2a9f5838c85c8f6d53993a54c6f4a9a0185923b6..c301d8199ded22f30637c4584bc0d1e8413dca1e 100644 (file)
@@ -1,7 +1,7 @@
 // error-pattern:found `let` in restricted position
 
 fn main() {
-    alt true {
+    match true {
       {let} { }
     }
 }
index 1865fe6aff989b878c1c58b75c576d36428c6650..71875e92a8fd1cf678d7fa181dce8537f89f69b4 100644 (file)
@@ -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) => { } } }
index 817a4056f10c5caa4d4737a960673803a6d17baf..3e3b4581f62b9e7e0cf4865911e45e9db1a797af 100644 (file)
@@ -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",
index 70099e46806e92b3f10d92308cf2ffdc3ec5fdb4..9c6e74f48330f58e2f78327fc1be38595506e552 100644 (file)
@@ -3,7 +3,7 @@
 fn main() {
     let x = some(3);
     let _y =
-        alt x {
+        match x {
           some(_) => ~[~"some(_)", ~"not", ~"SO", ~"long", ~"string"],
           none => ~[~"none"]
         };
index 2df236718576c8f09761db849d1f774f9f283bc0..0ad75ab68f94abfaaf5549727bbf9831ff2092f4 100644 (file)
@@ -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(_)";
 }
index 14a8629ab72e090284ecfa3d4826bc39d47e7c23..357a6d19fe422703cef84eb53bbf52f0c5dcecb2 100644 (file)
@@ -8,7 +8,7 @@
 
 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]
 }
 
index 1f9d68cc8a2666a089fd04d54d43759680dad5d6..1e2c95fa3255b99ac786423011e920844934426d 100644 (file)
@@ -10,8 +10,8 @@ fn block_nosemi() -> int { ({ 0 }) - 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; }
index 08320af9775b0bbe4576f868a19fed4370dac276..da4ffdd5afc53ca3f2ce35a36881063d3ca499a6 100644 (file)
@@ -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);
 }
index ab444a8273e050ec5c9ef56b6f269b04e2ba803c..e3bc3c16384da39d20ae98f15efed1e54e38a25f 100644 (file)
@@ -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(); }
index 3a3c4c5a0a8bbb31761c81293a3cd3e3e7ed13a0..39a381dd3aca614b9a10d24fa0bb521264b8f823 100644 (file)
@@ -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; }
     }
index f6d3779b9f00af6a30a6e0d13e8dc5b8c8b425ff..6c21859baebd7da2fe9009ca7ba91f3c7f2c189e 100644 (file)
@@ -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(); }
index 3a70b690755039c93bf1652f3cbf61bd3158ac58..a7f19c6d3ce57b7f13f612d174d4c46a1370f34e 100644 (file)
@@ -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 } }; }
index 849d4b41d3bccfe691aef28ed3edd9f77477d35a..ddbd1200fcf4df433d969574c0f2d4da08da4462 100644 (file)
@@ -5,7 +5,7 @@
 
 fn bigfail() {
     do { while (fail) { if (fail) {
-        alt (fail) { _ {
+        match (fail) { _ {
         }}
     }}} while fail;
 }
index 026af3a2f65ace95f4f43704371525dc8bf3d322..d18c7de3d3474a42c5affd56422ad6c6362435f4 100644 (file)
@@ -5,6 +5,6 @@
 
 fn main() {
     do io::with_str_reader(~"") |rdr| {
-        alt rdr.read_char() { '=' => { } _ => { fail } }
+        match rdr.read_char() { '=' => { } _ => { fail } }
     }
 }
index d5f013a42b6e470ec5cad2e9705938d414aa22bc..579067927ca9faedd02b7a478ade020cb670ea24 100644 (file)
@@ -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() {
index 100ec11cd962545e4fdd4b334fb8708fb6de1481..289018013d3532f0f1600c58f21c0990efb98a6d 100644 (file)
@@ -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 {
index cbf1519dc3416f1d332edcf2d072313192e942f0..8b9f606d8d8a7bf2d4b8b252b8bc443e39702f2d 100644 (file)
@@ -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(); }
index 7162bf69aa52c8ab1fbfea4b0f1edbfef98e75ae..06b6eca4b8354f759b289482780e312fd72616bc 100644 (file)
@@ -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);
 }
index 796a73a0204f1dfce55f9e4c7a480ef9f4770ccc..eca726e827782e7578aede7ea5f9fcfe643d2b30 100644 (file)
@@ -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; }
     }
 }
index 355e678d3a33bbffa0f49ec94f41ef71e2ff6be0..f4d14cbc728bc366477a7f1e50668c10702ce363 100644 (file)
@@ -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; }
     }
 }
index 2d4078ced04f1227eadc471dd3488ddb9111c078..5c51fd0d34da17ecb014c8b475c7a745f045e8dd 100644 (file)
@@ -10,7 +10,7 @@ fn foo<T>(y: option<T>) {
 
     if true {
     } else {
-        alt y {
+        match y {
           none::<T> => x = 17,
           _ => x = 42
         }
index 2fe2bfefa98a59e89fdef3ed9beb1f5a0010337e..df2e9f5acd862dde36fe7f55a36b924146e7f2ca 100644 (file)
@@ -1,5 +1,5 @@
 fn main() {
-    let x = alt 0 {
+    let x = match 0 {
       _ => {
         x: 0
       }.x
index 76cfb4cd11b46d05439521e4361a1cb83221c649..042861d0a861e6e288f0ab0518271cda473f5933 100644 (file)
@@ -1,5 +1,5 @@
 fn main() {
-    let x = alt 0 {
+    let x = match 0 {
       _ => {
         x: 0
       }
index aa9e9f18481697817743bae7caf92287689677f1..cd8b21fc2481ea95ae3d77d8ed7ca433dbc2a700 100644 (file)
@@ -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() { }
index 92366e54b308fa11855b46a7d7ca55a7804cdd79..ba8bef7e124a0553d79d2d4643215fb6cb5266a8 100644 (file)
@@ -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
 
index bc1f788abc01eb19b45f8bec5655b0106dcf95fb..e5f86159421338efd8e8a992711afe0dfc3dfa2c 100644 (file)
@@ -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; }
     }
index badad32ce283715df9b36af2f5a492a6991d74d9..447fd417e8d3fafb1d3644824dfb7eeee5251214 100644 (file)
@@ -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() { }
index e4ca776bb610c7bad94e51a6004cacd0b0bf6d07..fd31a235ba9909c741174380d91b96cecead0342 100644 (file)
@@ -1,5 +1,5 @@
 
 
-fn altsimple(f: int) { alt f { x => () } }
+fn altsimple(f: int) { match f { x => () } }
 
 fn main() { }
index 358b8d64e6c59d46569f9bb555eb07ee16481e69..cea0e1b4533539681e71d3d1ddb1e57d99808b97 100644 (file)
@@ -6,7 +6,7 @@ enum thing { a, b, c, }
 
 fn main() {
     let mut x = true;
-    alt a {
+    match a {
       a => { x = true; foo(|_i| { } ) }
       b => { x = false; }
       c => { x = false; }
index 75ca1dd5e52abb94d550e3c12a358d6dcc4a80b9..f3713fabb13bb790892f580db6e8f70c8c8c7141 100644 (file)
@@ -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"
     }
index 4693635458df391370a842b146a9054ad6d5c740..98754ecf0e28cb470d1e8c142c333a6015f1f50a 100644 (file)
@@ -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" => { } }
 
 }
index 4b8cdce110ed5b9328a1ec7743d49139027c66d6..0c75cafa204b79e882378016888078b43d5d9c73 100644 (file)
@@ -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; }
index 207f718f3aace200c4a327f17cfac9e95c758e0e..4881a6bba4a94cda3c7edcb8e830763948ca01b9 100644 (file)
@@ -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"); }
   }
index b907afa1e8de6f78d55421efee94349f8bb0ea6e..7548d171d1c0d2d248bb35f4a4d50db1b46b257c 100644 (file)
@@ -1,5 +1,5 @@
 fn main() {
-    alt ~100 {
+    match ~100 {
       ~x => {
         debug!{"%?", x};
         assert x == 100;
index 50c03e71be29b41ec22cc26e9cea6f2d2fe0b8ae..c07391b691baec80bf81cc7e5c2f98bc6ed243d6 100644 (file)
@@ -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
     };
index d2df3b2dab3d411b237af2aa1f3d6d89bfbaf318..86bdd52c6af16b8b35ef8ddc7ef373a960a49517 100644 (file)
@@ -1,6 +1,6 @@
 // Check that issue #954 stays fixed
 
 fn main() {
-    alt check -1 { -1 => {} }
+    match check -1 { -1 => {} }
     assert 1-1 == 0;
 }
index 685f68c61ad04d74b4ac3189f385ec64340bace2..db941d32e11ad768b33676a03cf5b96a93d9b085 100644 (file)
@@ -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) } => {
       }
       _ => {
index bbc2abf51af18ad2e4ea4441d020391269b56d69..5f4804c778b714ed9a8180d7c8f965cd82f63274 100644 (file)
@@ -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!
index 87b4fd59e5f1d4d0b03c257570b749e1b86fa086..58694e8f1353e0fed99524290ee46117a6c3c7c1 100644 (file)
@@ -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.
index 99b446ce315346418172b2786f23e9ab7712ce27..101f9c787d31205232b4bb60c3d1c3bccab685c9 100644 (file)
@@ -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);
index 7a37432db744fdf38f2207a4c0175eb812b9c9bf..c5d5fd96673345100d5e60926a63fcee0231c98f 100644 (file)
@@ -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);
index f8bf02a77037c6a12aee6383006c771eebd68fca..11bc8e6fa7fb9f17630ea4897770be438a66f9d6 100644 (file)
@@ -2,7 +2,7 @@
 
 fn switcher(x: option<@int>) {
     let mut x = x;
-    alt x {
+    match x {
       some(@y) => { copy y; x = none; }
       none => { }
     }
index fde259046a759f336df1381e1e48803cd83a437a..15f22e7ced8656875259d0d5467b6a2bcd431ec1 100644 (file)
@@ -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
index faf3ff73b014ff1f0a55a9b7eac795fb9dcc2d83..90228f3dcf25ebaa6fcfeec8e6e96780f71f6a77 100644 (file)
@@ -2,7 +2,7 @@
 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);
index 175c5f9936a48877be269b6d48888988e38a77a4..fc85484193c8f56d48328d21d53c8d9a5112c102 100644 (file)
@@ -48,7 +48,7 @@ fn insert(+k: int, +_v: T) -> bool {
   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 @@ fn find(+k:int) -> option<T> { if k <= self.meows {
   }
 
   fn remove(+k:int) -> option<T> {
-    alt self.find(k) {
+    match self.find(k) {
       some(x) => {
         self.meows -= k; some(x)
       }
index 3b9d41fc82ac15683f3b0bc22436d699a6186394..4a39797066936745d18fdec6c90d732ec2957ea0 100644 (file)
@@ -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) => { } } }
index 8930f113431ee3752f4a023c282fa0e671c36f26..eb49160ce6f16cc5ccad0d27b7d7518fa24195d8 100644 (file)
@@ -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");
 }
 
index a38464f6d0af48185366d444dde625dd532cfd5e..bd55f4d663e41662ae624708bee8fc13e6c9c085 100644 (file)
@@ -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 } } }
         };
 }
index 5635a660f42f14c6d5ed688cf5131047c1912150..a490aac5c95f9a2f7a895e90115a0a10c2068e21 100644 (file)
@@ -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);
 }
 
index f3f9dee2ff4cf4302b9e5f24cffe12acbe7ada00..40121de92db96dff1876f20dacc414ebdfe6a3c9 100644 (file)
@@ -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));
 }
 
index e03c196c289df593f4bdf0dbda4694a83110201a..73c6a4b68b4c6a3494dbaa65e51b1441b289b8b9 100644 (file)
@@ -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));
 }
 
index 5168fd5ca8094acfb67597aa5cdfa36263491e18..420cb030134bf79965b9d59ec3229be6a7af1190 100644 (file)
@@ -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));
 }
 
index e1475373dc2aa691643823d991ac755d527ed65c..c425bedcef97d46579ceb08e6faa9928870160c3 100644 (file)
@@ -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));
 }
 
index 98536b1afe1cbbbffa4bcdce2e4f1da1717acd26..6f947402a136efc53b5fc2f570b94d82e7d3e9e8 100644 (file)
@@ -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));
 }
 
index 2bfef283f9de51144a840214677db471a27a9351..c0be37942a5d8da545d8be0e68d017f80f6cabf3 100644 (file)
@@ -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);
 }
 
index 58a88bee1d36d685302784ed20b1e5531636330b..6e2618991230f89e743a48b90f7835b056545ce7 100644 (file)
@@ -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);
 }
 
index 2e855ce36fa571136e993741c0138af87b9ea27c..f744193e7dcf3897127ff672ebb99f03b1788ba0 100644 (file)
@@ -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);
 }
index 1148d145ba007a9948860a6f5ef40d490df2a6fe..42bf4bd973bebb6b0da72572a3c7ebbf25b2323c 100644 (file)
@@ -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() { }
index 8d38e5d2941d8012756601082ce5dc96b18531e0..f181b3f3261b77cc0cbda4ab2d42cb9ab5404737 100644 (file)
@@ -14,7 +14,7 @@ fn f<T: copy>(t: T) -> T { t }
 }
 
 fn test_alt() {
-    fn f() -> int { alt true { false => { 10 } true => { 20 } } }
+    fn f() -> int { match true { false => { 10 } true => { 20 } } }
     assert (f() == 20);
 }
 
index a117039946d5a827af9a699ad3924667ce662535..5c80ebfae234e621c98034fcb12a55c23943b52f 100644 (file)
@@ -8,7 +8,7 @@ enum color {
 }
 
 fn main() {
-    log(error, alt red {
+    log(error, match red {
         red => { 1 }
         green => { 2 }
         blue => { 3 }
index 68013a41072a9c11fff30374cc55ac5fc87e2038..fab82aaf7ae57d6a69c9b044ac25fdfdc590d6ff 100644 (file)
@@ -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);
 }
 
index 237c8c7f844a566665c37b7b2aa61aaa46e0318d..db18b4681e6e17ffc2180106c1e954611d4890d2 100644 (file)
@@ -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);
index a34fa14860db28051a473bdb41a71279c5322777..07ea8088431dce73c815e5a3cc49aec98c67fcd2 100644 (file)
@@ -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 }
index e4fc8c1650faa9ef236cb37777fb4d4f747cbdb6..d0098dd8afe2e79c79acc89839710346553cd3c4 100644 (file)
@@ -45,7 +45,7 @@ fn map_task(ctrl: chan<ctrl_proto>, input: ~str) {
         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 @@ fn map_reduce(inputs: ~[~str]) {
         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; }
                 }
index ae9c27d7880e8acc58fbc85dcd236ca96391dfa2..17f08a3ce272d147a7ad7dccc7df54525a9fc746 100644 (file)
@@ -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" }
     };
index 4c1f703733d599eef2785b67d1637bc185f5d1cb..7b411128dac7d4b25ee2bb18135a8627d0f5427e 100644 (file)
@@ -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 }
index 6309e967db26383852e2a4fa3c811f5e42663e55..8017d9da15f70f62fa82ebc2a0f4bc381cb60330 100644 (file)
@@ -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});
         }
index 8fb85a7d11e537f5cf0b738379d6195c86654a54..315c334f4721af13c5a3af679c3cd113f320660f 100644 (file)
@@ -58,7 +58,7 @@ fn send<T: send>(-p: send_packet<T>, -payload: T) {
         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 @@ fn recv<T: send>(-p: recv_packet<T>) -> option<T> {
         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 @@ fn recv<T: send>(-p: recv_packet<T>) -> option<T> {
 
     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 @@ fn sender_terminate<T: send>(p: *packet<T>) {
 
     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 @@ fn liberate_ping(-p: ping) -> pipes::send_packet<pong> unsafe {
     }
 
     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;
index dbaa37abacda4ed36042b46a19087a5b9e187506..5066ff573b913084357df015c553dd791c71d666 100644 (file)
@@ -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) =>
         {
index 67d993504d1062d565a7f86cddbb2993d907c4c2..f37322938ec3ddc212798e75859e8348bc5f44c6 100644 (file)
@@ -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 }
index a7ae3a55000194cd62e1738cfd858c3b9a50e603..de1819f9577e840b3e1d6a9a73c8eed216a35adb 100644 (file)
@@ -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 @@ fn to_str() -> ~str {
 }
 
 fn square_from_char(c: char) -> square {
-    alt c  {
+    match c  {
       'R'  => { bot }
       '#'  => { wall }
       '*'  => { rock }
index 92e18bde0122b96740a300cfe11e1ce8f91df54a..3907c2a796bfce3ec4ed6dca16f80ac630f5991f 100644 (file)
@@ -2,7 +2,7 @@ enum what { }
 
 fn what_to_str(x: what) -> ~str
 {
-    alt x {
+    match x {
     }
 }
 
index a314bf4856b2f3c2314c1c9a88a39841aa7ddf03..f8f983d767fba10e63cfbcb796fd825b32c0c056 100644 (file)
@@ -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:"};
index c7d48d95108e7f5651f20cedc58a0465f9d24733..95ac37c66b7af6663a899ed40b13da9885042f61 100644 (file)
@@ -1,6 +1,6 @@
 // return -> return
 // mod -> module
-// alt -> match
+// match -> match
 
 fn main() {
 }
index 3a3bfa4f515eb8a3461f427339f6e8012fbdbdc5..fcdafc6d8c12caecd874d9cbed68bd77b2fcd343 100644 (file)
@@ -6,7 +6,7 @@
 fn main() {
   let p = test_comm::port();
   
-  alt none::<int> {
+  match none::<int> {
       none => {}
       some(_)  =>{
   if test_comm::recv(p) == 0 {
index cbaa9182dc54872e57addc35b39e4d215aa0269c..a138fa1e18f95016184d16871ee801f49e9b1669 100644 (file)
@@ -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
           }
index 832cca5c4f18b34c3f0976d4af71223eef2cd7f4..f19b72ed18176fa5775f63c7a8f7ed08c87695fb 100644 (file)
@@ -7,7 +7,7 @@ enum cat {
 
 fn animal() -> ~str { ~"cat" }
 fn talk(c: cat) -> ~str {
-    alt c {
+    match c {
       howlycat =>  { ~"howl" }
       meowlycat => { ~"meow" }
     }
index 1e611804f9f93be159579e7ab25d5313b3b2583b..59ea633f218ad6d9601f54900864bd75482e6eda 100644 (file)
@@ -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 }
         }
index 38661bb84b2d62f4ddfaee00fb890f5d91aed3b6..2284728f181e7b4217bea951778514c1fd2fb4a7 100644 (file)
@@ -1,5 +1,5 @@
 fn main() {
-    alt -5 {
+    match -5 {
       -5 => {}
       _ => { fail }
     }
index ff0f0228a6396e16587ef397913947695351e872..795a42f979012ac134859d0361c02e3701261b08 100644 (file)
@@ -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"}; }
index 51d7b7d453897949d38f013f98592115716ac377..4cfd1eaea125cae100029cd8b1e9462bbd5cb95f 100644 (file)
@@ -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, _} => {}
index ae901d1f9f1e7535a8d36e6e39633d50059bed34..a79b084493413523750a4823ced4d26821c664d5 100644 (file)
@@ -9,7 +9,7 @@
 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"}; }
     }
index 0b93154b566691dd1a59c69a11f5bf5ecacce7f2..1066b5c8aef79e95de548eb08120175e0f3ef49d 100644 (file)
@@ -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; }
     }
index c1ef9c5970e372cf2a3474c07d3641b700717b77..7261cf4e2daf70df48ee9d4298f0f6117efc537f 100644 (file)
@@ -1 +1 @@
-fn main() { let x = (); alt x { () => { } } }
+fn main() { let x = (); match x { () => { } } }
index a338fd39101811510846441a6c0382cdbd968cf8..5a86d54c77fd021df2323504121aad3e6e596a5f 100644 (file)
@@ -3,7 +3,7 @@
 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) }
index a856eb3e61be471da6c35299c46a22eee153273c..a73c98bfa4e2413c9b647e0c6acef1a4bb5a426e 100644 (file)
@@ -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() {
index 979bf5522e9c46c5259fc4bb9968259153071e66..d1316e7c0cef81b1f913074e58612856cfe1f7c3 100644 (file)
@@ -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() {
index 5e115abb0dc496d5c295fb0a4b045638469dde6d..b9ea40b2b52fa077e7e8dbcd8dbb58e5b4577534 100644 (file)
@@ -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"}; } }
 }
index ae753296a2f3ac96cfd5e4bd19b4c082517e2036..ca049e1718cda9b35784373b6dfddd6b8e90d3fb 100644 (file)
@@ -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;
index 81e33bbbebbbe183ac2baea54323152ac85f48b2..a3383a688cb97230f1b4b936c0ae9d43055657f4 100644 (file)
@@ -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!");
       }
index b68be9cb23c3a58e122bf0729fe0d90f0616e2e2..9c99f1dce02cdc8ebbda3bd7e4c5b6f62701e27b 100644 (file)
@@ -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 => { }
         }
index 856bb3fe5cc852553324efd298b39337a5618ffc..6c315123f53c842e5fa6a3092e1ae9a44765e746 100644 (file)
@@ -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(*) => { }
     }
index 9ccdf58c4f1d64641369e6efe4e9effde9621838..0507b84d7afbee8e28c57faafadeb45311489a43 100644 (file)
@@ -3,7 +3,7 @@ enum t1 { a(int), b(uint), }
 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; }
     }
index dccdc6ce384689f40a086b285a65f324ac67335a..d380f624ee3fd022dc736ddf6e26990f92ae0bc9 100644 (file)
@@ -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;
index bd03a2ff6e7c7920fcd4eb3a3b5acef14b6e39fa..9f1588e9b2b42e27c49a2f024eefc33aec95eba1 100644 (file)
@@ -6,7 +6,7 @@ fn main() {
     let x = 3;
     let y = int_wrapper_ctor(&x);
     let mut z : &int;
-    alt y {
+    match y {
         int_wrapper_ctor(zz) => { z = zz; }
     }
     log(debug, *z);
index 96b018e6a3bdf0c474435c99bbc8a5c628c7a444..c01cc5502602ae4ee75c3687cbb2d985d16cb62e 100644 (file)
@@ -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);
index ef5bd284a0d9f6d4d9ba98fb7b19224e284fede7..0fa6e4568d4aecc9e810086c04b718d1d45a3233 100644 (file)
@@ -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"}; } }
 }
index 2bf60273c5448d67be5fdca39d2e7c12bd017d16..0503e9b69bd90b8b132ac0f53ecdd1df12c059ce 100644 (file)
@@ -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>(_) => { } } }
index 5c325e25f4823e07b6fc6f83ee3b62bd0cbd2ba9..5403d79f4f91bca4089b2a630482b8e662115d5f 100644 (file)
@@ -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"}; }
     }
index 9ceede21207145edf0dab137b721f7f096993af3..1c0a7ccbc016a10356e03abda11c72a39c0bcea8 100644 (file)
@@ -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) }
     }
index 2b43cb7061f0750e6fc591da5dea8bab74d0d8d1..95a84a30055987814266101c99c4337753ccb74e 100644 (file)
@@ -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"}
index a56061a8ff5355105f3b24cdd68a080e2583162d..dc097c515ca149fcb15b1c4b418a9976e8078d6b 100644 (file)
@@ -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() + ~")" }
         }
index a1825737a4e0a04357614fc160325481e26c42d4..53d0ab7db0e431a8be031fe1d04f289fcbe932a7 100644 (file)
@@ -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() {
index 2f155ef00e7e45453c56d843bea76c544599ee37..6dc3b616182dfcd32126c365fb69560576e5161f 100644 (file)
@@ -1,7 +1,7 @@
 // Issue #961
 
 fn altsimple() {
-    alt ~true {
+    match ~true {
       _ => { }
     }
 }
index aaba73c72d0067ac48c16212e82fc5f0cfe52a7c..8fe2671684f0cf8b047b3949df8e1687f6818ef6 100644 (file)
@@ -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
index 241ff4b1d3a86e3435bf135191b2e01e3ecfb81b..c383b49057873727fa9d988ba0275e6d1fa99770 100644 (file)
@@ -3,7 +3,7 @@
 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);
index edc5be4d159ac6df3922430b3884abc67bcae9cf..29553fadc00d6c3bd0c7b6fef4604f6b69508dfc 100644 (file)
@@ -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
index 81c1e6ccbd61ea20e84f7bbce89b8abf1f6764d2..5f38a46ec86f3b24bbda1a1615e46df1e247bd30 100644 (file)
@@ -1,5 +1,5 @@
 fn simple() {
-    alt ~true {
+    match ~true {
       ~true => { }
       _ => { fail; }
     }
index e48056d68c08158b3c1379970ed9f94cccb7b224..81c4586d76cdd7e87e85a45ecaa2e857e367839b 100644 (file)
@@ -22,7 +22,7 @@ fn call_id() {
 fn ret_ret() -> int { return (return 2) + 3; }
 
 fn ret_guard() {
-    alt 2 {
+    match 2 {
       x if (return) => { x; }
       _ => {}
     }
index 21b1c1d66da3b2add5ed164b82d525444babeaf1..477416c7efd7d367cbb37992b2f49d1585aa672a 100644 (file)
@@ -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;
 }
 
index b06d2035644ae67032d7d74d04c8e1fbc7ebea53..63705a759cdcdf1c1c6d2266f4ef542326955ca3 100644 (file)
@@ -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;
 }
 
index 5e7fe0b05245b6033bbe7fe997469fc5a31a4992..cbd16d00a8f2965f63416dd839f928cb369bdd61 100644 (file)
@@ -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"}; }