Allow ambiguous_wide_pointer_comparisons lint for std methods
This commit is contained in:
parent
6856a86808
commit
30c7b18d25
@ -1765,6 +1765,7 @@ impl<T> *const [T] {
|
|||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<T: ?Sized> PartialEq for *const T {
|
impl<T: ?Sized> PartialEq for *const T {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn eq(&self, other: &*const T) -> bool {
|
fn eq(&self, other: &*const T) -> bool {
|
||||||
*self == *other
|
*self == *other
|
||||||
}
|
}
|
||||||
@ -1777,6 +1778,7 @@ impl<T: ?Sized> Eq for *const T {}
|
|||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<T: ?Sized> Ord for *const T {
|
impl<T: ?Sized> Ord for *const T {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn cmp(&self, other: &*const T) -> Ordering {
|
fn cmp(&self, other: &*const T) -> Ordering {
|
||||||
if self < other {
|
if self < other {
|
||||||
Less
|
Less
|
||||||
@ -1796,21 +1798,25 @@ impl<T: ?Sized> PartialOrd for *const T {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn lt(&self, other: &*const T) -> bool {
|
fn lt(&self, other: &*const T) -> bool {
|
||||||
*self < *other
|
*self < *other
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn le(&self, other: &*const T) -> bool {
|
fn le(&self, other: &*const T) -> bool {
|
||||||
*self <= *other
|
*self <= *other
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn gt(&self, other: &*const T) -> bool {
|
fn gt(&self, other: &*const T) -> bool {
|
||||||
*self > *other
|
*self > *other
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn ge(&self, other: &*const T) -> bool {
|
fn ge(&self, other: &*const T) -> bool {
|
||||||
*self >= *other
|
*self >= *other
|
||||||
}
|
}
|
||||||
|
@ -1885,6 +1885,7 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
|
|||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[must_use = "pointer comparison produces a value"]
|
#[must_use = "pointer comparison produces a value"]
|
||||||
#[rustc_diagnostic_item = "ptr_eq"]
|
#[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 {
|
pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
|
||||||
a == b
|
a == b
|
||||||
}
|
}
|
||||||
|
@ -2189,6 +2189,7 @@ impl<T> *mut [T] {
|
|||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<T: ?Sized> PartialEq for *mut T {
|
impl<T: ?Sized> PartialEq for *mut T {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn eq(&self, other: &*mut T) -> bool {
|
fn eq(&self, other: &*mut T) -> bool {
|
||||||
*self == *other
|
*self == *other
|
||||||
}
|
}
|
||||||
@ -2200,6 +2201,7 @@ impl<T: ?Sized> Eq for *mut T {}
|
|||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<T: ?Sized> Ord for *mut T {
|
impl<T: ?Sized> Ord for *mut T {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn cmp(&self, other: &*mut T) -> Ordering {
|
fn cmp(&self, other: &*mut T) -> Ordering {
|
||||||
if self < other {
|
if self < other {
|
||||||
Less
|
Less
|
||||||
@ -2219,21 +2221,25 @@ impl<T: ?Sized> PartialOrd for *mut T {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn lt(&self, other: &*mut T) -> bool {
|
fn lt(&self, other: &*mut T) -> bool {
|
||||||
*self < *other
|
*self < *other
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn le(&self, other: &*mut T) -> bool {
|
fn le(&self, other: &*mut T) -> bool {
|
||||||
*self <= *other
|
*self <= *other
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn gt(&self, other: &*mut T) -> bool {
|
fn gt(&self, other: &*mut T) -> bool {
|
||||||
*self > *other
|
*self > *other
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn ge(&self, other: &*mut T) -> bool {
|
fn ge(&self, other: &*mut T) -> bool {
|
||||||
*self >= *other
|
*self >= *other
|
||||||
}
|
}
|
||||||
|
@ -1792,6 +1792,7 @@ impl<T: ?Sized> Eq for NonNull<T> {}
|
|||||||
#[stable(feature = "nonnull", since = "1.25.0")]
|
#[stable(feature = "nonnull", since = "1.25.0")]
|
||||||
impl<T: ?Sized> PartialEq for NonNull<T> {
|
impl<T: ?Sized> PartialEq for NonNull<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.as_ptr() == other.as_ptr()
|
self.as_ptr() == other.as_ptr()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user