about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-09-27 22:49:33 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-09-27 22:49:33 +0200
commit04f062f9d4a77bf52a4a431052b79e8e8a7a8e80 (patch)
tree647f592f101d914ac36dcd6c12a74b999d608307 /src/comp
parentb1b202d302d1e84886360f9c8f146b9562db5f23 (diff)
downloadrust-04f062f9d4a77bf52a4a431052b79e8e8a7a8e80.tar.gz
rust-04f062f9d4a77bf52a4a431052b79e8e8a7a8e80.zip
Fix lurking bug in matching of nil
Which was somehow made visible by the DPS changes.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/trans_alt.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/comp/middle/trans_alt.rs b/src/comp/middle/trans_alt.rs
index 87adda1f18f..e2386f9623c 100644
--- a/src/comp/middle/trans_alt.rs
+++ b/src/comp/middle/trans_alt.rs
@@ -444,11 +444,11 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
             }
           }
           lit(l) {
-            kind =
-                alt l.node {
-                  ast::lit_str(_) { compare }
-                  _ { test_val = Load(bcx, val); switch }
-                };
+            kind = alt l.node {
+              ast::lit_str(_) { compare }
+              ast::lit_nil. { test_val = Load(bcx, val); compare }
+              _ { test_val = Load(bcx, val); switch }
+            };
           }
         }
     }
@@ -486,7 +486,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
             let t = ty::node_id_to_type(ccx.tcx, pat_id);
             let eq =
                 trans::trans_compare(bcx, ast::eq, test_val, t, r.val, t);
-            let cleanup_cx = trans::trans_block_cleanups(bcx, compare_cx);
+            let cleanup_cx = trans::trans_block_cleanups(eq.bcx, compare_cx);
             bcx = new_sub_block_ctxt(bcx, "compare_next");
             CondBr(cleanup_cx, eq.val, opt_cx.llbb, bcx.llbb);
           }