Repository: rust-lang/rust
File: library/core/src/cmp.rs (Rust)

Code before:
/// }
///
/// impl PartialEq for Book {
///     fn eq(&self, other: &Self) -> bool {
///         self.isbn == other.isbn
///     }
/// }
///
/// impl Eq for Book {}
/// ```
#[doc(alias = "==")]
#[doc(alias = "!=")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Eq"]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
pub const trait Eq: [const] PartialEq<Self> + PointeeSized {
    // this method is used solely by `impl Eq or #[derive(Eq)]` to assert that every component of a
    // type implements `Eq` itself. The current deriving infrastructure means doing this assertion
    // without using a method on this trait is nearly impossible.
    //
    // This should never be implemented by hand.
    #[doc(hidden)]
    #[coverage(off)]
    #[inline]
    #[stable(feature = "rust1", since = "1.0.0")]
    #[rustc_diagnostic_item = "assert_receiver_is_total_eq"]
    #[deprecated(since = "1.95.0", note = "implementation detail of `#[derive(Eq)]`")]
    fn assert_receiver_is_total_eq(&self) {}
}

/// Derive macro generating an impl of the trait [`Eq`].
#[rustc_builtin_macro]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics, derive_eq_internals, structural_match)]
#[allow_internal_unstable(coverage_attribute)]
pub macro Eq($item:item) {
    /* compiler built-in */
}

// FIXME: this struct is used solely by #[derive] to
// assert that every component of a type implements Eq.
//
// This struct should never appear in user code.
#[doc(hidden)]
#[allow(missing_debug_implementations)]
#[unstable(
    feature = "derive_eq_internals",
    reason = "deriving hack, should not be public",
    issue = "none"
)]
pub struct AssertParamIsEq<T: Eq + PointeeSized> {

Review comment (suggestion):
```suggestion
    #[deprecated(since = "CURRENT_RUSTC_VERSION", note = "implementation detail of `#[derive(Eq)]`")]
```

Code after:
/// }
///
/// impl PartialEq for Book {
///     fn eq(&self, other: &Self) -> bool {
///         self.isbn == other.isbn
///     }
/// }
///
/// impl Eq for Book {}
/// ```
#[doc(alias = "==")]
#[doc(alias = "!=")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Eq"]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
pub const trait Eq: [const] PartialEq<Self> + PointeeSized {
    // This method was used solely by `#[derive(Eq)]` to assert that every component of a
    // type implements `Eq` itself.
    //
    // This should never be implemented by hand.
    #[doc(hidden)]
    #[coverage(off)]
    #[inline]
    #[stable(feature = "rust1", since = "1.0.0")]
    #[rustc_diagnostic_item = "assert_receiver_is_total_eq"]
    #[deprecated(since = "1.95.0", note = "implementation detail of `#[derive(Eq)]`")]
    fn assert_receiver_is_total_eq(&self) {}

    // FIXME (#152504): this method is used solely by `#[derive(Eq)]` to assert that
    // every component of a type implements `Eq` itself. It will be removed again soon.
    #[doc(hidden)]
    #[coverage(off)]
    #[unstable(feature = "derive_eq_internals", issue = "none")]
    fn assert_fields_are_eq(&self) {}
}

/// Derive macro generating an impl of the trait [`Eq`].
#[rustc_builtin_macro]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics, derive_eq_internals, structural_match)]
#[allow_internal_unstable(coverage_attribute)]
pub macro Eq($item:item) {
    /* compiler built-in */
}

// FIXME: this struct is used solely by #[derive] to
// assert that every component of a type implements Eq.
//
// This struct should never appear in user code.
#[doc(hidden)]
#[allow(missing_debug_implementations)]