Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

78 lines
1.5 KiB
Rust
Raw Normal View History

2023-11-27 03:15:56 +01:00
#![feature(never_patterns)]
#![allow(incomplete_features)]
enum Void {}
fn main() {}
macro_rules! never {
() => { ! }
}
fn parse(x: Void) {
match None::<Void> {
None => {}
Some(!),
}
match None::<Void> {
Some(!),
None => {}
}
match None::<Void> {
None => {}
Some(!)
}
match None::<Void> {
Some(!)
//~^ ERROR expected `,` following `match` arm
None => {}
}
match None::<Void> {
Some(!) if true
//~^ ERROR expected `,` following `match` arm
2023-11-27 03:47:49 +01:00
//~| ERROR guard on a never pattern
2023-11-27 03:15:56 +01:00
None => {}
}
match None::<Void> {
Some(!) if true,
2023-11-27 03:47:49 +01:00
//~^ ERROR guard on a never pattern
2023-11-27 03:15:56 +01:00
None => {}
}
match None::<Void> {
Some(!) <=
//~^ ERROR expected one of
}
match x {
never!(),
}
match x {
never!() if true,
2023-11-27 03:47:49 +01:00
//~^ ERROR guard on a never pattern
2023-11-27 03:15:56 +01:00
}
match x {
never!()
}
match &x {
&never!(),
}
match None::<Void> {
Some(never!()),
None => {}
}
match x { ! }
match &x { &! }
let res: Result<bool, Void> = Ok(false);
let Ok(_) = res;
let Ok(_) | Err(!) = &res; // Disallowed; see #82048.
//~^ ERROR top-level or-patterns are not allowed in `let` bindings
let (Ok(_) | Err(!)) = &res;
let (Ok(_) | Err(&!)) = res.as_ref();
2024-01-05 16:44:42 +01:00
let ! = x;
let y @ ! = x;
2024-01-05 10:11:18 +01:00
//~^ ERROR: never patterns cannot contain variable bindings
2023-11-27 03:15:56 +01:00
}
2024-01-05 16:44:42 +01:00
fn foo(!: Void) {}