diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2011-08-12 16:15:03 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2011-08-12 16:26:10 -0700 |
| commit | c01e48748504934e27ac89b2ca12d7d626e3be42 (patch) | |
| tree | 5bc6ba38ad951f1aa306aa0200e45472f39f97b0 | |
| parent | 60e1cead9bab129b1937a11c71ab2ab2fd751792 (diff) | |
Un-XFAIL do-while-body-fails
Made it work both with optimization enabled, and with optimization disabled. Huzzah!
| -rw-r--r-- | src/comp/middle/trans.rs | 9 | ||||
| -rw-r--r-- | src/test/run-fail/do-while-body-fails.rs | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index a0df89444cd..213a0e87045 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -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); diff --git a/src/test/run-fail/do-while-body-fails.rs b/src/test/run-fail/do-while-body-fails.rs index daeba83db0e..1a6cac5fabc 100644 --- a/src/test/run-fail/do-while-body-fails.rs +++ b/src/test/run-fail/do-while-body-fails.rs @@ -1,6 +1,3 @@ -// xfail-stage1 -// xfail-stage2 -// xfail-stage3 // error-pattern:quux fn main() { let x: int = do { fail "quux" } while (true); |
