Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Jan 10, 2024
1 parent 68a13bf commit 5ccd29d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
21 changes: 21 additions & 0 deletions tests/ui/rfcs/rfc-0000-never_patterns/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
26 changes: 25 additions & 1 deletion tests/ui/rfcs/rfc-0000-never_patterns/bindings.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5ccd29d

Please sign in to comment.