]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/usefulness/match-range-fail-dominate.rs
Add test for eval order for a+=b
[rust.git] / src / test / ui / pattern / usefulness / match-range-fail-dominate.rs
1 #![deny(unreachable_patterns, overlapping_patterns)]
2
3 fn main() {
4     match 5 {
5       1 ..= 10 => { }
6       5 ..= 6 => { }
7       //~^ ERROR unreachable pattern
8       _ => {}
9     };
10
11     match 5 {
12       3 ..= 6 => { }
13       4 ..= 6 => { }
14       //~^ ERROR unreachable pattern
15       _ => {}
16     };
17
18     match 5 {
19       4 ..= 6 => { }
20       4 ..= 6 => { }
21       //~^ ERROR unreachable pattern
22       _ => {}
23     };
24
25     match 'c' {
26       'A' ..= 'z' => {}
27       'a' ..= 'z' => {}
28       //~^ ERROR unreachable pattern
29       _ => {}
30     };
31
32     match 1.0f64 {
33       0.01f64 ..= 6.5f64 => {}
34       //~^ WARNING floating-point types cannot be used in patterns
35       //~| WARNING floating-point types cannot be used in patterns
36       //~| WARNING floating-point types cannot be used in patterns
37       //~| WARNING floating-point types cannot be used in patterns
38       //~| WARNING this was previously accepted by the compiler
39       //~| WARNING this was previously accepted by the compiler
40       //~| WARNING this was previously accepted by the compiler
41       //~| WARNING this was previously accepted by the compiler
42       0.02f64 => {} //~ ERROR unreachable pattern
43       //~^ WARNING floating-point types cannot be used in patterns
44       //~| WARNING floating-point types cannot be used in patterns
45       //~| WARNING this was previously accepted by the compiler
46       //~| WARNING this was previously accepted by the compiler
47       _ => {}
48     };
49 }