rust/src/test/ui/or-patterns/remove-leading-vert.rs

24 lines
1.1 KiB
Rust
Raw Normal View History

2019-08-24 22:45:51 -05:00
// Test the suggestion to remove a leading `|`.
// run-rustfix
#![feature(or_patterns)]
#![allow(warnings)]
fn main() {}
#[cfg(FALSE)]
fn leading_vert() {
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
}