diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index 97f936fbd9ea4..b3f6709dd9b9d 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -1747,6 +1747,7 @@ impl *const [T] { #[stable(feature = "rust1", since = "1.0.0")] impl PartialEq for *const T { #[inline] + #[allow(unclear_fat_pointer_comparisons)] fn eq(&self, other: &*const T) -> bool { *self == *other } @@ -1778,21 +1779,25 @@ impl PartialOrd for *const T { } #[inline] + #[allow(unclear_fat_pointer_comparisons)] fn lt(&self, other: &*const T) -> bool { *self < *other } #[inline] + #[allow(unclear_fat_pointer_comparisons)] fn le(&self, other: &*const T) -> bool { *self <= *other } #[inline] + #[allow(unclear_fat_pointer_comparisons)] fn gt(&self, other: &*const T) -> bool { *self > *other } #[inline] + #[allow(unclear_fat_pointer_comparisons)] fn ge(&self, other: &*const T) -> bool { *self >= *other } diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 63e42a8784c6a..b7eda0600785b 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1885,6 +1885,7 @@ pub(crate) const unsafe fn align_offset(p: *const T, a: usize) -> usiz #[inline(always)] #[must_use = "pointer comparison produces a value"] #[rustc_diagnostic_item = "ptr_eq"] +#[allow(unclear_fat_pointer_comparisons)] // it's actually clear here pub fn eq(a: *const T, b: *const T) -> bool { a == b } diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index 64695d63f0c9a..3c21b81531bea 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -2189,6 +2189,7 @@ impl *mut [T] { #[stable(feature = "rust1", since = "1.0.0")] impl PartialEq for *mut T { #[inline(always)] + #[allow(unclear_fat_pointer_comparisons)] fn eq(&self, other: &*mut T) -> bool { *self == *other } @@ -2219,21 +2220,25 @@ impl PartialOrd for *mut T { } #[inline(always)] + #[allow(unclear_fat_pointer_comparisons)] fn lt(&self, other: &*mut T) -> bool { *self < *other } #[inline(always)] + #[allow(unclear_fat_pointer_comparisons)] fn le(&self, other: &*mut T) -> bool { *self <= *other } #[inline(always)] + #[allow(unclear_fat_pointer_comparisons)] fn gt(&self, other: &*mut T) -> bool { *self > *other } #[inline(always)] + #[allow(unclear_fat_pointer_comparisons)] fn ge(&self, other: &*mut T) -> bool { *self >= *other } diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index ae673b7799ffe..05c56fa487725 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -783,6 +783,7 @@ impl Eq for NonNull {} #[stable(feature = "nonnull", since = "1.25.0")] impl PartialEq for NonNull { #[inline] + #[allow(unclear_fat_pointer_comparisons)] fn eq(&self, other: &Self) -> bool { self.as_ptr() == other.as_ptr() }