Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #120714

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
511bf6e
Add note to resolve error about generics from inside static/const
clubby789 Jan 13, 2024
2cfc817
Special case 'generic param from outer item' message for `Self`
clubby789 Jan 13, 2024
c367983
Suggest name value cfg when only value is used for check-cfg
chenyukang Jan 28, 2024
0213c87
limit the names_possiblilities to less than 3
chenyukang Jan 30, 2024
ca243e7
add testcase for more than 3 cfg names
chenyukang Jan 30, 2024
d34b0fa
Add test for method on unbounded type parameter receiver
estebank Jan 26, 2024
20b1c2a
Account for unbounded type param receiver in suggestions
estebank Jan 26, 2024
9ccc770
fix rebase
estebank Jan 30, 2024
5c41409
Account for non-overlapping unmet trait bounds in suggestion
estebank Jan 30, 2024
7331315
Remove `ffi_returns_twice` feature
clubby789 Jan 30, 2024
49d49eb
ast_lowering: Make sure all imports have non-empty resolution lists
petrochenkov Jan 30, 2024
3ff6796
hir: Make sure all `HirId`s have corresponding HIR `Node`s
petrochenkov Jan 20, 2024
e292423
hir: Remove `fn opt_hir_id` and `fn opt_span`
petrochenkov Jan 21, 2024
be77cf8
Use a `Vec` instead of a slice in `DeconstructedPat`
Nadrieril Jan 25, 2024
f65fe3b
Remove `pattern_arena` from `RustcMatchCheckCtxt`
Nadrieril Jan 25, 2024
be80c82
hir: Add some FIXMEs for future work
petrochenkov Jan 31, 2024
0e16885
Use deeply_normalize_with_skipped_universes in when processing type o…
compiler-errors Jan 30, 2024
7576b77
Do process_registered_region_obligations in a loop
compiler-errors Jan 30, 2024
7d1fda7
Normalize type outlives obligations in NLL
compiler-errors Jan 30, 2024
a371059
Don't hang when there's an infinite loop of outlives obligations
compiler-errors Feb 1, 2024
e951bcf
Normalize the whole PolyTypeOutlivesPredicate, more simplifications
compiler-errors Feb 2, 2024
9f58cf4
get rid of nontrivial_structural_match lint and custom_eq const qualif
RalfJung Jan 27, 2024
48abca7
show indirect_structural_match and pointer_structural_match in future…
RalfJung Jan 27, 2024
45d01b8
update the tracking issue for structural match violations
RalfJung Jan 27, 2024
e00df17
merge the accepted-structural-match tests into one
RalfJung Jan 28, 2024
a255db4
Rollup merge of #119939 - clubby789:static-const-generic-note, r=comp…
matthiaskrgr Feb 6, 2024
02896ce
Rollup merge of #120206 - petrochenkov:somehir, r=compiler-errors
matthiaskrgr Feb 6, 2024
8f70824
Rollup merge of #120331 - Nadrieril:no-arena, r=compiler-errors
matthiaskrgr Feb 6, 2024
0175f9f
Rollup merge of #120396 - estebank:method-on-unbounded-type-param, r=…
matthiaskrgr Feb 6, 2024
f4abc7b
Rollup merge of #120423 - RalfJung:indirect-structural-match, r=petro…
matthiaskrgr Feb 6, 2024
65ec50b
Rollup merge of #120435 - chenyukang:yukang-fix-120427-cfg-name, r=Ur…
matthiaskrgr Feb 6, 2024
2a488c4
Rollup merge of #120502 - clubby789:remove-ffi-returns-twice, r=compi…
matthiaskrgr Feb 6, 2024
ab20137
Rollup merge of #120507 - estebank:issue-108428, r=davidtwco
matthiaskrgr Feb 6, 2024
3ba5334
Rollup merge of #120513 - compiler-errors:normalize-regions-for-nll, …
matthiaskrgr Feb 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
show indirect_structural_match and pointer_structural_match in future…
… compat reports
  • Loading branch information
