]>
Commit | Line | Data |
---|---|---|
041b39d2 XL |
1 | // Copyright 2017 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 | ||
83c7162d | 11 | // compile-pass |
ff7c6d11 | 12 | |
041b39d2 | 13 | #![feature(exclusive_range_pattern)] |
3b2f2976 | 14 | #![warn(unreachable_patterns)] |
041b39d2 XL |
15 | |
16 | fn main() { | |
17 | // These cases should generate no warning. | |
18 | match 10 { | |
19 | 1..10 => {}, | |
20 | 10 => {}, | |
21 | _ => {}, | |
22 | } | |
23 | ||
24 | match 10 { | |
25 | 1..10 => {}, | |
26 | 9...10 => {}, | |
27 | _ => {}, | |
28 | } | |
29 | ||
30 | match 10 { | |
31 | 1..10 => {}, | |
32 | 10...10 => {}, | |
33 | _ => {}, | |
34 | } | |
35 | ||
36 | // These cases should generate an "unreachable pattern" warning. | |
37 | match 10 { | |
38 | 1..10 => {}, | |
39 | 9 => {}, | |
40 | _ => {}, | |
41 | } | |
42 | ||
43 | match 10 { | |
44 | 1..10 => {}, | |
45 | 8...9 => {}, | |
46 | _ => {}, | |
47 | } | |
48 | ||
49 | match 10 { | |
50 | 1..10 => {}, | |
51 | 9...9 => {}, | |
52 | _ => {}, | |
53 | } | |
3b2f2976 | 54 | } |