Skip to content

Commit bcf04e2

Browse files
committed
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 92a716d.
1 parent 6623597 commit bcf04e2

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

src/comp/middle/trans.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,6 +1789,7 @@ fn variant_types(@crate_ctxt cx, &ast.variant v) -> vec[@ty.t] {
17891789
}
17901790
}
17911791
case (ty.ty_tag(_, _)) { /* nothing */ }
1792+
case (_) { fail; }
17921793
}
17931794
ret tys;
17941795
}
@@ -2001,6 +2002,7 @@ fn iter_structural_ty_full(@block_ctxt cx,
20012002
j += 1;
20022003
}
20032004
}
2005+
case (_) { fail; }
20042006
}
20052007

20062008
variant_cx.build.Br(next_cx.llbb);
@@ -2167,6 +2169,7 @@ fn iter_sequence(@block_ctxt cx,
21672169
auto et = plain_ty(ty.ty_machine(common.ty_u8));
21682170
ret iter_sequence_body(cx, v, et, f, true);
21692171
}
2172+
case (_) { fail; }
21702173
}
21712174
cx.fcx.ccx.sess.bug("bad type in trans.iter_sequence");
21722175
fail;

src/comp/middle/typeck.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,6 +1861,9 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
18611861
case (ty.ty_chan(?it)) {
18621862
item_t = it;
18631863
}
1864+
case (_) {
1865+
fail;
1866+
}
18641867
}
18651868
auto rhs_1 = demand_expr(fcx, item_t, rhs_0);
18661869

@@ -1881,6 +1884,9 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
18811884
case (ty.ty_port(?it)) {
18821885
item_t = it;
18831886
}
1887+
case (_) {
1888+
fail;
1889+
}
18841890
}
18851891
auto lhs_1 = demand_expr(fcx, item_t, lhs_0);
18861892

src/lib/deque.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ fn create[T]() -> t[T] {
4747
fn get[T](vec[cell[T]] elts, uint i) -> T {
4848
alt (elts.(i)) {
4949
case (option.some[T](?t)) { ret t; }
50+
case (_) { fail; }
5051
}
5152
fail; // FIXME: remove me when exhaustiveness checking works
5253
}

src/lib/map.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ fn mk_hashmap[K, V](&hashfn[K] hasher, &eqfn[K] eqer) -> hashmap[K, V] {
176176
fn get(&K key) -> V {
177177
alt (find_common[K, V](hasher, eqer, bkts, nbkts, key)) {
178178
case (option.some[V](?val)) { ret val; }
179+
case (_) { fail; }
179180
}
180181
fail; // FIXME: remove me when exhaustiveness checking works
181182
}

0 commit comments

Comments
 (0)