2019-09-28 23:21:20 -05:00
|
|
|
// Test the suggestion to remove a leading, or trailing `|`.
|
2019-08-24 22:45:51 -05:00
|
|
|
|
|
|
|
// run-rustfix
|
|
|
|
|
|
|
|
#![feature(or_patterns)]
|
|
|
|
#![allow(warnings)]
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
#[cfg(FALSE)]
|
2019-09-28 23:21:20 -05:00
|
|
|
fn leading() {
|
2019-08-24 22:45:51 -05:00
|
|
|
fn fun1( | A: E) {} //~ ERROR a leading `|` is not allowed in a parameter pattern
|
|
|
|
fn fun2( || A: E) {} //~ ERROR a leading `|` is not allowed in a parameter pattern
|
|
|
|
let ( | A): E; //~ ERROR a leading `|` is only allowed in a top-level pattern
|
|
|
|
let ( || A): (E); //~ ERROR a leading `|` is only allowed in a top-level pattern
|
|
|
|
let ( | A,): (E,); //~ ERROR a leading `|` is only allowed in a top-level pattern
|
|
|
|
let [ | A ]: [E; 1]; //~ ERROR a leading `|` is only allowed in a top-level pattern
|
|
|
|
let [ || A ]: [E; 1]; //~ ERROR a leading `|` is only allowed in a top-level pattern
|
|
|
|
let TS( | A ): TS; //~ ERROR a leading `|` is only allowed in a top-level pattern
|
|
|
|
let TS( || A ): TS; //~ ERROR a leading `|` is only allowed in a top-level pattern
|
|
|
|
let NS { f: | A }: NS; //~ ERROR a leading `|` is only allowed in a top-level pattern
|
|
|
|
let NS { f: || A }: NS; //~ ERROR a leading `|` is only allowed in a top-level pattern
|
|
|
|
}
|
2019-09-28 23:21:20 -05:00
|
|
|
|
|
|
|
#[cfg(FALSE)]
|
|
|
|
fn trailing() {
|
|
|
|
let ( A | ): E; //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
let (a |,): (E,); //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
let ( A | B | ): E; //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
let [ A | B | ]: [E; 1]; //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
let S { f: B | }; //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
let ( A || B | ): E; //~ ERROR unexpected token `||` after pattern
|
|
|
|
//~^ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
match A {
|
|
|
|
A | => {} //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
A || => {} //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
A || B | => {} //~ ERROR unexpected token `||` after pattern
|
|
|
|
//~^ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
| A | B | => {}
|
|
|
|
//~^ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
}
|
|
|
|
|
|
|
|
let a | : u8 = 0; //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
let a | = 0; //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
let a | ; //~ ERROR a trailing `|` is not allowed in an or-pattern
|
|
|
|
}
|