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() {
6464 | 2 , ..] => { }
6565 _ => { }
6666 }
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+ }
6798 match Some ( 0 ) {
6899 Some ( 0 ) => { }
69100 Some ( 0 //~ ERROR unreachable
Original file line number Diff line number Diff line change @@ -95,28 +95,40 @@ LL | [1
9595 | ^
9696
9797error: 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
99111 |
100112LL | Some(0
101113 | ^
102114
103115error: unreachable pattern
104- --> $DIR/exhaustiveness-unreachable-pattern.rs:88 :19
116+ --> $DIR/exhaustiveness-unreachable-pattern.rs:119 :19
105117 |
106118LL | | false) => {}
107119 | ^^^^^
108120
109121error: unreachable pattern
110- --> $DIR/exhaustiveness-unreachable-pattern.rs:96 :15
122+ --> $DIR/exhaustiveness-unreachable-pattern.rs:127 :15
111123 |
112124LL | | true) => {}
113125 | ^^^^
114126
115127error: unreachable pattern
116- --> $DIR/exhaustiveness-unreachable-pattern.rs:102 :15
128+ --> $DIR/exhaustiveness-unreachable-pattern.rs:133 :15
117129 |
118130LL | | true,
119131 | ^^^^
120132
121- error: aborting due to 19 previous errors
133+ error: aborting due to 21 previous errors
122134
Original file line number Diff line number Diff line change 11pub enum T {
22 T1 ( ( ) ) ,
3- T2 ( ( ) )
3+ T2 ( ( ) ) ,
44}
55
66pub enum V {
77 V1 ( isize ) ,
8- V2 ( bool )
8+ V2 ( bool ) ,
99}
1010
1111fn main ( ) {
1212 match ( T :: T1 ( ( ) ) , V :: V2 ( true ) ) {
13- //~^ ERROR non-exhaustive patterns: `(T1(()), V2(_))` not covered
13+ //~^ ERROR non-exhaustive patterns: `(T1(()), V2(_))` not covered
1414 ( T :: T1 ( ( ) ) , V :: V1 ( i) ) => ( ) ,
15- ( T :: T2 ( ( ) ) , V :: V2 ( b) ) => ( )
15+ ( T :: T2 ( ( ) ) , V :: V2 ( b) ) => ( ) ,
1616 }
1717}
Original file line number Diff line number Diff line change 11fn 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+ }
87}
98
109fn main ( ) {
11- foo ( None , None ) ;
10+ foo ( None , None ) ;
1211}
Original file line number Diff line number Diff line change 11error[E0004]: non-exhaustive patterns: `(None, None)` not covered
2- --> $DIR/issue-2111.rs:2:9
2+ --> $DIR/issue-2111.rs:2:11
33 |
4- LL | match (a,b) {
5- | ^^^^^ pattern `(None, None)` not covered
4+ LL | match (a, b) {
5+ | ^ ^^^^^ pattern `(None, None)` not covered
66 |
77 = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
88 = 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