parent
9711596bec
commit
96b0881a68
|
@ -2844,8 +2844,11 @@ fn trans_do_while(cx: @block_ctxt, body: ast::blk, cond: @ast::expr) ->
|
|||
new_loop_scope_block_ctxt(cx, option::none::<@block_ctxt>, next_cx,
|
||||
"do-while loop body");
|
||||
let body_end = trans_block(body_cx, body);
|
||||
let cond_res = trans_temp_expr(body_end, cond);
|
||||
CondBr(cond_res.bcx, cond_res.val, body_cx.llbb, next_cx.llbb);
|
||||
let cond_cx = new_scope_block_ctxt(body_cx, "do-while cond");
|
||||
Br(body_end, cond_cx.llbb);
|
||||
let cond_res = trans_temp_expr(cond_cx, cond);
|
||||
let cond_bcx = trans_block_cleanups(cond_res.bcx, cond_cx);
|
||||
CondBr(cond_bcx, cond_res.val, body_cx.llbb, next_cx.llbb);
|
||||
Br(cx, body_cx.llbb);
|
||||
ret next_cx;
|
||||
}
|
||||
|
|
8
src/test/run-pass/issue-1257.rs
Normal file
8
src/test/run-pass/issue-1257.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
fn main () {
|
||||
let line = "";
|
||||
let i = 0;
|
||||
do {
|
||||
line = if i == 9 { "exit" } else { "notexit" };
|
||||
i += 1;
|
||||
} while line != "exit";
|
||||
}
|
Loading…
Reference in a new issue