aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-12-01 17:08:46 -0800
committerGraydon Hoare <[email protected]>2010-12-01 17:09:02 -0800
commit98a63bd1f9fda47fc34b16d9f0782022e1022277 (patch)
tree25796c068e3219553a6b7e984d512523ddd754cf /src/comp/front
parentrustc: Annotate variants with their types. This may be useful for trans! (diff)
downloadrust-98a63bd1f9fda47fc34b16d9f0782022e1022277.tar.xz
rust-98a63bd1f9fda47fc34b16d9f0782022e1022277.zip
Add code to fail on non-exhaustive alt matching. Fix all cases this picked up in rustc.
Diffstat (limited to 'src/comp/front')
-rw-r--r--src/comp/front/parser.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index ede8c637..f8d3bf07 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -388,6 +388,7 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr {
es.node, ast.ann_none);
hi = es.span;
}
+ case (_) { /* fall through */ }
}
}
@@ -401,6 +402,7 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr {
ret @spanned(lo, hi,
ast.expr_lit(lit, ast.ann_none));
}
+ case (_) { /* fall through */ }
}
auto e = parse_expr(p);
hi = p.get_span();
@@ -590,6 +592,7 @@ impure fn parse_binops(parser p,
more = true;
}
}
+ case (_) { /* fall through */ }
}
}
}
@@ -711,6 +714,7 @@ impure fn parse_assign_expr(parser p) -> @ast.expr {
ret @spanned(lo, rhs.span,
ast.expr_assign(lhs, rhs, ast.ann_none));
}
+ case (_) { /* fall through */ }
}
ret lhs;
}
@@ -733,6 +737,7 @@ impure fn parse_if_expr(parser p) -> @ast.expr {
els = some(eblk);
hi = eblk.span;
}
+ case (_) { /* fall through */ }
}
ret @spanned(lo, hi, ast.expr_if(cond, thn, els, ast.ann_none));
}
@@ -1039,6 +1044,7 @@ fn index_block(vec[@ast.stmt] stmts, option.t[@ast.expr] expr) -> ast.block_ {
}
}
}
+ case (_) { /* fall through */ }
}
}
ret rec(stmts=stmts, expr=expr, index=index);
@@ -1211,7 +1217,6 @@ impure fn parse_mod_items(parser p, token.token term) -> ast._mod {
case (ast.item_tag(?id, ?variants, _, _)) {
index.insert(id, ast.mie_item(u));
-
let uint variant_idx = 0u;
for (ast.variant v in variants) {
index.insert(v.name, ast.mie_tag_variant(u, variant_idx));