1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// build-pass (FIXME(62277): could be check-pass?)
#![feature(exclusive_range_pattern)]
#![warn(unreachable_patterns)]
fn main() {
// These cases should generate no warning.
match 10 {
1..10 => {},
10 => {},
_ => {},
}
match 10 {
1..10 => {},
9..=10 => {},
_ => {},
}
match 10 {
1..10 => {},
10..=10 => {},
_ => {},
}
// These cases should generate an "unreachable pattern" warning.
match 10 {
1..10 => {},
9 => {},
_ => {},
}
match 10 {
1..10 => {},
8..=9 => {},
_ => {},
}
match 10 {
1..10 => {},
9..=9 => {},
_ => {},
}
}
|