rust/tests/ui/parser/pat-recover-ranges.rs
Lieselotte 4e0baddbbf
Recover parentheses in range patterns
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2024-01-03 15:27:58 +01:00

20 lines
488 B
Rust

fn main() {
match -1 {
0..=1 => (),
0..=(1) => (),
//~^ error: range pattern bounds cannot have parentheses
(-12)..=4 => (),
//~^ error: range pattern bounds cannot have parentheses
(0)..=(-4) => (),
//~^ error: range pattern bounds cannot have parentheses
//~| error: range pattern bounds cannot have parentheses
};
}
macro_rules! m {
($pat:pat) => {};
(($s:literal)..($e:literal)) => {};
}
m!((7)..(7));