Skip to content

Commit d875d16

Browse files
committed
Add allow for newly added unclear_fat_pointer_comparisons lint
1 parent 5388007 commit d875d16

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

library/core/src/ptr/const_ptr.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,7 @@ impl<T> *const [T] {
17471747
#[stable(feature = "rust1", since = "1.0.0")]
17481748
impl<T: ?Sized> PartialEq for *const T {
17491749
#[inline]
1750+
#[allow(unclear_fat_pointer_comparisons)]
17501751
fn eq(&self, other: &*const T) -> bool {
17511752
*self == *other
17521753
}
@@ -1778,21 +1779,25 @@ impl<T: ?Sized> PartialOrd for *const T {
17781779
}
17791780

17801781
#[inline]
1782+
#[allow(unclear_fat_pointer_comparisons)]
17811783
fn lt(&self, other: &*const T) -> bool {
17821784
*self < *other
17831785
}
17841786

17851787
#[inline]
1788+
#[allow(unclear_fat_pointer_comparisons)]
17861789
fn le(&self, other: &*const T) -> bool {
17871790
*self <= *other
17881791
}
17891792

17901793
#[inline]
1794+
#[allow(unclear_fat_pointer_comparisons)]
17911795
fn gt(&self, other: &*const T) -> bool {
17921796
*self > *other
17931797
}
17941798

17951799
#[inline]
1800+
#[allow(unclear_fat_pointer_comparisons)]
17961801
fn ge(&self, other: &*const T) -> bool {
17971802
*self >= *other
17981803
}

library/core/src/ptr/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,7 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
18851885
#[inline(always)]
18861886
#[must_use = "pointer comparison produces a value"]
18871887
#[rustc_diagnostic_item = "ptr_eq"]
1888+
#[allow(unclear_fat_pointer_comparisons)] // it's actually clear here
18881889
pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
18891890
a == b
18901891
}

library/core/src/ptr/mut_ptr.rs

+5
Original file line numberDiff line numberDiff line change
@@ -2189,6 +2189,7 @@ impl<T> *mut [T] {
21892189
#[stable(feature = "rust1", since = "1.0.0")]
21902190
impl<T: ?Sized> PartialEq for *mut T {
21912191
#[inline(always)]
2192+
#[allow(unclear_fat_pointer_comparisons)]
21922193
fn eq(&self, other: &*mut T) -> bool {
21932194
*self == *other
21942195
}
@@ -2219,21 +2220,25 @@ impl<T: ?Sized> PartialOrd for *mut T {
22192220
}
22202221

22212222
#[inline(always)]
2223+
#[allow(unclear_fat_pointer_comparisons)]
22222224
fn lt(&self, other: &*mut T) -> bool {
22232225
*self < *other
22242226
}
22252227

22262228
#[inline(always)]
2229+
#[allow(unclear_fat_pointer_comparisons)]
22272230
fn le(&self, other: &*mut T) -> bool {
22282231
*self <= *other
22292232
}
22302233

22312234
#[inline(always)]
2235+
#[allow(unclear_fat_pointer_comparisons)]
22322236
fn gt(&self, other: &*mut T) -> bool {
22332237
*self > *other
22342238
}
22352239

22362240
#[inline(always)]
2241+
#[allow(unclear_fat_pointer_comparisons)]
22372242
fn ge(&self, other: &*mut T) -> bool {
22382243
*self >= *other
22392244
}

library/core/src/ptr/non_null.rs

+1
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ impl<T: ?Sized> Eq for NonNull<T> {}
783783
#[stable(feature = "nonnull", since = "1.25.0")]
784784
impl<T: ?Sized> PartialEq for NonNull<T> {
785785
#[inline]
786+
#[allow(unclear_fat_pointer_comparisons)]
786787
fn eq(&self, other: &Self) -> bool {
787788
self.as_ptr() == other.as_ptr()
788789
}

0 commit comments

Comments
 (0)