Skip to content

Commit 48abca7

Browse files
committed
show indirect_structural_match and pointer_structural_match in future compat reports
1 parent 9f58cf4 commit 48abca7

14 files changed

+468
-2
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,7 @@ declare_lint! {
22822282
Warn,
22832283
"constant used in pattern contains value of non-structural-match type in a field or a variant",
22842284
@future_incompatible = FutureIncompatibleInfo {
2285-
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
2285+
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
22862286
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
22872287
};
22882288
}
@@ -2338,7 +2338,7 @@ declare_lint! {
23382338
Warn,
23392339
"pointers are not structural-match",
23402340
@future_incompatible = FutureIncompatibleInfo {
2341-
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
2341+
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
23422342
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/70861>",
23432343
};
23442344
}

tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,14 @@ LL | NUMBER_POINTER => (),
1010

1111
warning: 1 warning emitted
1212

13+
Future incompatibility report: Future breakage diagnostic:
14+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
15+
--> $DIR/match-edge-cases_1.rs:29:13
16+
|
17+
LL | NUMBER_POINTER => (),
18+
| ^^^^^^^^^^^^^^
19+
|
20+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
21+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
22+
= note: `#[warn(pointer_structural_match)]` on by default
23+

tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr

+60
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,63 @@ LL | STR => {}
4141

4242
error: aborting due to 4 previous errors
4343

44+
Future incompatibility report: Future breakage diagnostic:
45+
error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
46+
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:10:9
47+
|
48+
LL | C => {}
49+
| ^
50+
|
51+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
52+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
53+
note: the lint level is defined here
54+
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
55+
|
56+
LL | #![deny(pointer_structural_match)]
57+
| ^^^^^^^^^^^^^^^^^^^^^^^^
58+
59+
Future breakage diagnostic:
60+
error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
61+
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:18:9
62+
|
63+
LL | C_INNER => {}
64+
| ^^^^^^^
65+
|
66+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
67+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
68+
note: the lint level is defined here
69+
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
70+
|
71+
LL | #![deny(pointer_structural_match)]
72+
| ^^^^^^^^^^^^^^^^^^^^^^^^
73+
74+
Future breakage diagnostic:
75+
error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
76+
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:30:9
77+
|
78+
LL | D => {}
79+
| ^
80+
|
81+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
82+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
83+
note: the lint level is defined here
84+
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
85+
|
86+
LL | #![deny(pointer_structural_match)]
87+
| ^^^^^^^^^^^^^^^^^^^^^^^^
88+
89+
Future breakage diagnostic:
90+
error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
91+
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:36:9
92+
|
93+
LL | STR => {}
94+
| ^^^
95+
|
96+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
97+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
98+
note: the lint level is defined here
99+
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
100+
|
101+
LL | #![deny(pointer_structural_match)]
102+
| ^^^^^^^^^^^^^^^^^^^^^^^^
103+

tests/ui/consts/const_in_pattern/issue-44333.stderr

+30
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,33 @@ LL | BAR => println!("bar"),
2323

2424
warning: 2 warnings emitted
2525

26+
Future incompatibility report: Future breakage diagnostic:
27+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
28+
--> $DIR/issue-44333.rs:19:9
29+
|
30+
LL | FOO => println!("foo"),
31+
| ^^^
32+
|
33+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
34+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
35+
note: the lint level is defined here
36+
--> $DIR/issue-44333.rs:3:9
37+
|
38+
LL | #![warn(pointer_structural_match)]
39+
| ^^^^^^^^^^^^^^^^^^^^^^^^
40+
41+
Future breakage diagnostic:
42+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
43+
--> $DIR/issue-44333.rs:21:9
44+
|
45+
LL | BAR => println!("bar"),
46+
| ^^^
47+
|
48+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
49+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
50+
note: the lint level is defined here
51+
--> $DIR/issue-44333.rs:3:9
52+
|
53+
LL | #![warn(pointer_structural_match)]
54+
| ^^^^^^^^^^^^^^^^^^^^^^^^
55+

tests/ui/consts/const_in_pattern/reject_non_structural.stderr

+17
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,20 @@ LL | #![warn(indirect_structural_match)]
9797

9898
error: aborting due to 9 previous errors; 1 warning emitted
9999

100+
Future incompatibility report: Future breakage diagnostic:
101+
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
102+
--> $DIR/reject_non_structural.rs:98:29
103+
|
104+
LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
105+
| ^^^^^^^
106+
|
107+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
108+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
109+
= note: the traits must be derived, manual `impl`s are not sufficient
110+
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
111+
note: the lint level is defined here
112+
--> $DIR/reject_non_structural.rs:14:9
113+
|
114+
LL | #![warn(indirect_structural_match)]
115+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
116+

tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr

+18
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,21 @@ LL | if let CONSTANT = &&MyType {
99

1010
error: aborting due to 1 previous error
1111

12+
Future incompatibility report: Future breakage diagnostic:
13+
warning: to use a constant of type `MyType` in a pattern, `MyType` must be annotated with `#[derive(PartialEq)]`
14+
--> $DIR/const-partial_eq-fallback-ice.rs:14:12
15+
|
16+
LL | if let CONSTANT = &&MyType {
17+
| ^^^^^^^^
18+
|
19+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
20+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
21+
= note: the traits must be derived, manual `impl`s are not sufficient
22+
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
23+
note: the lint level is defined here
24+
--> $DIR/const-partial_eq-fallback-ice.rs:1:10
25+
|
26+
LL | #![allow(warnings)]
27+
| ^^^^^^^^
28+
= note: `#[allow(indirect_structural_match)]` implied by `#[allow(warnings)]`
29+

tests/ui/pattern/usefulness/consts-opaque.stderr

+88
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,91 @@ LL | WRAPQUUX => {}, Wrap(_) => todo!()
166166
error: aborting due to 10 previous errors; 8 warnings emitted
167167

168168
For more information about this error, try `rustc --explain E0004`.
169+
Future incompatibility report: Future breakage diagnostic:
170+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
171+
--> $DIR/consts-opaque.rs:96:9
172+
|
173+
LL | QUUX => {}
174+
| ^^^^
175+
|
176+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
177+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
178+
= note: `#[warn(pointer_structural_match)]` on by default
179+
180+
Future breakage diagnostic:
181+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
182+
--> $DIR/consts-opaque.rs:98:9
183+
|
184+
LL | QUUX => {}
185+
| ^^^^
186+
|
187+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
188+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
189+
= note: `#[warn(pointer_structural_match)]` on by default
190+
191+
Future breakage diagnostic:
192+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
193+
--> $DIR/consts-opaque.rs:108:9
194+
|
195+
LL | WRAPQUUX => {}
196+
| ^^^^^^^^
197+
|
198+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
199+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
200+
= note: `#[warn(pointer_structural_match)]` on by default
201+
202+
Future breakage diagnostic:
203+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
204+
--> $DIR/consts-opaque.rs:110:9
205+
|
206+
LL | WRAPQUUX => {}
207+
| ^^^^^^^^
208+
|
209+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
210+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
211+
= note: `#[warn(pointer_structural_match)]` on by default
212+
213+
Future breakage diagnostic:
214+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
215+
--> $DIR/consts-opaque.rs:117:9
216+
|
217+
LL | WRAPQUUX => {}
218+
| ^^^^^^^^
219+
|
220+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
221+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
222+
= note: `#[warn(pointer_structural_match)]` on by default
223+
224+
Future breakage diagnostic:
225+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
226+
--> $DIR/consts-opaque.rs:127:9
227+
|
228+
LL | WRAPQUUX => {}
229+
| ^^^^^^^^
230+
|
231+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
232+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
233+
= note: `#[warn(pointer_structural_match)]` on by default
234+
235+
Future breakage diagnostic:
236+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
237+
--> $DIR/consts-opaque.rs:139:9
238+
|
239+
LL | WHOKNOWSQUUX => {}
240+
| ^^^^^^^^^^^^
241+
|
242+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
243+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
244+
= note: `#[warn(pointer_structural_match)]` on by default
245+
246+
Future breakage diagnostic:
247+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
248+
--> $DIR/consts-opaque.rs:142:9
249+
|
250+
LL | WHOKNOWSQUUX => {}
251+
| ^^^^^^^^^^^^
252+
|
253+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
254+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
255+
= note: `#[warn(pointer_structural_match)]` on by default
256+

tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-embedded.stderr

+17
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,20 @@ LL | #![warn(indirect_structural_match)]
1616

1717
warning: 1 warning emitted
1818

19+
Future incompatibility report: Future breakage diagnostic:
20+
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
21+
--> $DIR/cant-hide-behind-doubly-indirect-embedded.rs:24:9
22+
|
23+
LL | WRAP_DOUBLY_INDIRECT_INLINE => { panic!("WRAP_DOUBLY_INDIRECT_INLINE matched itself"); }
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
25+
|
26+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
27+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
28+
= note: the traits must be derived, manual `impl`s are not sufficient
29+
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
30+
note: the lint level is defined here
31+
--> $DIR/cant-hide-behind-doubly-indirect-embedded.rs:7:9
32+
|
33+
LL | #![warn(indirect_structural_match)]
34+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
35+

tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-param.stderr

+17
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,20 @@ LL | #![warn(indirect_structural_match)]
1616

1717
warning: 1 warning emitted
1818

19+
Future incompatibility report: Future breakage diagnostic:
20+
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
21+
--> $DIR/cant-hide-behind-doubly-indirect-param.rs:24:9
22+
|
23+
LL | WRAP_DOUBLY_INDIRECT_PARAM => { panic!("WRAP_DOUBLY_INDIRECT_PARAM matched itself"); }
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
25+
|
26+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
27+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
28+
= note: the traits must be derived, manual `impl`s are not sufficient
29+
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
30+
note: the lint level is defined here
31+
--> $DIR/cant-hide-behind-doubly-indirect-param.rs:7:9
32+
|
33+
LL | #![warn(indirect_structural_match)]
34+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
35+

tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-embedded.stderr

+17
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,20 @@ LL | #![warn(indirect_structural_match)]
1616

1717
warning: 1 warning emitted
1818

19+
Future incompatibility report: Future breakage diagnostic:
20+
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
21+
--> $DIR/cant-hide-behind-indirect-struct-embedded.rs:24:9
22+
|
23+
LL | WRAP_INDIRECT_INLINE => { panic!("WRAP_INDIRECT_INLINE matched itself"); }
24+
| ^^^^^^^^^^^^^^^^^^^^
25+
|
26+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
27+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
28+
= note: the traits must be derived, manual `impl`s are not sufficient
29+
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
30+
note: the lint level is defined here
31+
--> $DIR/cant-hide-behind-indirect-struct-embedded.rs:7:9
32+
|
33+
LL | #![warn(indirect_structural_match)]
34+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
35+

tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-param.stderr

+17
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,20 @@ LL | #![warn(indirect_structural_match)]
1616

1717
warning: 1 warning emitted
1818

19+
Future incompatibility report: Future breakage diagnostic:
20+
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
21+
--> $DIR/cant-hide-behind-indirect-struct-param.rs:24:9
22+
|
23+
LL | WRAP_INDIRECT_PARAM => { panic!("WRAP_INDIRECT_PARAM matched itself"); }
24+
| ^^^^^^^^^^^^^^^^^^^
25+
|
26+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
27+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
28+
= note: the traits must be derived, manual `impl`s are not sufficient
29+
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
30+
note: the lint level is defined here
31+
--> $DIR/cant-hide-behind-indirect-struct-param.rs:7:9
32+
|
33+
LL | #![warn(indirect_structural_match)]
34+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
35+

0 commit comments

Comments
 (0)