Repository: rust-lang/rust
File: compiler/rustc_lint/src/builtin.rs (Rust)

Code before:
        }
    }
}

declare_lint! {
    /// The `internal_eq_trait_method_impls` lint detects manual
    /// implementations of `Eq::assert_receiver_is_total_eq`.
    ///
    /// ### Example
    ///
    /// ```rust
    /// #[derive(PartialEq)]
    /// pub struct Foo;
    ///
    /// impl Eq for Foo {
    ///     fn assert_receiver_is_total_eq(&self) {}
    /// }
    /// ```
    ///
    /// {{produces}}
    ///
    /// ### Explanation
    ///
    /// This method exists so that `#[derive(Eq)]` can check that all
    /// fields of a type implement `Eq`. Other users were never supposed
    /// to implement it and it was hidden from documentation.
    ///
    /// Unfortunately, it was not explicitly marked as unstable and some
    /// people have now mistakenly assumed they had to implement this method.
    ///
    /// As the method is never called by the standard library, you can safely
    /// remove any implementations of the method and just write `impl Eq for Foo {}`.
    ///
    /// This is a [future-incompatible] lint to transition this to a hard
    /// error in the future. See [issue #152336] for more details.
    ///
    /// [issue #152336]: https://github.com/rust-lang/rust/issues/152336
    pub INTERNAL_EQ_TRAIT_METHOD_IMPLS,
    Warn,
    "manual implementation of the internal `Eq::assert_receiver_is_total_eq` method",
    @future_incompatible = FutureIncompatibleInfo {
        reason: fcw!(FutureReleaseError #152336),
        report_in_deps: false,
    };
}

declare_lint_pass!(InternalEqTraitMethodImpls => [INTERNAL_EQ_TRAIT_METHOD_IMPLS]);

impl<'tcx> LateLintPass<'tcx> for InternalEqTraitMethodImpls {
    fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx rustc_hir::ImplItem<'tcx>) {
        if let ImplItemImplKind::Trait { defaultness: _, trait_item_def_id: Ok(trait_item_def_id) } =

Review comment (suggestion):
```suggestion
    /// This method existed so that `#[derive(Eq)]` could check that all
    /// fields of a type implement `Eq`. Other users were never supposed
    /// to implement it and it was hidden from documentation.
```

Code after:
        }
    }
}

declare_lint! {
    /// The `internal_eq_trait_method_impls` lint detects manual
    /// implementations of `Eq::assert_receiver_is_total_eq`.
    ///
    /// ### Example
    ///
    /// ```rust
    /// #[derive(PartialEq)]
    /// pub struct Foo;
    ///
    /// impl Eq for Foo {
    ///     fn assert_receiver_is_total_eq(&self) {}
    /// }
    /// ```
    ///
    /// {{produces}}
    ///
    /// ### Explanation
    ///
    /// This method existed so that `#[derive(Eq)]` could check that all
    /// fields of a type implement `Eq`. Other users were never supposed
    /// to implement it and it was hidden from documentation.
    ///
    /// Unfortunately, it was not explicitly marked as unstable and some
    /// people have now mistakenly assumed they had to implement this method.
    ///
    /// As the method is never called by the standard library, you can safely
    /// remove any implementations of the method and just write `impl Eq for Foo {}`.
    ///
    /// This is a [future-incompatible] lint to transition this to a hard
    /// error in the future. See [issue #152336] for more details.
    ///
    /// [issue #152336]: https://github.com/rust-lang/rust/issues/152336
    pub INTERNAL_EQ_TRAIT_METHOD_IMPLS,
    Warn,
    "manual implementation of the internal `Eq::assert_receiver_is_total_eq` method",
    @future_incompatible = FutureIncompatibleInfo {
        reason: fcw!(FutureReleaseError #152336),
        report_in_deps: false,
    };
}

declare_lint_pass!(InternalEqTraitMethodImpls => [INTERNAL_EQ_TRAIT_METHOD_IMPLS]);

impl<'tcx> LateLintPass<'tcx> for InternalEqTraitMethodImpls {
    fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx rustc_hir::ImplItem<'tcx>) {
        if let ImplItemImplKind::Trait { defaultness: _, trait_item_def_id: Ok(trait_item_def_id) } =