Zero locals that are inited via alt expressions. Closes #945

This commit is contained in:
Brian Anderson 2011-09-20 10:28:16 -07:00
parent e33f116598
commit 870117f44e
2 changed files with 13 additions and 0 deletions

View file

@ -4664,6 +4664,7 @@ fn init_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt {
ccx: ccx};
fn visit_expr(ex: @ast::expr, e: env, v: vt<env>) {
let might_not_init = alt ex.node {
ast::expr_alt(_, _) { true }
ast::expr_ret(_) { true }
ast::expr_break. { true }
ast::expr_cont. { true }

View file

@ -0,0 +1,12 @@
// Issue #945
// error-pattern:non-exhaustive match failure
fn test_box() {
@0;
}
fn test_str() {
let res = alt false { true { "happy" } };
}
fn main() {
test_box();
test_str();
}