about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <andersrb@gmail.com>2011-04-02 14:12:19 -0400
committerBrian Anderson <andersrb@gmail.com>2011-04-02 20:35:50 -0400
commit6e6acaa39a2d6e7491ef282e6ca0f6b4db808321 (patch)
treec661fa8031f36dc4a642cc48fc59009e763ebb66
parent9d0a505d61e77d6186631552065438aa04944b12 (diff)
downloadrust-6e6acaa39a2d6e7491ef282e6ca0f6b4db808321.tar.gz
rust-6e6acaa39a2d6e7491ef282e6ca0f6b4db808321.zip
Fail on non-exhaustive alt matches
-rw-r--r--src/comp/middle/trans.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 5b4a08f3f63..b16acfd9d4c 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -3581,9 +3581,9 @@ fn trans_alt(@block_ctxt cx, @ast.expr expr, vec[ast.arm] arms)
         this_cx = next_cx;
     }
 
-    // FIXME: This is executed when none of the patterns match; it should fail
-    // instead!
-    this_cx.build.Br(last_cx.llbb);
+    auto default_cx = this_cx;
+    auto default_res = trans_fail(default_cx, expr.span,
+                                  "non-exhaustive match failure");
 
     // FIXME: This is very wrong; we should phi together all the arm blocks,
     // since this is an expression.