Skip to content

Commit 6e6acaa

Browse files
committed
Fail on non-exhaustive alt matches
1 parent 9d0a505 commit 6e6acaa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/comp/middle/trans.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3581,9 +3581,9 @@ fn trans_alt(@block_ctxt cx, @ast.expr expr, vec[ast.arm] arms)
35813581
this_cx = next_cx;
35823582
}
35833583

3584-
// FIXME: This is executed when none of the patterns match; it should fail
3585-
// instead!
3586-
this_cx.build.Br(last_cx.llbb);
3584+
auto default_cx = this_cx;
3585+
auto default_res = trans_fail(default_cx, expr.span,
3586+
"non-exhaustive match failure");
35873587

35883588
// FIXME: This is very wrong; we should phi together all the arm blocks,
35893589
// since this is an expression.

0 commit comments

Comments
 (0)