Auto merge of #116367 - scottmcm:more-addr-eq, r=workingjubilee
Use `addr_eq` in `{Arc,Rc}::ptr_eq` Since it's made for stuff like this (see #106447)
This commit is contained in:
commit
79f38b7914
@ -140,6 +140,7 @@
|
||||
#![feature(maybe_uninit_uninit_array_transpose)]
|
||||
#![feature(pattern)]
|
||||
#![feature(pointer_byte_offsets)]
|
||||
#![feature(ptr_addr_eq)]
|
||||
#![feature(ptr_internals)]
|
||||
#![feature(ptr_metadata)]
|
||||
#![feature(ptr_sub_ptr)]
|
||||
|
@ -1649,7 +1649,7 @@ pub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T {
|
||||
/// assert!(!Rc::ptr_eq(&five, &other_five));
|
||||
/// ```
|
||||
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
|
||||
this.ptr.as_ptr() as *const () == other.ptr.as_ptr() as *const ()
|
||||
ptr::addr_eq(this.ptr.as_ptr(), other.ptr.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
@ -3146,7 +3146,7 @@ fn inner(&self) -> Option<WeakInner<'_>> {
|
||||
#[must_use]
|
||||
#[stable(feature = "weak_ptr_eq", since = "1.39.0")]
|
||||
pub fn ptr_eq(&self, other: &Self) -> bool {
|
||||
ptr::eq(self.ptr.as_ptr() as *const (), other.ptr.as_ptr() as *const ())
|
||||
ptr::addr_eq(self.ptr.as_ptr(), other.ptr.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1778,7 +1778,7 @@ unsafe fn drop_slow(&mut self) {
|
||||
#[must_use]
|
||||
#[stable(feature = "ptr_eq", since = "1.17.0")]
|
||||
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
|
||||
this.ptr.as_ptr() as *const () == other.ptr.as_ptr() as *const ()
|
||||
ptr::addr_eq(this.ptr.as_ptr(), other.ptr.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
@ -2900,7 +2900,7 @@ fn inner(&self) -> Option<WeakInner<'_>> {
|
||||
#[must_use]
|
||||
#[stable(feature = "weak_ptr_eq", since = "1.39.0")]
|
||||
pub fn ptr_eq(&self, other: &Self) -> bool {
|
||||
ptr::eq(self.ptr.as_ptr() as *const (), other.ptr.as_ptr() as *const ())
|
||||
ptr::addr_eq(self.ptr.as_ptr(), other.ptr.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user