]> git.lizzy.rs Git - rust.git/commitdiff
Un-XFAIL do-while-body-fails
authorTim Chevalier <chevalier@alum.wellesley.edu>
Fri, 12 Aug 2011 23:15:03 +0000 (16:15 -0700)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Fri, 12 Aug 2011 23:26:10 +0000 (16:26 -0700)
Made it work both with optimization enabled, and with optimization
disabled. Huzzah!

src/comp/middle/trans.rs
src/test/run-fail/do-while-body-fails.rs

index a0df89444cd95e020b7e2436dc27a97057701fa8..213a0e8704508e61254d63d3678e7c7daa283fb9 100644 (file)
@@ -3805,7 +3805,14 @@ fn trans_do_while(cx: &@block_ctxt, body: &ast::blk, cond: &@ast::expr) ->
     if is_terminated(body_res.bcx) {
         // This is kind of ridiculous, but no permutations
         // involving body_res or body_cx.val worked.
-        ret trans_block(cx, body, return);
+        let rs = trans_block(cx, body, return);
+        if ! is_terminated (next_cx) {
+            next_cx.build.Unreachable();
+        }
+        if ! is_terminated (body_cx) {
+            body_cx.build.Unreachable();
+        }
+        ret rs;
     }
     let cond_res = trans_expr(body_res.bcx, cond);
     cond_res.bcx.build.CondBr(cond_res.val, body_cx.llbb, next_cx.llbb);
index daeba83db0ee3ada64d0567d71e51a79864d3bd3..1a6cac5fabc14571c5de31ae69131d1d66e7f97b 100644 (file)
@@ -1,6 +1,3 @@
-// xfail-stage1
-// xfail-stage2
-// xfail-stage3
 // error-pattern:quux
 fn main() {
     let x: int = do { fail "quux" } while (true);