mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 21:24:12 +00:00
36 lines
1.4 KiB
Rust
36 lines
1.4 KiB
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
|
|
..=1 + 2 => (),
|
|
//~^ error: expected a pattern range bound, found an expression
|
|
(4).. => (),
|
|
//~^ error: range pattern bounds cannot have parentheses
|
|
(-4 + 0).. => (),
|
|
//~^ error: expected a pattern range bound, found an expression
|
|
//~| error: range pattern bounds cannot have parentheses
|
|
(1 + 4)...1 * 2 => (),
|
|
//~^ error: expected a pattern range bound, found an expression
|
|
//~| error: expected a pattern range bound, found an expression
|
|
//~| error: range pattern bounds cannot have parentheses
|
|
//~| warning: `...` range patterns are deprecated
|
|
//~| warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
|
0.x()..="y".z() => (),
|
|
//~^ error: expected a pattern range bound, found a method call
|
|
//~| error: expected a pattern range bound, found a method call
|
|
};
|
|
}
|
|
|
|
macro_rules! m {
|
|
($pat:pat) => {};
|
|
(($s:literal)..($e:literal)) => {};
|
|
}
|
|
|
|
m!((7)..(7));
|