Skip to content

Commit

Permalink
update the tracking issue for structural match violations
Browse files Browse the repository at this point in the history
and bless a test I missed
  • Loading branch information
RalfJung committed Jan 27, 2024
1 parent 32e4862 commit 0808691
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 72 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2333,7 +2333,7 @@ declare_lint! {
"constant used in pattern contains value of non-structural-match type in a field or a variant",
@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
reference: "issue #120362 <https://github.com/rust-lang/rust/issues/120362>",
};
}

Expand Down Expand Up @@ -2389,7 +2389,7 @@ declare_lint! {
"pointers are not structural-match",
@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/70861>",
reference: "issue #120362 <https://github.com/rust-lang/rust/issues/120362>",
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | NUMBER_POINTER => (),
| ^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

warning: 1 warning emitted
Expand All @@ -18,6 +18,6 @@ LL | NUMBER_POINTER => (),
| ^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | C => {}
| ^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
note: the lint level is defined here
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
|
Expand All @@ -19,7 +19,7 @@ LL | C_INNER => {}
| ^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

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.
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:30:9
Expand All @@ -28,7 +28,7 @@ LL | D => {}
| ^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

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.
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:36:9
Expand All @@ -37,7 +37,7 @@ LL | STR => {}
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

error: aborting due to 4 previous errors

Expand All @@ -49,7 +49,7 @@ LL | C => {}
| ^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
note: the lint level is defined here
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
|
Expand All @@ -64,7 +64,7 @@ LL | C_INNER => {}
| ^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
note: the lint level is defined here
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
|
Expand All @@ -79,7 +79,7 @@ LL | D => {}
| ^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
note: the lint level is defined here
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
|
Expand All @@ -94,7 +94,7 @@ LL | STR => {}
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
note: the lint level is defined here
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
|
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/consts/const_in_pattern/issue-44333.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | FOO => println!("foo"),
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
note: the lint level is defined here
--> $DIR/issue-44333.rs:3:9
|
Expand All @@ -19,7 +19,7 @@ LL | BAR => println!("bar"),
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

warning: 2 warnings emitted

Expand All @@ -31,7 +31,7 @@ LL | FOO => println!("foo"),
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
note: the lint level is defined here
--> $DIR/issue-44333.rs:3:9
|
Expand All @@ -46,7 +46,7 @@ LL | BAR => println!("bar"),
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
note: the lint level is defined here
--> $DIR/issue-44333.rs:3:9
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const_in_pattern/reject_non_structural.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,5 @@ fn main() {
//~| NOTE the traits must be derived
//~| NOTE StructuralPartialEq.html for details
//~| WARN previously accepted by the compiler but is being phased out
//~| NOTE for more information, see issue #62411
//~| NOTE for more information, see
}
4 changes: 2 additions & 2 deletions tests/ui/consts/const_in_pattern/reject_non_structural.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops")
| ^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
note: the lint level is defined here
Expand All @@ -105,7 +105,7 @@ LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops")
| ^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
note: the lint level is defined here
Expand Down
17 changes: 17 additions & 0 deletions tests/ui/consts/issue-89088.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Future incompatibility report: Future breakage diagnostic:
warning: to use a constant of type `Cow<'_, str>` in a pattern, `Cow<'_, str>` must be annotated with `#[derive(PartialEq)]`
--> $DIR/issue-89088.rs:19:9
|
LL | FOO => todo!(),
| ^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
note: the lint level is defined here
--> $DIR/issue-89088.rs:5:10
|
LL | #![allow(indirect_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ LL | if let CONSTANT = &&MyType {
| ^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
note: the lint level is defined here
Expand Down
32 changes: 16 additions & 16 deletions tests/ui/pattern/usefulness/consts-opaque.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | QUUX => {}
| ^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

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.
Expand All @@ -15,7 +15,7 @@ LL | QUUX => {}
| ^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

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.
--> $DIR/consts-opaque.rs:108:9
Expand All @@ -24,7 +24,7 @@ LL | WRAPQUUX => {}
| ^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

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.
--> $DIR/consts-opaque.rs:110:9
Expand All @@ -33,7 +33,7 @@ LL | WRAPQUUX => {}
| ^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

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.
--> $DIR/consts-opaque.rs:117:9
Expand All @@ -42,7 +42,7 @@ LL | WRAPQUUX => {}
| ^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

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.
--> $DIR/consts-opaque.rs:127:9
Expand All @@ -51,7 +51,7 @@ LL | WRAPQUUX => {}
| ^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

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.
--> $DIR/consts-opaque.rs:139:9
Expand All @@ -60,7 +60,7 @@ LL | WHOKNOWSQUUX => {}
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

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.
--> $DIR/consts-opaque.rs:142:9
Expand All @@ -69,7 +69,7 @@ LL | WHOKNOWSQUUX => {}
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>

error: unreachable pattern
--> $DIR/consts-opaque.rs:48:9
Expand Down Expand Up @@ -174,7 +174,7 @@ LL | QUUX => {}
| ^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
Expand All @@ -185,7 +185,7 @@ LL | QUUX => {}
| ^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
Expand All @@ -196,7 +196,7 @@ LL | WRAPQUUX => {}
| ^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
Expand All @@ -207,7 +207,7 @@ LL | WRAPQUUX => {}
| ^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
Expand All @@ -218,7 +218,7 @@ LL | WRAPQUUX => {}
| ^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
Expand All @@ -229,7 +229,7 @@ LL | WRAPQUUX => {}
| ^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
Expand All @@ -240,7 +240,7 @@ LL | WHOKNOWSQUUX => {}
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
Expand All @@ -251,6 +251,6 @@ LL | WHOKNOWSQUUX => {}
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
= note: `#[warn(pointer_structural_match)]` on by default

Loading

0 comments on commit 0808691

Please sign in to comment.