mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
parser: multiple-pattern-typo: cover more or-pattern places.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user