RalfJung committed Feb 5, 2024
commit 48abca761a3479d0ae5a41a338dcbe742e240d7c
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 @@ -2282,7 +2282,7 @@ declare_lint! {
Warn,
"constant used in pattern contains value of non-structural-match type in a field or a variant",
@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
};
}
Expand Down Expand Up @@ -2338,7 +2338,7 @@ declare_lint! {
Warn,
"pointers are not structural-match",
@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/70861>",
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ LL | NUMBER_POINTER => (),

warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
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/match-edge-cases_1.rs:29:13
|
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: `#[warn(pointer_structural_match)]` on by default

Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,63 @@ LL | STR => {}

error: aborting due to 4 previous errors

Future incompatibility report: Future breakage diagnostic:
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:10:9
|
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: the lint level is defined here
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
|
LL | #![deny(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^

Future breakage diagnostic:
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:18:9
|
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: the lint level is defined here
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
|
LL | #![deny(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^

Future breakage diagnostic:
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
|
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: the lint level is defined here
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
|
LL | #![deny(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^

Future breakage diagnostic:
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
|
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: the lint level is defined here
--> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
|
LL | #![deny(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^

30 changes: 30 additions & 0 deletions tests/ui/consts/const_in_pattern/issue-44333.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,33 @@ LL | BAR => println!("bar"),

warning: 2 warnings emitted

Future incompatibility report: Future breakage diagnostic:
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/issue-44333.rs:19:9
|
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: the lint level is defined here
--> $DIR/issue-44333.rs:3:9
|
LL | #![warn(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^

Future breakage diagnostic:
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/issue-44333.rs:21:9
|
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: the lint level is defined here
--> $DIR/issue-44333.rs:3:9
|
LL | #![warn(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^

17 changes: 17 additions & 0 deletions tests/ui/consts/const_in_pattern/reject_non_structural.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,20 @@ LL | #![warn(indirect_structural_match)]

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

Future incompatibility report: Future breakage diagnostic:
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
--> $DIR/reject_non_structural.rs:98:29
|
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: 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/reject_non_structural.rs:14:9
|
LL | #![warn(indirect_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^

18 changes: 18 additions & 0 deletions tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,21 @@ LL | if let CONSTANT = &&MyType {

error: aborting due to 1 previous error

Future incompatibility report: Future breakage diagnostic:
warning: to use a constant of type `MyType` in a pattern, `MyType` must be annotated with `#[derive(PartialEq)]`
--> $DIR/const-partial_eq-fallback-ice.rs:14:12
|
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: 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/const-partial_eq-fallback-ice.rs:1:10
|
LL | #![allow(warnings)]
| ^^^^^^^^
= note: `#[allow(indirect_structural_match)]` implied by `#[allow(warnings)]`

88 changes: 88 additions & 0 deletions tests/ui/pattern/usefulness/consts-opaque.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,91 @@ LL | WRAPQUUX => {}, Wrap(_) => todo!()
error: aborting due to 10 previous errors; 8 warnings emitted

For more information about this error, try `rustc --explain E0004`.
Future incompatibility report: Future breakage diagnostic:
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:96:9
|
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: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
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:98:9
|
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: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
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
|
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: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
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
|
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: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
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
|
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: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
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
|
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: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
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
|
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: `#[warn(pointer_structural_match)]` on by default

Future breakage diagnostic:
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
|
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: `#[warn(pointer_structural_match)]` on by default

Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ LL | #![warn(indirect_structural_match)]

warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
--> $DIR/cant-hide-behind-doubly-indirect-embedded.rs:24:9
|
LL | WRAP_DOUBLY_INDIRECT_INLINE => { panic!("WRAP_DOUBLY_INDIRECT_INLINE matched itself"); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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: 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/cant-hide-behind-doubly-indirect-embedded.rs:7:9
|
LL | #![warn(indirect_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ LL | #![warn(indirect_structural_match)]

warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
--> $DIR/cant-hide-behind-doubly-indirect-param.rs:24:9
|
LL | WRAP_DOUBLY_INDIRECT_PARAM => { panic!("WRAP_DOUBLY_INDIRECT_PARAM matched itself"); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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: 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/cant-hide-behind-doubly-indirect-param.rs:7:9
|
LL | #![warn(indirect_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ LL | #![warn(indirect_structural_match)]

warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
--> $DIR/cant-hide-behind-indirect-struct-embedded.rs:24:9
|
LL | WRAP_INDIRECT_INLINE => { panic!("WRAP_INDIRECT_INLINE matched itself"); }
| ^^^^^^^^^^^^^^^^^^^^
|
= 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: 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/cant-hide-behind-indirect-struct-embedded.rs:7:9
|
LL | #![warn(indirect_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ LL | #![warn(indirect_structural_match)]

warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
--> $DIR/cant-hide-behind-indirect-struct-param.rs:24:9
|
LL | WRAP_INDIRECT_PARAM => { panic!("WRAP_INDIRECT_PARAM matched itself"); }
| ^^^^^^^^^^^^^^^^^^^
|
= 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: 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/cant-hide-behind-indirect-struct-param.rs:7:9
|
LL | #![warn(indirect_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^

Loading