aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/comp/middle/trans.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index bd1836b5..17d1a141 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -1131,6 +1131,11 @@ impure fn trans_block(@block_ctxt cx, &ast.block b) -> result {
for (@ast.stmt s in b.node.stmts) {
r = trans_stmt(bcx, *s);
bcx = r.bcx;
+ // If we hit a terminator, control won't go any further so
+ // we're in dead-code land. Stop here.
+ if (is_terminated(bcx)) {
+ ret r;
+ }
}
bcx = trans_block_cleanups(bcx);