Skip to content

Commit d1b9ddc

Browse files
committed
Add testcase for bootstrap blocker and fix for each result type to nil.
1 parent 6651826 commit d1b9ddc

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

src/comp/middle/trans.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,12 +3583,12 @@ fn trans_for_each(@block_ctxt cx,
35833583
bcx.build.Store(lllvar, lllvarptr);
35843584
fcx.llupvars.insert(decl_id, lllvarptr);
35853585

3586-
auto res = trans_block(bcx, body);
3586+
auto r = trans_block(bcx, body);
35873587

35883588
// Tie up the llallocas -> lltop edge.
35893589
new_builder(fcx.llallocas).Br(lltop);
35903590

3591-
res.bcx.build.RetVoid();
3591+
r.bcx.build.RetVoid();
35923592

35933593

35943594
// Step 3: Call iter passing [lliterbody, llenv], plus other args.
@@ -3611,10 +3611,11 @@ fn trans_for_each(@block_ctxt cx,
36113611
cx.build.Store(llenvblobptr, env_cell);
36123612

36133613
// log "lliterbody: " + val_str(cx.fcx.lcx.ccx.tn, lliterbody);
3614-
ret trans_call(cx, f,
3614+
r = trans_call(cx, f,
36153615
some[ValueRef](cx.build.Load(pair)),
36163616
args,
36173617
ann);
3618+
ret res(r.bcx, C_nil());
36183619
}
36193620
}
36203621
fail;

src/test/run-pass/alt-phi.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
tag thing { a; b; c; }
2+
3+
iter foo() -> int {
4+
put 10;
5+
}
6+
7+
fn main() {
8+
auto x = true;
9+
alt (a) {
10+
case (a) {
11+
x = true;
12+
for each (int i in foo()) {
13+
}
14+
}
15+
case (b) {
16+
x = false;
17+
}
18+
case (c) {
19+
x = false;
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)