Skip to content

Tracking Issue for future-incompatibility lint internal_eq_trait_method_impls #152336

@cyrgani

Description

@cyrgani

This is the tracking issue for the internal_eq_trait_method_impls future-compatibility warning and other related errors. The goal of this page is to describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.

What is the warning for?

The Eq trait has the internal, undocumented helper method assert_receiver_is_total_eq. It was never meant to be called by anyone except for the expansion of #[derive(Eq)]. The internal_eq_trait_method_impls lint will issue a warning for any other implementations of this method.

Why was this change made?

The method dates back to the 1.0 release of Rust. Since then, it has gotten new syntax like const _ that will allow the derive macro to no longer need this method. There have also been cases where IDEs detected the presence of the method and automatically added a useless default implementation of the method. To prevent further confusion from this, this future-compatibility warning was added.
The lang and libs-api teams approved this lint in #149978 (comment).

Example

#[derive(PartialEq)]
pub struct Foo;

impl Eq for Foo {
    fn assert_receiver_is_total_eq(&self) {}
}

Recommendations

Remove any manual implementations of the method and just write impl Eq for Foo {}.

When will this warning become a hard error?

Unknown

Steps

Implementation history

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-future-incompatibilityCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions