Skip to content

Commit b49a4b1

Browse files
committed
---
yaml --- r: 6570 b: refs/heads/master c: 96b0881 h: refs/heads/master v: v3
1 parent dc5f778 commit b49a4b1

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 9711596bec1fbc40a09c7c23ef12fe06a8d9bd3d
2+
refs/heads/master: 96b0881a685e4960439f56cc5ffdcff112894d3d

trunk/src/comp/middle/trans.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2844,8 +2844,11 @@ fn trans_do_while(cx: @block_ctxt, body: ast::blk, cond: @ast::expr) ->
28442844
new_loop_scope_block_ctxt(cx, option::none::<@block_ctxt>, next_cx,
28452845
"do-while loop body");
28462846
let body_end = trans_block(body_cx, body);
2847-
let cond_res = trans_temp_expr(body_end, cond);
2848-
CondBr(cond_res.bcx, cond_res.val, body_cx.llbb, next_cx.llbb);
2847+
let cond_cx = new_scope_block_ctxt(body_cx, "do-while cond");
2848+
Br(body_end, cond_cx.llbb);
2849+
let cond_res = trans_temp_expr(cond_cx, cond);
2850+
let cond_bcx = trans_block_cleanups(cond_res.bcx, cond_cx);
2851+
CondBr(cond_bcx, cond_res.val, body_cx.llbb, next_cx.llbb);
28492852
Br(cx, body_cx.llbb);
28502853
ret next_cx;
28512854
}

trunk/src/test/run-pass/issue-1257.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fn main () {
2+
let line = "";
3+
let i = 0;
4+
do {
5+
line = if i == 9 { "exit" } else { "notexit" };
6+
i += 1;
7+
} while line != "exit";
8+
}

0 commit comments

Comments
 (0)