Add more tests

This commit is contained in:
Nadrieril 2024-01-10 22:08:53 +01:00
parent 68a13bf7fd
commit 5ccd29d6f0
2 changed files with 46 additions and 1 deletions

View File

@ -23,3 +23,24 @@ fn main() {
//~| ERROR: never patterns cannot contain variable bindings
}
}
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
}

View File

@ -22,5 +22,29 @@ error: never patterns cannot contain variable bindings
LL | Ok(_ok) | Err(&(_a, _b, !)) => {}
| ^^ help: use a wildcard `_` instead
error: aborting due to 4 previous errors
error: never patterns cannot contain variable bindings
--> $DIR/bindings.rs:34:10
|
LL | let (_a, (! | !)) = (true, void);
| ^^ help: use a wildcard `_` instead
error: never patterns cannot contain variable bindings
--> $DIR/bindings.rs:38:9
|
LL | let _a @ ! = void;
| ^^ help: use a wildcard `_` instead
error: never patterns cannot contain variable bindings
--> $DIR/bindings.rs:41:10
|
LL | let (_a @ (), !) = ((), void);
| ^^ help: use a wildcard `_` instead
error: never patterns cannot contain variable bindings
--> $DIR/bindings.rs:44:14
|
LL | (_b @ (_, !))) = (true, void);
| ^^ help: use a wildcard `_` instead
error: aborting due to 8 previous errors