1
Fork 0

remove IndirectStructuralMatch lint, emit the usual hard error instead

This commit is contained in:
Ralf Jung 2024-05-03 15:24:53 +02:00
parent 79734f1db8
commit 179a6a08b1
31 changed files with 54 additions and 398 deletions

View file

@ -50,7 +50,6 @@ declare_lint_pass! {
HIDDEN_GLOB_REEXPORTS,
ILL_FORMED_ATTRIBUTE_INPUT,
INCOMPLETE_INCLUDE,
INDIRECT_STRUCTURAL_MATCH,
INEFFECTIVE_UNSTABLE_TRAIT_IMPL,
INLINE_NO_SANITIZE,
INVALID_DOC_ATTRIBUTES,
@ -2355,52 +2354,6 @@ declare_lint! {
"outlives requirements can be inferred"
}
declare_lint! {
/// The `indirect_structural_match` lint detects a `const` in a pattern
/// that manually implements [`PartialEq`] and [`Eq`].
///
/// [`PartialEq`]: https://doc.rust-lang.org/std/cmp/trait.PartialEq.html
/// [`Eq`]: https://doc.rust-lang.org/std/cmp/trait.Eq.html
///
/// ### Example
///
/// ```rust,compile_fail
/// #![deny(indirect_structural_match)]
///
/// struct NoDerive(i32);
/// impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
/// impl Eq for NoDerive { }
/// #[derive(PartialEq, Eq)]
/// struct WrapParam<T>(T);
/// const WRAP_INDIRECT_PARAM: & &WrapParam<NoDerive> = & &WrapParam(NoDerive(0));
/// fn main() {
/// match WRAP_INDIRECT_PARAM {
/// WRAP_INDIRECT_PARAM => { }
/// _ => { }
/// }
/// }
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// The compiler unintentionally accepted this form in the past. This is a
/// [future-incompatible] lint to transition this to a hard error in the
/// future. See [issue #62411] for a complete description of the problem,
/// and some possible solutions.
///
/// [issue #62411]: https://github.com/rust-lang/rust/issues/62411
/// [future-incompatible]: ../index.md#future-incompatible-lints
pub INDIRECT_STRUCTURAL_MATCH,
Warn,
"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 #120362 <https://github.com/rust-lang/rust/issues/120362>",
};
}
declare_lint! {
/// The `deprecated_in_future` lint is internal to rustc and should not be
/// used by user code.