Skip to content

Commit 5ccd29d

Browse files
committed
Add more tests
1 parent 68a13bf commit 5ccd29d

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

tests/ui/rfcs/rfc-0000-never_patterns/bindings.rs

+21
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,24 @@ fn main() {
2323
//~| ERROR: never patterns cannot contain variable bindings
2424
}
2525
}
26+
27+
fn void(void: Void) {
28+
let (_a | !) = void;
29+
let (! | _a) = void;
30+
let ((_a, _) | (_a, _ | !)) = (true, void);
31+
let (_a | (! | !,)) = (void,);
32+
let ((_a,) | (!,)) = (void,);
33+
34+
let (_a, (! | !)) = (true, void);
35+
//~^ ERROR: never patterns cannot contain variable bindings
36+
let (_a, (_b | !)) = (true, void);
37+
38+
let _a @ ! = void;
39+
//~^ ERROR: never patterns cannot contain variable bindings
40+
let _a @ (_b | !) = void;
41+
let (_a @ (), !) = ((), void);
42+
//~^ ERROR: never patterns cannot contain variable bindings
43+
let (_a |
44+
(_b @ (_, !))) = (true, void);
45+
//~^ ERROR: never patterns cannot contain variable bindings
46+
}

tests/ui/rfcs/rfc-0000-never_patterns/bindings.stderr

+25-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,29 @@ error: never patterns cannot contain variable bindings
2222
LL | Ok(_ok) | Err(&(_a, _b, !)) => {}
2323
| ^^ help: use a wildcard `_` instead
2424

25-
error: aborting due to 4 previous errors
25+
error: never patterns cannot contain variable bindings
26+
--> $DIR/bindings.rs:34:10
27+
|
28+
LL | let (_a, (! | !)) = (true, void);
29+
| ^^ help: use a wildcard `_` instead
30+
31+
error: never patterns cannot contain variable bindings
32+
--> $DIR/bindings.rs:38:9
33+
|
34+
LL | let _a @ ! = void;
35+
| ^^ help: use a wildcard `_` instead
36+
37+
error: never patterns cannot contain variable bindings
38+
--> $DIR/bindings.rs:41:10
39+
|
40+
LL | let (_a @ (), !) = ((), void);
41+
| ^^ help: use a wildcard `_` instead
42+
43+
error: never patterns cannot contain variable bindings
44+
--> $DIR/bindings.rs:44:14
45+
|
46+
LL | (_b @ (_, !))) = (true, void);
47+
| ^^ help: use a wildcard `_` instead
48+
49+
error: aborting due to 8 previous errors
2650

0 commit comments

Comments
 (0)