Revert "Remove usages of case(_) { fail; } since the compiler does this automatically". When we have exhaustiveness checking, "case(_) { fail; }" will be useful to silence warnings.

This reverts commit 92a716d862d92d3cc52a400457d2c3900d0c57a2.
This commit is contained in:
Patrick Walton 2011-03-22 14:02:52 -07:00
parent 6623597c18
commit bcf04e253f
4 changed files with 11 additions and 0 deletions

View File

@ -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;
}
@ -2001,6 +2002,7 @@ fn iter_structural_ty_full(@block_ctxt cx,
j += 1;
}
}
case (_) { fail; }
}
variant_cx.build.Br(next_cx.llbb);
@ -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;

View File

@ -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);
@ -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);

View File

@ -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
}

View File

@ -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
}