Skip to content

Commit 56257d9

Browse files
committed
---
yaml --- r: 11820 b: refs/heads/master c: aeb445b h: refs/heads/master v: v3
1 parent c98dd0f commit 56257d9

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,5 +1,5 @@
11
---
2-
refs/heads/master: b87cdd857228e576d0fcccba0d92b0b231375923
2+
refs/heads/master: aeb445b2ea25f9629df1d5d8fbd2906a92c8e719
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustc/middle/trans/base.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,10 +2001,12 @@ fn trans_for(cx: block, local: @ast::local, seq: @ast::expr,
20012001
fn trans_while(cx: block, cond: @ast::expr, body: ast::blk)
20022002
-> block {
20032003
let next_cx = sub_block(cx, "while next");
2004-
let cond_cx = loop_scope_block(cx, cont_self, next_cx,
2005-
"while cond", body.span);
2006-
let body_cx = scope_block(cond_cx, "while loop body");
2007-
Br(cx, cond_cx.llbb);
2004+
let loop_cx = loop_scope_block(cx, cont_self, next_cx,
2005+
"while loop", body.span);
2006+
let cond_cx = scope_block(loop_cx, "while loop cond");
2007+
let body_cx = scope_block(loop_cx, "while loop body");
2008+
Br(cx, loop_cx.llbb);
2009+
Br(loop_cx, cond_cx.llbb);
20082010
let cond_res = trans_temp_expr(cond_cx, cond);
20092011
let cond_bcx = trans_block_cleanups(cond_res.bcx, cond_cx);
20102012
CondBr(cond_bcx, cond_res.val, body_cx.llbb, next_cx.llbb);

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Issue 1974
2+
// Don't double free the condition allocation
3+
fn main() {
4+
let s = "hej";
5+
while s != "" {
6+
ret;
7+
}
8+
}

0 commit comments

Comments
 (0)