Skip to content

Commit 76c72b2

Browse files
committed
---
yaml --- r: 4903 b: refs/heads/master c: a3c8d4a h: refs/heads/master i: 4901: e5a8d50 4899: ca415d2 4895: 86c9fe5 v: v3
1 parent 72a010d commit 76c72b2

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
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: 68fd28c2c139109bac3372c5fe6d05b228d6a579
2+
refs/heads/master: a3c8d4a5a58b42db6b8795980992e1063e84f59f

trunk/src/comp/middle/trans.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3188,11 +3188,11 @@ fn trans_for_each(cx: &@block_ctxt, local: &@ast::local, seq: &@ast::expr,
31883188

31893189
fn trans_while(cx: &@block_ctxt, cond: &@ast::expr, body: &ast::blk) ->
31903190
result {
3191-
let cond_cx = new_scope_block_ctxt(cx, "while cond");
3192-
let next_cx = new_sub_block_ctxt(cx, "next");
3191+
let next_cx = new_sub_block_ctxt(cx, "while next");
3192+
let cond_cx = new_loop_scope_block_ctxt(cx, option::none::<@block_ctxt>,
3193+
next_cx, "while cond");
31933194
let body_cx =
3194-
new_loop_scope_block_ctxt(cx, option::none::<@block_ctxt>, next_cx,
3195-
"while loop body");
3195+
new_scope_block_ctxt(cond_cx, "while loop body");
31963196
let body_res = trans_block(body_cx, body, return);
31973197
let cond_res = trans_expr(cond_cx, cond);
31983198
body_res.bcx.build.Br(cond_cx.llbb);

trunk/src/test/run-pass/while-cont.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Issue #825: Should recheck the loop contition after continuing
2+
fn main() {
3+
let i = 1;
4+
while i > 0 {
5+
assert i > 0;
6+
log i;
7+
i -= 1;
8+
cont;
9+
}
10+
}

0 commit comments

Comments
 (0)