This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +95
-19
lines changed Expand file tree Collapse file tree 7 files changed +95
-19
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,37 @@ fn main() {
64
64
| 2 , ..] => { }
65
65
_ => { }
66
66
}
67
+ // FIXME: incorrect
68
+ match & [ ] [ ..] {
69
+ [ true ] => { }
70
+ [ true //~ ERROR unreachable
71
+ | false , ..] => { }
72
+ _ => { }
73
+ }
74
+ match & [ ] [ ..] {
75
+ [ false ] => { }
76
+ [ true , ..] => { }
77
+ [ true //~ ERROR unreachable
78
+ | false , ..] => { }
79
+ _ => { }
80
+ }
81
+ match ( true , None ) {
82
+ ( true , Some ( _) ) => { }
83
+ ( false , Some ( true ) ) => { }
84
+ ( true | false , None | Some ( true // FIXME: should be unreachable
85
+ | false ) ) => { }
86
+ }
87
+ macro_rules! t_or_f {
88
+ ( ) => {
89
+ ( true // FIXME: should be unreachable
90
+ | false )
91
+ } ;
92
+ }
93
+ match ( true , None ) {
94
+ ( true , Some ( _) ) => { }
95
+ ( false , Some ( true ) ) => { }
96
+ ( true | false , None | Some ( t_or_f ! ( ) ) ) => { }
97
+ }
67
98
match Some ( 0 ) {
68
99
Some ( 0 ) => { }
69
100
Some ( 0 //~ ERROR unreachable
Original file line number Diff line number Diff line change @@ -95,28 +95,40 @@ LL | [1
95
95
| ^
96
96
97
97
error: unreachable pattern
98
- --> $DIR/exhaustiveness-unreachable-pattern.rs:69:14
98
+ --> $DIR/exhaustiveness-unreachable-pattern.rs:70:10
99
+ |
100
+ LL | [true
101
+ | ^^^^
102
+
103
+ error: unreachable pattern
104
+ --> $DIR/exhaustiveness-unreachable-pattern.rs:77:10
105
+ |
106
+ LL | [true
107
+ | ^^^^
108
+
109
+ error: unreachable pattern
110
+ --> $DIR/exhaustiveness-unreachable-pattern.rs:100:14
99
111
|
100
112
LL | Some(0
101
113
| ^
102
114
103
115
error: unreachable pattern
104
- --> $DIR/exhaustiveness-unreachable-pattern.rs:88 :19
116
+ --> $DIR/exhaustiveness-unreachable-pattern.rs:119 :19
105
117
|
106
118
LL | | false) => {}
107
119
| ^^^^^
108
120
109
121
error: unreachable pattern
110
- --> $DIR/exhaustiveness-unreachable-pattern.rs:96 :15
122
+ --> $DIR/exhaustiveness-unreachable-pattern.rs:127 :15
111
123
|
112
124
LL | | true) => {}
113
125
| ^^^^
114
126
115
127
error: unreachable pattern
116
- --> $DIR/exhaustiveness-unreachable-pattern.rs:102 :15
128
+ --> $DIR/exhaustiveness-unreachable-pattern.rs:133 :15
117
129
|
118
130
LL | | true,
119
131
| ^^^^
120
132
121
- error: aborting due to 19 previous errors
133
+ error: aborting due to 21 previous errors
122
134
Original file line number Diff line number Diff line change 1
1
pub enum T {
2
2
T1 ( ( ) ) ,
3
- T2 ( ( ) )
3
+ T2 ( ( ) ) ,
4
4
}
5
5
6
6
pub enum V {
7
7
V1 ( isize ) ,
8
- V2 ( bool )
8
+ V2 ( bool ) ,
9
9
}
10
10
11
11
fn main ( ) {
12
12
match ( T :: T1 ( ( ) ) , V :: V2 ( true ) ) {
13
- //~^ ERROR non-exhaustive patterns: `(T1(()), V2(_))` not covered
13
+ //~^ ERROR non-exhaustive patterns: `(T1(()), V2(_))` not covered
14
14
( T :: T1 ( ( ) ) , V :: V1 ( i) ) => ( ) ,
15
- ( T :: T2 ( ( ) ) , V :: V2 ( b) ) => ( )
15
+ ( T :: T2 ( ( ) ) , V :: V2 ( b) ) => ( ) ,
16
16
}
17
17
}
Original file line number Diff line number Diff line change 1
1
fn foo ( a : Option < usize > , b : Option < usize > ) {
2
- match ( a, b) {
3
- //~^ ERROR: non-exhaustive patterns: `(None, None)` not covered
4
- ( Some ( a) , Some ( b) ) if a == b => { }
5
- ( Some ( _) , None ) |
6
- ( None , Some ( _) ) => { }
7
- }
2
+ match ( a, b) {
3
+ //~^ ERROR: non-exhaustive patterns: `(None, None)` not covered
4
+ ( Some ( a) , Some ( b) ) if a == b => { }
5
+ ( Some ( _) , None ) | ( None , Some ( _) ) => { }
6
+ }
8
7
}
9
8
10
9
fn main ( ) {
11
- foo ( None , None ) ;
10
+ foo ( None , None ) ;
12
11
}
Original file line number Diff line number Diff line change 1
1
error[E0004]: non-exhaustive patterns: `(None, None)` not covered
2
- --> $DIR/issue-2111.rs:2:9
2
+ --> $DIR/issue-2111.rs:2:11
3
3
|
4
- LL | match (a,b) {
5
- | ^^^^^ pattern `(None, None)` not covered
4
+ LL | match (a, b) {
5
+ | ^ ^^^^^ pattern `(None, None)` not covered
6
6
|
7
7
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
8
8
= note: the matched value is of type `(Option<usize>, Option<usize>)`
Original file line number Diff line number Diff line change
1
+ enum Foo {
2
+ A ( bool ) ,
3
+ B ( bool ) ,
4
+ C ( bool ) ,
5
+ }
6
+
7
+ fn main ( ) {
8
+ match Foo :: A ( true ) {
9
+ //~^ ERROR non-exhaustive patterns: `A(false)` not covered
10
+ Foo :: A ( true ) => { }
11
+ Foo :: B ( true ) => { }
12
+ Foo :: C ( true ) => { }
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ error[E0004]: non-exhaustive patterns: `A(false)` not covered
2
+ --> $DIR/issue-56379.rs:8:11
3
+ |
4
+ LL | / enum Foo {
5
+ LL | | A(bool),
6
+ | | - not covered
7
+ LL | | B(bool),
8
+ LL | | C(bool),
9
+ LL | | }
10
+ | |_- `Foo` defined here
11
+ ...
12
+ LL | match Foo::A(true) {
13
+ | ^^^^^^^^^^^^ pattern `A(false)` not covered
14
+ |
15
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
16
+ = note: the matched value is of type `Foo`
17
+
18
+ error: aborting due to previous error
19
+
20
+ For more information about this error, try `rustc --explain E0004`.
You can’t perform that action at this time.
0 commit comments