parser: multiple-pattern-typo: cover more or-pattern places.
This commit is contained in:
parent
d34ee769b0
commit
5f57feec0a
2 changed files with 73 additions and 2 deletions
|
|
@ -1,7 +1,40 @@
|
|||
#![feature(or_patterns)]
|
||||
//~^ WARN the feature `or_patterns` is incomplete and may cause the compiler to crash
|
||||
|
||||
fn main() {
|
||||
let x = 3;
|
||||
|
||||
match x {
|
||||
1 | 2 || 3 => (), //~ ERROR unexpected token `||` after pattern
|
||||
_ => (),
|
||||
}
|
||||
|
||||
match x {
|
||||
(1 | 2 || 3) => (), //~ ERROR unexpected token `||` after pattern
|
||||
_ => (),
|
||||
}
|
||||
|
||||
match (x,) {
|
||||
(1 | 2 || 3,) => (), //~ ERROR unexpected token `||` after pattern
|
||||
_ => (),
|
||||
}
|
||||
|
||||
struct TS(u8);
|
||||
|
||||
match TS(x) {
|
||||
TS(1 | 2 || 3) => (), //~ ERROR unexpected token `||` after pattern
|
||||
_ => (),
|
||||
}
|
||||
|
||||
struct NS { f: u8 }
|
||||
|
||||
match (NS { f: x }) {
|
||||
NS { f: 1 | 2 || 3 } => (), //~ ERROR unexpected token `||` after pattern
|
||||
_ => (),
|
||||
}
|
||||
|
||||
match [x] {
|
||||
[1 | 2 || 3] => (), //~ ERROR unexpected token `||` after pattern
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,46 @@
|
|||
error: unexpected token `||` after pattern
|
||||
--> $DIR/multiple-pattern-typo.rs:4:15
|
||||
--> $DIR/multiple-pattern-typo.rs:8:15
|
||||
|
|
||||
LL | 1 | 2 || 3 => (),
|
||||
| ^^ help: use a single `|` to specify multiple patterns: `|`
|
||||
|
||||
error: aborting due to previous error
|
||||
error: unexpected token `||` after pattern
|
||||
--> $DIR/multiple-pattern-typo.rs:13:16
|
||||
|
|
||||
LL | (1 | 2 || 3) => (),
|
||||
| ^^ help: use a single `|` to specify multiple patterns: `|`
|
||||
|
||||
error: unexpected token `||` after pattern
|
||||
--> $DIR/multiple-pattern-typo.rs:18:16
|
||||
|
|
||||
LL | (1 | 2 || 3,) => (),
|
||||
| ^^ help: use a single `|` to specify multiple patterns: `|`
|
||||
|
||||
error: unexpected token `||` after pattern
|
||||
--> $DIR/multiple-pattern-typo.rs:25:18
|
||||
|
|
||||
LL | TS(1 | 2 || 3) => (),
|
||||
| ^^ help: use a single `|` to specify multiple patterns: `|`
|
||||
|
||||
error: unexpected token `||` after pattern
|
||||
--> $DIR/multiple-pattern-typo.rs:32:23
|
||||
|
|
||||
LL | NS { f: 1 | 2 || 3 } => (),
|
||||
| ^^ help: use a single `|` to specify multiple patterns: `|`
|
||||
|
||||
error: unexpected token `||` after pattern
|
||||
--> $DIR/multiple-pattern-typo.rs:37:16
|
||||
|
|
||||
LL | [1 | 2 || 3] => (),
|
||||
| ^^ help: use a single `|` to specify multiple patterns: `|`
|
||||
|
||||
warning: the feature `or_patterns` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/multiple-pattern-typo.rs:1:12
|
||||
|
|
||||
LL | #![feature(or_patterns)]
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue