Skip to content

Commit c38ede3

Browse files
committed
---
yaml --- r: 6095 b: refs/heads/master c: eef9a0b h: refs/heads/master i: 6093: 69c0718 6091: 96f99fe 6087: 5c754bf 6079: c9ad0e2 v: v3
1 parent 04769c4 commit c38ede3

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: d8d35e7c400fe0140de128a41d4b9f2ff7a3735b
2+
refs/heads/master: eef9a0bd3941a6d2d25db4635295198903575e6b

trunk/src/comp/middle/trans_alt.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,10 @@ fn trans_alt(cx: @block_ctxt, expr: @ast::expr, arms: [ast::arm],
624624
dest: trans::dest) -> @block_ctxt {
625625
let bodies = [];
626626
let match: match = [];
627-
let er = trans::trans_temp_expr(cx, expr);
627+
let alt_cx = new_scope_block_ctxt(cx, "alt");
628+
Br(cx, alt_cx.llbb);
629+
630+
let er = trans::trans_temp_expr(alt_cx, expr);
628631
if er.bcx.unreachable { ret er.bcx; }
629632

630633
for a: ast::arm in arms {
@@ -654,7 +657,7 @@ fn trans_alt(cx: @block_ctxt, expr: @ast::expr, arms: [ast::arm],
654657
let t = trans::node_id_type(cx.fcx.lcx.ccx, expr.id);
655658
let vr = trans::spill_if_immediate(er.bcx, er.val, t);
656659
compile_submatch(vr.bcx, match, [vr.val],
657-
bind mk_fail(cx, expr.span, fail_cx), exit_map);
660+
bind mk_fail(alt_cx, expr.span, fail_cx), exit_map);
658661

659662
let arm_cxs = [], arm_dests = [], i = 0u;
660663
for a: ast::arm in arms {
@@ -667,7 +670,11 @@ fn trans_alt(cx: @block_ctxt, expr: @ast::expr, arms: [ast::arm],
667670
}
668671
i += 1u;
669672
}
670-
ret trans::join_returns(cx, arm_cxs, arm_dests, dest);
673+
let after_cx = trans::join_returns(cx, arm_cxs, arm_dests, dest);
674+
after_cx = trans::trans_block_cleanups(after_cx, alt_cx);
675+
let next_cx = new_sub_block_ctxt(after_cx, "next");
676+
Br(after_cx, next_cx.llbb);
677+
ret next_cx;
671678
}
672679

673680
// Not alt-related, but similar to the pattern-munging code above

0 commit comments

Comments
 (0)