handle fail inside a for loop
This commit is contained in:
parent
6d0cb70fc3
commit
ded9008e38
1 changed files with 4 additions and 1 deletions
|
@ -4312,7 +4312,10 @@ fn trans_for(&@block_ctxt cx, &@ast::local local, &@ast::expr seq,
|
|||
auto bcx = copy_val(local_res.bcx, INIT, local_res.val, curr, t).bcx;
|
||||
scope_cx.cleanups += [clean(bind drop_slot(_, local_res.val, t))];
|
||||
bcx = trans_block(bcx, body, return).bcx;
|
||||
bcx.build.Br(next_cx.llbb);
|
||||
if (!bcx.build.is_terminated()) {
|
||||
bcx.build.Br(next_cx.llbb);
|
||||
// otherwise, this code is unreachable
|
||||
}
|
||||
ret rslt(next_cx, C_nil());
|
||||
}
|
||||
auto next_cx = new_sub_block_ctxt(cx, "next");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue