diff options
Diffstat (limited to 'library/alloc/src/rc.rs')
| -rw-r--r-- | library/alloc/src/rc.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 59f3a50ddb7..263b1449de1 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -2778,7 +2778,7 @@ impl<T, A: Allocator> Weak<T, A> { } } -pub(crate) fn is_dangling<T: ?Sized>(ptr: *mut T) -> bool { +pub(crate) fn is_dangling<T: ?Sized>(ptr: *const T) -> bool { (ptr.cast::<()>()).addr() == usize::MAX } @@ -3003,7 +3003,7 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> { pub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Self { // See Weak::as_ptr for context on how the input pointer is derived. - let ptr = if is_dangling(ptr as *mut T) { + let ptr = if is_dangling(ptr) { // This is a dangling Weak. ptr as *mut RcBox<T> } else { |
