Skip to content

Commit c956cec

Browse files
committed
---
yaml --- r: 44332 b: refs/heads/snap-stage3 c: 061a223 h: refs/heads/master v: v3
1 parent 9aef254 commit c956cec

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 8e492ccaa709172d74aac2d4f086af6886aa4c64
4+
refs/heads/snap-stage3: 061a2237230d3abcdb30ecb8987e5de17e67a58e
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/check_match.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, &&s: (), v: visit::vt<()>) {
101101
_ => { /* We assume only enum types can be uninhabited */ }
102102
}
103103
let arms = vec::concat(arms.filter_mapped(unguarded_pat));
104-
check_exhaustive(cx, ex.span, arms);
104+
if arms.is_empty() {
105+
cx.tcx.sess.span_err(ex.span, ~"non-exhaustive patterns");
106+
} else {
107+
check_exhaustive(cx, ex.span, arms);
108+
}
105109
}
106110
_ => ()
107111
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2013 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+
fn main() {
12+
match 0 { 1 => () } //~ ERROR non-exhaustive patterns
13+
match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns
14+
}

0 commit comments

Comments
 (0)