]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int-deny.rs
Rollup merge of #79293 - Havvy:test-eval-order-compound-assign, r=Mark-Simulacrum
[rust.git] / src / test / ui / pattern / usefulness / integer-ranges / pointer-sized-int-deny.rs
1 #![feature(exclusive_range_pattern)]
2
3 macro_rules! m {
4     ($s:expr, $($t:tt)+) => {
5         match $s { $($t)+ => {} }
6     }
7 }
8
9 fn main() {
10     match 0usize {
11         //~^ ERROR non-exhaustive patterns
12         0 ..= usize::MAX => {}
13     }
14
15     match 0isize {
16         //~^ ERROR non-exhaustive patterns
17         isize::MIN ..= isize::MAX => {}
18     }
19
20     m!(0usize, 0..=usize::MAX);
21     //~^ ERROR non-exhaustive patterns
22     m!(0usize, 0..5 | 5..=usize::MAX);
23     //~^ ERROR non-exhaustive patterns
24     m!(0usize, 0..usize::MAX | usize::MAX);
25     //~^ ERROR non-exhaustive patterns
26     m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
27     //~^ ERROR non-exhaustive patterns
28
29     m!(0isize, isize::MIN..=isize::MAX);
30     //~^ ERROR non-exhaustive patterns
31     m!(0isize, isize::MIN..5 | 5..=isize::MAX);
32     //~^ ERROR non-exhaustive patterns
33     m!(0isize, isize::MIN..isize::MAX | isize::MAX);
34     //~^ ERROR non-exhaustive patterns
35     m!((0isize, true), (isize::MIN..5, true)
36         | (5..=isize::MAX, true) | (isize::MIN..=isize::MAX, false));
37     //~^^ ERROR non-exhaustive patterns
38
39     match 0isize {
40         //~^ ERROR non-exhaustive patterns
41         isize::MIN ..= -1 => {}
42         0 => {}
43         1 ..= isize::MAX => {}
44     }
45
46     match 7usize {}
47     //~^ ERROR non-exhaustive patterns
48 }