File tree Expand file tree Collapse file tree 2 files changed +15
-29
lines changed
tests/ui/rfcs/rfc-0000-never_patterns Expand file tree Collapse file tree 2 files changed +15
-29
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( never_type) ]
1
2
#![ feature( never_patterns) ]
2
3
#![ allow( incomplete_features) ]
3
4
4
- fn main ( ) {
5
- match ( ) {
6
- ( !|
7
- //~^ ERROR: mismatched types
8
- !) if true => { } //~ ERROR a never pattern is always unreachable
9
- //~^ ERROR: mismatched types
5
+ enum Void { }
6
+
7
+ fn foo ( x : Void ) {
8
+ match x {
9
+ ( !|!) if true => { } //~ ERROR a never pattern is always unreachable
10
10
( !|!) if true => { } //~ ERROR a never pattern is always unreachable
11
11
}
12
12
}
13
+
14
+ fn main ( ) { }
Original file line number Diff line number Diff line change 1
1
error: a never pattern is always unreachable
2
- --> $DIR/ICE-133117-duplicate-never-arm.rs:8:23
2
+ --> $DIR/ICE-133117-duplicate-never-arm.rs:9:26
3
3
|
4
- LL | !) if true => {}
5
- | ^^
6
- | |
7
- | this will never be executed
8
- | help: remove this expression
4
+ LL | (!| !) if true => {}
5
+ | ^^
6
+ | |
7
+ | this will never be executed
8
+ | help: remove this expression
9
9
10
10
error: a never pattern is always unreachable
11
11
--> $DIR/ICE-133117-duplicate-never-arm.rs:10:26
@@ -16,21 +16,5 @@ LL | (!|!) if true => {}
16
16
| this will never be executed
17
17
| help: remove this expression
18
18
19
- error: mismatched types
20
- --> $DIR/ICE-133117-duplicate-never-arm.rs:6:10
21
- |
22
- LL | (!|
23
- | ^ a never pattern must be used on an uninhabited type
24
- |
25
- = note: the matched value is of type `()`
26
-
27
- error: mismatched types
28
- --> $DIR/ICE-133117-duplicate-never-arm.rs:8:9
29
- |
30
- LL | !) if true => {}
31
- | ^ a never pattern must be used on an uninhabited type
32
- |
33
- = note: the matched value is of type `()`
34
-
35
- error: aborting due to 4 previous errors
19
+ error: aborting due to 2 previous errors
36
20
You can’t perform that action at this time.
0 commit comments