Skip to content

Commit c212c0e

Browse files
committedDec 1, 2015
Auto merge of #30116 - petrochenkov:exhaust, r=alexcrichton
Fixes #29383 (comment) r? @bluss
2 parents baf0208 + 23c7e66 commit c212c0e

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
 

‎src/librustc_typeck/check/_match.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,11 @@ pub fn check_pat_enum<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
636636

637637
let report_bad_struct_kind = |is_warning| {
638638
bad_struct_kind_err(tcx.sess, pat.span, path, is_warning);
639-
fcx.write_error(pat.id);
639+
if is_warning {
640+
return
641+
}
640642

643+
fcx.write_error(pat.id);
641644
if let Some(subpats) = subpats {
642645
for pat in subpats {
643646
check_pat(pcx, &**pat, tcx.types.err);

‎src/test/run-pass/issue-pr29383.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
enum E {
12+
A,
13+
B,
14+
}
15+
16+
fn main() {
17+
match None {
18+
None => {}
19+
Some(E::A(..)) => {}
20+
Some(E::B(..)) => {}
21+
}
22+
}

0 commit comments

Comments
 (0)
Please sign in to comment.