Zero locals that are inited via alt expressions. Closes #945
This commit is contained in:
parent
e33f116598
commit
870117f44e
2 changed files with 13 additions and 0 deletions
|
|
@ -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 }
|
||||
|
|
|
|||
12
src/test/run-fail/unwind-alt.rs
Normal file
12
src/test/run-fail/unwind-alt.rs
Normal 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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue