mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
a2dcb3a6d9
Parsing now accepts a match arm without a body, so we must make sure to only accept that if the pattern is a never pattern.
80 lines
2.1 KiB
Rust
80 lines
2.1 KiB
Rust
macro_rules! pat {
|
|
() => { Some(_) }
|
|
}
|
|
|
|
fn main() {
|
|
match Some(false) {
|
|
Some(_)
|
|
//~^ ERROR `match` arm with no body
|
|
//~| HELP add a body after the pattern
|
|
}
|
|
match Some(false) {
|
|
Some(_)
|
|
_ => {}
|
|
//~^ ERROR expected one of
|
|
}
|
|
match Some(false) {
|
|
Some(_),
|
|
//~^ ERROR unexpected `,` in pattern
|
|
//~| HELP try adding parentheses to match on a tuple
|
|
//~| HELP or a vertical bar to match on multiple alternatives
|
|
}
|
|
match Some(false) {
|
|
Some(_),
|
|
//~^ ERROR unexpected `,` in pattern
|
|
//~| HELP try adding parentheses to match on a tuple
|
|
//~| HELP or a vertical bar to match on multiple alternatives
|
|
_ => {}
|
|
}
|
|
match Some(false) {
|
|
Some(_) if true
|
|
//~^ ERROR `match` arm with no body
|
|
//~| HELP add a body after the pattern
|
|
}
|
|
match Some(false) {
|
|
Some(_) if true
|
|
_ => {}
|
|
//~^ ERROR expected one of
|
|
}
|
|
match Some(false) {
|
|
Some(_) if true,
|
|
//~^ ERROR `match` arm with no body
|
|
//~| HELP add a body after the pattern
|
|
}
|
|
match Some(false) {
|
|
Some(_) if true,
|
|
//~^ ERROR `match` arm with no body
|
|
//~| HELP add a body after the pattern
|
|
_ => {}
|
|
}
|
|
match Some(false) {
|
|
pat!()
|
|
//~^ ERROR `match` arm with no body
|
|
//~| HELP add a body after the pattern
|
|
}
|
|
match Some(false) {
|
|
pat!(),
|
|
//~^ ERROR `match` arm with no body
|
|
//~| HELP add a body after the pattern
|
|
}
|
|
match Some(false) {
|
|
pat!() if true,
|
|
//~^ ERROR `match` arm with no body
|
|
//~| HELP add a body after the pattern
|
|
}
|
|
match Some(false) {
|
|
pat!()
|
|
//~^ ERROR expected `,` following `match` arm
|
|
//~| HELP missing a comma here
|
|
//~| ERROR `match` arm with no body
|
|
//~| HELP add a body after the pattern
|
|
_ => {}
|
|
}
|
|
match Some(false) {
|
|
pat!(),
|
|
//~^ ERROR `match` arm with no body
|
|
//~| HELP add a body after the pattern
|
|
_ => {}
|
|
}
|
|
}
|