Skip to content

Commit 9f44df6

Browse files
committed
Ensure values created in an alt guard are cleaned up properly
1 parent 0549147 commit 9f44df6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/comp/middle/trans_alt.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,10 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef],
304304
bcx.fcx.lllocals.insert
305305
(val, option::get(assoc(key, m[0].bound)));
306306
}
307-
let {bcx: guard_cx, val: guard_val} =
307+
let {bcx: guard_bcx, val: guard_val} =
308308
trans::trans_expr(guard_cx, e);
309-
guard_cx.build.CondBr(guard_val, next_cx.llbb, else_cx.llbb);
309+
guard_bcx = trans::trans_block_cleanups(guard_bcx, guard_cx);
310+
guard_bcx.build.CondBr(guard_val, next_cx.llbb, else_cx.llbb);
310311
compile_submatch(else_cx, vec::slice(m, 1u, vec::len(m)),
311312
vals, f, exits);
312313
bcx = next_cx;

0 commit comments

Comments
 (0)