mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 09:13:07 +03:00
7a883469fd
deprecate `Eq::assert_receiver_is_total_eq` and emit FCW on manual impls The `Eq::assert_receiver_is_total_eq` method is purely meant as an implementation detail by `#[derive(Eq)]` to add checks that all fields of the type the derive is applied to also implement `Eq`. The method is already `#[doc(hidden)]` and has a comment saying `// This should never be implemented by hand.`. Unfortunately, it has been stable since 1.0 and there are some cases on GitHub (https://github.com/search?q=assert_receiver_is_total_eq&type=code) where people have implemented this method manually, sometimes even with actual code in the method body (example: https://github.com/Shresht7/codecrafters-redis-rust/blob/31f0ec453c504b4ab053a7b1c3ff548ff36a9db5/src/parser/resp/types.rs#L255). To prevent further confusion from this, this PR is deprecating the method and adds a FCW when it is manually implemented (this is necessary as the deprecation warning is not emitted when the method is implemented, only when it is called). This is similar to what was previously done with the `soft_unstable` lint (https://github.com/rust-lang/rust/issues/64266). See also https://github.com/rust-lang/libs-team/issues/704.