Skip to content

Commit 5bfd3e7

Browse files
committed
Accidentally fixed #78071
1 parent c4ae6c2 commit 5bfd3e7

File tree

2 files changed

+36
-24
lines changed

2 files changed

+36
-24
lines changed

src/test/ui/pattern/usefulness/consts-opaque.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ fn main() {
4444
//~^ ERROR unreachable pattern
4545
}
4646

47-
// FIXME: this causes an ICE (https://github.com/rust-lang/rust/issues/78071)
48-
//match FOO_REF_REF {
49-
// FOO_REF_REF => {}
50-
// Foo(_) => {}
51-
//}
47+
// This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071)
48+
match FOO_REF_REF {
49+
FOO_REF_REF => {}
50+
//~^ WARNING must be annotated with `#[derive(PartialEq, Eq)]`
51+
//~| WARNING this was previously accepted by the compiler but is being phased out
52+
Foo(_) => {}
53+
}
5254

5355
match BAR {
5456
Bar => {}

src/test/ui/pattern/usefulness/consts-opaque.stderr

+29-19
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,32 @@ error: unreachable pattern
2828
LL | Foo(_) => {} // should not be emitting unreachable warning
2929
| ^^^^^^
3030

31+
warning: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
32+
--> $DIR/consts-opaque.rs:49:9
33+
|
34+
LL | FOO_REF_REF => {}
35+
| ^^^^^^^^^^^
36+
|
37+
= note: `#[warn(indirect_structural_match)]` on by default
38+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
39+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
40+
3141
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
32-
--> $DIR/consts-opaque.rs:55:9
42+
--> $DIR/consts-opaque.rs:57:9
3343
|
3444
LL | BAR => {} // should not be emitting unreachable warning
3545
| ^^^
3646

3747
error: unreachable pattern
38-
--> $DIR/consts-opaque.rs:55:9
48+
--> $DIR/consts-opaque.rs:57:9
3949
|
4050
LL | Bar => {}
4151
| --- matches any value
4252
LL | BAR => {} // should not be emitting unreachable warning
4353
| ^^^ unreachable pattern
4454

4555
error: unreachable pattern
46-
--> $DIR/consts-opaque.rs:58:9
56+
--> $DIR/consts-opaque.rs:60:9
4757
|
4858
LL | Bar => {}
4959
| --- matches any value
@@ -52,19 +62,19 @@ LL | _ => {}
5262
| ^ unreachable pattern
5363

5464
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
55-
--> $DIR/consts-opaque.rs:63:9
65+
--> $DIR/consts-opaque.rs:65:9
5666
|
5767
LL | BAR => {}
5868
| ^^^
5969

6070
error: unreachable pattern
61-
--> $DIR/consts-opaque.rs:65:9
71+
--> $DIR/consts-opaque.rs:67:9
6272
|
6373
LL | Bar => {} // should not be emitting unreachable warning
6474
| ^^^
6575

6676
error: unreachable pattern
67-
--> $DIR/consts-opaque.rs:67:9
77+
--> $DIR/consts-opaque.rs:69:9
6878
|
6979
LL | Bar => {} // should not be emitting unreachable warning
7080
| --- matches any value
@@ -73,76 +83,76 @@ LL | _ => {}
7383
| ^ unreachable pattern
7484

7585
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
76-
--> $DIR/consts-opaque.rs:72:9
86+
--> $DIR/consts-opaque.rs:74:9
7787
|
7888
LL | BAR => {}
7989
| ^^^
8090

8191
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
82-
--> $DIR/consts-opaque.rs:74:9
92+
--> $DIR/consts-opaque.rs:76:9
8393
|
8494
LL | BAR => {} // should not be emitting unreachable warning
8595
| ^^^
8696

8797
error: unreachable pattern
88-
--> $DIR/consts-opaque.rs:74:9
98+
--> $DIR/consts-opaque.rs:76:9
8999
|
90100
LL | BAR => {} // should not be emitting unreachable warning
91101
| ^^^
92102

93103
error: unreachable pattern
94-
--> $DIR/consts-opaque.rs:77:9
104+
--> $DIR/consts-opaque.rs:79:9
95105
|
96106
LL | _ => {} // should not be emitting unreachable warning
97107
| ^
98108

99109
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
100-
--> $DIR/consts-opaque.rs:82:9
110+
--> $DIR/consts-opaque.rs:84:9
101111
|
102112
LL | BAZ => {}
103113
| ^^^
104114

105115
error: unreachable pattern
106-
--> $DIR/consts-opaque.rs:84:9
116+
--> $DIR/consts-opaque.rs:86:9
107117
|
108118
LL | Baz::Baz1 => {} // should not be emitting unreachable warning
109119
| ^^^^^^^^^
110120

111121
error: unreachable pattern
112-
--> $DIR/consts-opaque.rs:86:9
122+
--> $DIR/consts-opaque.rs:88:9
113123
|
114124
LL | _ => {}
115125
| ^
116126

117127
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
118-
--> $DIR/consts-opaque.rs:92:9
128+
--> $DIR/consts-opaque.rs:94:9
119129
|
120130
LL | BAZ => {}
121131
| ^^^
122132

123133
error: unreachable pattern
124-
--> $DIR/consts-opaque.rs:94:9
134+
--> $DIR/consts-opaque.rs:96:9
125135
|
126136
LL | _ => {}
127137
| ^
128138

129139
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
130-
--> $DIR/consts-opaque.rs:99:9
140+
--> $DIR/consts-opaque.rs:101:9
131141
|
132142
LL | BAZ => {}
133143
| ^^^
134144

135145
error: unreachable pattern
136-
--> $DIR/consts-opaque.rs:101:9
146+
--> $DIR/consts-opaque.rs:103:9
137147
|
138148
LL | Baz::Baz2 => {} // should not be emitting unreachable warning
139149
| ^^^^^^^^^
140150

141151
error: unreachable pattern
142-
--> $DIR/consts-opaque.rs:103:9
152+
--> $DIR/consts-opaque.rs:105:9
143153
|
144154
LL | _ => {} // should not be emitting unreachable warning
145155
| ^
146156

147-
error: aborting due to 22 previous errors
157+
error: aborting due to 22 previous errors; 1 warning emitted
148158

0 commit comments

Comments
 (0)