Skip to content

Commit 04f062f

Browse files
committed
Fix lurking bug in matching of nil
Which was somehow made visible by the DPS changes.
1 parent b1b202d commit 04f062f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/comp/middle/trans_alt.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,11 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
444444
}
445445
}
446446
lit(l) {
447-
kind =
448-
alt l.node {
449-
ast::lit_str(_) { compare }
450-
_ { test_val = Load(bcx, val); switch }
451-
};
447+
kind = alt l.node {
448+
ast::lit_str(_) { compare }
449+
ast::lit_nil. { test_val = Load(bcx, val); compare }
450+
_ { test_val = Load(bcx, val); switch }
451+
};
452452
}
453453
}
454454
}
@@ -486,7 +486,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
486486
let t = ty::node_id_to_type(ccx.tcx, pat_id);
487487
let eq =
488488
trans::trans_compare(bcx, ast::eq, test_val, t, r.val, t);
489-
let cleanup_cx = trans::trans_block_cleanups(bcx, compare_cx);
489+
let cleanup_cx = trans::trans_block_cleanups(eq.bcx, compare_cx);
490490
bcx = new_sub_block_ctxt(bcx, "compare_next");
491491
CondBr(cleanup_cx, eq.val, opt_cx.llbb, bcx.llbb);
492492
}

0 commit comments

Comments
 (0)