1 #![feature(exclusive_range_pattern)]
2 #![allow(overlapping_range_endpoints)]
3 #![deny(unreachable_patterns)]
6 ($s:expr, $t1:pat, $t2:pat) => {
17 m!(0u8, 42, 42); //~ ERROR unreachable pattern
21 m!(0u8, 20..=30, 20); //~ ERROR unreachable pattern
22 m!(0u8, 20..=30, 21); //~ ERROR unreachable pattern
23 m!(0u8, 20..=30, 25); //~ ERROR unreachable pattern
24 m!(0u8, 20..=30, 29); //~ ERROR unreachable pattern
25 m!(0u8, 20..=30, 30); //~ ERROR unreachable pattern
28 m!(0u8, 20..30, 20); //~ ERROR unreachable pattern
29 m!(0u8, 20..30, 21); //~ ERROR unreachable pattern
30 m!(0u8, 20..30, 25); //~ ERROR unreachable pattern
31 m!(0u8, 20..30, 29); //~ ERROR unreachable pattern
35 m!(0u8, 20..=30, 20..=30); //~ ERROR unreachable pattern
36 m!(0u8, 20.. 30, 20.. 30); //~ ERROR unreachable pattern
37 m!(0u8, 20..=30, 20.. 30); //~ ERROR unreachable pattern
38 m!(0u8, 20..=30, 19..=30);
39 m!(0u8, 20..=30, 21..=30); //~ ERROR unreachable pattern
40 m!(0u8, 20..=30, 20..=29); //~ ERROR unreachable pattern
41 m!(0u8, 20..=30, 20..=31);
42 m!('a', 'A'..='z', 'a'..='z'); //~ ERROR unreachable pattern
49 5..=8 => {}, //~ ERROR unreachable pattern
55 5..15 => {}, //~ ERROR unreachable pattern
62 5..25 => {}, //~ ERROR unreachable pattern
70 5..25 => {}, //~ ERROR unreachable pattern
76 5..15 => {}, //~ ERROR unreachable pattern
79 // Chars between '\u{D7FF}' and '\u{E000}' are invalid even though ranges that contain them are
83 '\u{D7FF}'..='\u{E000}' => {}, //~ ERROR unreachable pattern
86 '\u{0}'..='\u{D7FF}' => {},
87 '\u{E000}'..='\u{10_FFFF}' => {},
88 '\u{D7FF}'..='\u{E000}' => {}, // FIXME should be unreachable
92 (0..=255, false) => {}
93 (0..=255, true) => {} // ok
96 (false, 0..=255) => {}
97 (true, 0..=255) => {} // ok
101 const BAR: &i32 = &42;
104 &FOO => {} //~ ERROR unreachable pattern
105 BAR => {} //~ ERROR unreachable pattern
108 // Regression test, see https://github.com/rust-lang/rust/pull/66326#issuecomment-552889933