Allow ambiguous_wide_pointer_comparisons lint for std methods
This commit is contained in:
parent
6856a86808
commit
30c7b18d25
4 changed files with 14 additions and 0 deletions
|
@ -1765,6 +1765,7 @@ impl<T> *const [T] {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: ?Sized> PartialEq for *const T {
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn eq(&self, other: &*const T) -> bool {
|
||||
*self == *other
|
||||
}
|
||||
|
@ -1777,6 +1778,7 @@ impl<T: ?Sized> Eq for *const T {}
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: ?Sized> Ord for *const T {
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn cmp(&self, other: &*const T) -> Ordering {
|
||||
if self < other {
|
||||
Less
|
||||
|
@ -1796,21 +1798,25 @@ impl<T: ?Sized> PartialOrd for *const T {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn lt(&self, other: &*const T) -> bool {
|
||||
*self < *other
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn le(&self, other: &*const T) -> bool {
|
||||
*self <= *other
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn gt(&self, other: &*const T) -> bool {
|
||||
*self > *other
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn ge(&self, other: &*const T) -> bool {
|
||||
*self >= *other
|
||||
}
|
||||
|
|
|
@ -1885,6 +1885,7 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
|
|||
#[inline(always)]
|
||||
#[must_use = "pointer comparison produces a value"]
|
||||
#[rustc_diagnostic_item = "ptr_eq"]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))] // it's actually clear here
|
||||
pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
|
||||
a == b
|
||||
}
|
||||
|
|
|
@ -2189,6 +2189,7 @@ impl<T> *mut [T] {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: ?Sized> PartialEq for *mut T {
|
||||
#[inline(always)]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn eq(&self, other: &*mut T) -> bool {
|
||||
*self == *other
|
||||
}
|
||||
|
@ -2200,6 +2201,7 @@ impl<T: ?Sized> Eq for *mut T {}
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: ?Sized> Ord for *mut T {
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn cmp(&self, other: &*mut T) -> Ordering {
|
||||
if self < other {
|
||||
Less
|
||||
|
@ -2219,21 +2221,25 @@ impl<T: ?Sized> PartialOrd for *mut T {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn lt(&self, other: &*mut T) -> bool {
|
||||
*self < *other
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn le(&self, other: &*mut T) -> bool {
|
||||
*self <= *other
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn gt(&self, other: &*mut T) -> bool {
|
||||
*self > *other
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn ge(&self, other: &*mut T) -> bool {
|
||||
*self >= *other
|
||||
}
|
||||
|
|
|
@ -1792,6 +1792,7 @@ impl<T: ?Sized> Eq for NonNull<T> {}
|
|||
#[stable(feature = "nonnull", since = "1.25.0")]
|
||||
impl<T: ?Sized> PartialEq for NonNull<T> {
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.as_ptr() == other.as_ptr()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue