diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 5c615f134ecf..3c7335c4408f 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -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) { let might_not_init = alt ex.node { + ast::expr_alt(_, _) { true } ast::expr_ret(_) { true } ast::expr_break. { true } ast::expr_cont. { true } diff --git a/src/test/run-fail/unwind-alt.rs b/src/test/run-fail/unwind-alt.rs new file mode 100644 index 000000000000..e59e5b9904ab --- /dev/null +++ b/src/test/run-fail/unwind-alt.rs @@ -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(); +} \ No newline at end of file