Skip to content

Commit

Permalink
Revert "Remove usages of case(_) { fail; } since the compiler does th…
Browse files Browse the repository at this point in the history
…is automatically". When we have exhaustiveness checking, "case(_) { fail; }" will be useful to silence warnings.

This reverts commit 92a716d.
  • Loading branch information
pcwalton committed Mar 22, 2011
1 parent 6623597 commit bcf04e2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/comp/middle/trans.rs
Expand Up @@ -1789,6 +1789,7 @@ fn variant_types(@crate_ctxt cx, &ast.variant v) -> vec[@ty.t] {
}
}
case (ty.ty_tag(_, _)) { /* nothing */ }
case (_) { fail; }
}
ret tys;
}
Expand Down Expand Up @@ -2001,6 +2002,7 @@ fn iter_structural_ty_full(@block_ctxt cx,
j += 1;
}
}
case (_) { fail; }
}

variant_cx.build.Br(next_cx.llbb);
Expand Down Expand Up @@ -2167,6 +2169,7 @@ fn iter_sequence(@block_ctxt cx,
auto et = plain_ty(ty.ty_machine(common.ty_u8));
ret iter_sequence_body(cx, v, et, f, true);
}
case (_) { fail; }
}
cx.fcx.ccx.sess.bug("bad type in trans.iter_sequence");
fail;
Expand Down
6 changes: 6 additions & 0 deletions src/comp/middle/typeck.rs
Expand Up @@ -1861,6 +1861,9 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
case (ty.ty_chan(?it)) {
item_t = it;
}
case (_) {
fail;
}
}
auto rhs_1 = demand_expr(fcx, item_t, rhs_0);

Expand All @@ -1881,6 +1884,9 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
case (ty.ty_port(?it)) {
item_t = it;
}
case (_) {
fail;
}
}
auto lhs_1 = demand_expr(fcx, item_t, lhs_0);

Expand Down
1 change: 1 addition & 0 deletions src/lib/deque.rs
Expand Up @@ -47,6 +47,7 @@ fn create[T]() -> t[T] {
fn get[T](vec[cell[T]] elts, uint i) -> T {
alt (elts.(i)) {
case (option.some[T](?t)) { ret t; }
case (_) { fail; }
}
fail; // FIXME: remove me when exhaustiveness checking works
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/map.rs
Expand Up @@ -176,6 +176,7 @@ fn mk_hashmap[K, V](&hashfn[K] hasher, &eqfn[K] eqer) -> hashmap[K, V] {
fn get(&K key) -> V {
alt (find_common[K, V](hasher, eqer, bkts, nbkts, key)) {
case (option.some[V](?val)) { ret val; }
case (_) { fail; }
}
fail; // FIXME: remove me when exhaustiveness checking works
}
Expand Down

0 comments on commit bcf04e2

Please sign in to comment.