Remove "pointer describes" terminology
This commit is contained in:
parent
f00b458903
commit
b10b9e25ff
2 changed files with 8 additions and 10 deletions
|
@ -1899,7 +1899,7 @@ impl<T: ?Sized> Weak<T> {
|
||||||
// a valid pointer, so that `from_raw` can reverse this transformation.
|
// a valid pointer, so that `from_raw` can reverse this transformation.
|
||||||
(ptr as *mut T).set_ptr_value(ptr::null_mut())
|
(ptr as *mut T).set_ptr_value(ptr::null_mut())
|
||||||
} else {
|
} else {
|
||||||
// SAFETY: If the pointer is not dangling, it describes to a valid allocation.
|
// SAFETY: If the pointer is not dangling, it references a valid allocation.
|
||||||
// The payload may be dropped at this point, and we have to maintain provenance,
|
// The payload may be dropped at this point, and we have to maintain provenance,
|
||||||
// so use raw pointer manipulation.
|
// so use raw pointer manipulation.
|
||||||
unsafe { &raw mut (*ptr).value }
|
unsafe { &raw mut (*ptr).value }
|
||||||
|
@ -1991,8 +1991,8 @@ impl<T: ?Sized> Weak<T> {
|
||||||
// SAFETY: this is the same sentinel as used in Weak::new and is_dangling
|
// SAFETY: this is the same sentinel as used in Weak::new and is_dangling
|
||||||
(ptr as *mut RcBox<T>).set_ptr_value(usize::MAX as *mut _)
|
(ptr as *mut RcBox<T>).set_ptr_value(usize::MAX as *mut _)
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, this describes a real allocation.
|
// Otherwise, this references a real allocation.
|
||||||
// SAFETY: data_offset is safe to call, as ptr describes a real allocation.
|
// SAFETY: data_offset is safe to call, as ptr references a real (potentially dropped) T.
|
||||||
let offset = unsafe { data_offset(ptr) };
|
let offset = unsafe { data_offset(ptr) };
|
||||||
// Thus, we reverse the offset to get the whole RcBox.
|
// Thus, we reverse the offset to get the whole RcBox.
|
||||||
// SAFETY: the pointer originated from a Weak, so this offset is safe.
|
// SAFETY: the pointer originated from a Weak, so this offset is safe.
|
||||||
|
@ -2320,8 +2320,7 @@ impl<T: ?Sized> AsRef<T> for Rc<T> {
|
||||||
#[stable(feature = "pin", since = "1.33.0")]
|
#[stable(feature = "pin", since = "1.33.0")]
|
||||||
impl<T: ?Sized> Unpin for Rc<T> {}
|
impl<T: ?Sized> Unpin for Rc<T> {}
|
||||||
|
|
||||||
/// Get the offset within an `RcBox` for
|
/// Get the offset within an `RcBox` for the payload behind a pointer.
|
||||||
/// a payload of type described by a pointer.
|
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
|
|
|
@ -1685,7 +1685,7 @@ impl<T: ?Sized> Weak<T> {
|
||||||
// a valid pointer, so that `from_raw` can reverse this transformation.
|
// a valid pointer, so that `from_raw` can reverse this transformation.
|
||||||
(ptr as *mut T).set_ptr_value(ptr::null_mut())
|
(ptr as *mut T).set_ptr_value(ptr::null_mut())
|
||||||
} else {
|
} else {
|
||||||
// SAFETY: If the pointer is not dangling, it describes to a valid allocation.
|
// SAFETY: If the pointer is not dangling, it references a valid allocation.
|
||||||
// The payload may be dropped at this point, and we have to maintain provenance,
|
// The payload may be dropped at this point, and we have to maintain provenance,
|
||||||
// so use raw pointer manipulation.
|
// so use raw pointer manipulation.
|
||||||
unsafe { &raw mut (*ptr).data }
|
unsafe { &raw mut (*ptr).data }
|
||||||
|
@ -1777,8 +1777,8 @@ impl<T: ?Sized> Weak<T> {
|
||||||
// SAFETY: this is the same sentinel as used in Weak::new and is_dangling
|
// SAFETY: this is the same sentinel as used in Weak::new and is_dangling
|
||||||
(ptr as *mut ArcInner<T>).set_ptr_value(usize::MAX as *mut _)
|
(ptr as *mut ArcInner<T>).set_ptr_value(usize::MAX as *mut _)
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, this describes a real allocation.
|
// Otherwise, this references a real allocation.
|
||||||
// SAFETY: data_offset is safe to call, as ptr describes a real allocation.
|
// SAFETY: data_offset is safe to call, as ptr references a real (potentially dropped) T.
|
||||||
let offset = unsafe { data_offset(ptr) };
|
let offset = unsafe { data_offset(ptr) };
|
||||||
// Thus, we reverse the offset to get the whole RcBox.
|
// Thus, we reverse the offset to get the whole RcBox.
|
||||||
// SAFETY: the pointer originated from a Weak, so this offset is safe.
|
// SAFETY: the pointer originated from a Weak, so this offset is safe.
|
||||||
|
@ -2471,8 +2471,7 @@ impl<T: ?Sized> AsRef<T> for Arc<T> {
|
||||||
#[stable(feature = "pin", since = "1.33.0")]
|
#[stable(feature = "pin", since = "1.33.0")]
|
||||||
impl<T: ?Sized> Unpin for Arc<T> {}
|
impl<T: ?Sized> Unpin for Arc<T> {}
|
||||||
|
|
||||||
/// Get the offset within an `ArcInner` for
|
/// Get the offset within an `ArcInner` for the payload behind a pointer.
|
||||||
/// a payload of type described by a pointer.
|
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue