2024-01-05 03:08:47 -06:00
|
|
|
#![feature(never_patterns)]
|
|
|
|
#![allow(incomplete_features)]
|
|
|
|
|
2024-02-01 16:45:00 -06:00
|
|
|
#[derive(Copy, Clone)]
|
2024-01-05 03:08:47 -06:00
|
|
|
enum Void {}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x: Result<bool, &(u32, u32, Void)> = Ok(false);
|
|
|
|
|
|
|
|
match x {
|
|
|
|
Ok(_x) | Err(&!) => {}
|
|
|
|
}
|
|
|
|
let (Ok(_x) | Err(&!)) = x;
|
|
|
|
|
|
|
|
match x {
|
|
|
|
Ok(_) => {}
|
|
|
|
Err(&(_a, _b, !)),
|
2024-01-05 03:11:18 -06:00
|
|
|
//~^ ERROR: never patterns cannot contain variable bindings
|
|
|
|
//~| ERROR: never patterns cannot contain variable bindings
|
2024-01-05 03:08:47 -06:00
|
|
|
}
|
|
|
|
match x {
|
|
|
|
Ok(_ok) | Err(&(_a, _b, !)) => {}
|
2024-01-05 03:11:18 -06:00
|
|
|
//~^ ERROR: never patterns cannot contain variable bindings
|
|
|
|
//~| ERROR: never patterns cannot contain variable bindings
|
2024-01-05 03:08:47 -06:00
|
|
|
}
|
|
|
|
}
|
2024-01-10 15:08:53 -06:00
|
|
|
|
|
|
|
fn void(void: Void) {
|
|
|
|
let (_a | !) = void;
|
|
|
|
let (! | _a) = void;
|
|
|
|
let ((_a, _) | (_a, _ | !)) = (true, void);
|
|
|
|
let (_a | (! | !,)) = (void,);
|
|
|
|
let ((_a,) | (!,)) = (void,);
|
|
|
|
|
|
|
|
let (_a, (! | !)) = (true, void);
|
|
|
|
//~^ ERROR: never patterns cannot contain variable bindings
|
|
|
|
let (_a, (_b | !)) = (true, void);
|
|
|
|
|
|
|
|
let _a @ ! = void;
|
|
|
|
//~^ ERROR: never patterns cannot contain variable bindings
|
|
|
|
let _a @ (_b | !) = void;
|
|
|
|
let (_a @ (), !) = ((), void);
|
|
|
|
//~^ ERROR: never patterns cannot contain variable bindings
|
|
|
|
let (_a |
|
|
|
|
(_b @ (_, !))) = (true, void);
|
|
|
|
//~^ ERROR: never patterns cannot contain variable bindings
|
|
|
|
}
|