Skip to content

Commit b10b9e2

Browse files
committed
Remove "pointer describes" terminology
1 parent f00b458 commit b10b9e2

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

library/alloc/src/rc.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ impl<T: ?Sized> Weak<T> {
18991899
// a valid pointer, so that `from_raw` can reverse this transformation.
19001900
(ptr as *mut T).set_ptr_value(ptr::null_mut())
19011901
} else {
1902-
// SAFETY: If the pointer is not dangling, it describes to a valid allocation.
1902+
// SAFETY: If the pointer is not dangling, it references a valid allocation.
19031903
// The payload may be dropped at this point, and we have to maintain provenance,
19041904
// so use raw pointer manipulation.
19051905
unsafe { &raw mut (*ptr).value }
@@ -1991,8 +1991,8 @@ impl<T: ?Sized> Weak<T> {
19911991
// SAFETY: this is the same sentinel as used in Weak::new and is_dangling
19921992
(ptr as *mut RcBox<T>).set_ptr_value(usize::MAX as *mut _)
19931993
} else {
1994-
// Otherwise, this describes a real allocation.
1995-
// SAFETY: data_offset is safe to call, as ptr describes a real allocation.
1994+
// Otherwise, this references a real allocation.
1995+
// SAFETY: data_offset is safe to call, as ptr references a real (potentially dropped) T.
19961996
let offset = unsafe { data_offset(ptr) };
19971997
// Thus, we reverse the offset to get the whole RcBox.
19981998
// SAFETY: the pointer originated from a Weak, so this offset is safe.
@@ -2320,8 +2320,7 @@ impl<T: ?Sized> AsRef<T> for Rc<T> {
23202320
#[stable(feature = "pin", since = "1.33.0")]
23212321
impl<T: ?Sized> Unpin for Rc<T> {}
23222322

2323-
/// Get the offset within an `RcBox` for
2324-
/// a payload of type described by a pointer.
2323+
/// Get the offset within an `RcBox` for the payload behind a pointer.
23252324
///
23262325
/// # Safety
23272326
///

library/alloc/src/sync.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ impl<T: ?Sized> Weak<T> {
16851685
// a valid pointer, so that `from_raw` can reverse this transformation.
16861686
(ptr as *mut T).set_ptr_value(ptr::null_mut())
16871687
} else {
1688-
// SAFETY: If the pointer is not dangling, it describes to a valid allocation.
1688+
// SAFETY: If the pointer is not dangling, it references a valid allocation.
16891689
// The payload may be dropped at this point, and we have to maintain provenance,
16901690
// so use raw pointer manipulation.
16911691
unsafe { &raw mut (*ptr).data }
@@ -1777,8 +1777,8 @@ impl<T: ?Sized> Weak<T> {
17771777
// SAFETY: this is the same sentinel as used in Weak::new and is_dangling
17781778
(ptr as *mut ArcInner<T>).set_ptr_value(usize::MAX as *mut _)
17791779
} else {
1780-
// Otherwise, this describes a real allocation.
1781-
// SAFETY: data_offset is safe to call, as ptr describes a real allocation.
1780+
// Otherwise, this references a real allocation.
1781+
// SAFETY: data_offset is safe to call, as ptr references a real (potentially dropped) T.
17821782
let offset = unsafe { data_offset(ptr) };
17831783
// Thus, we reverse the offset to get the whole RcBox.
17841784
// SAFETY: the pointer originated from a Weak, so this offset is safe.
@@ -2471,8 +2471,7 @@ impl<T: ?Sized> AsRef<T> for Arc<T> {
24712471
#[stable(feature = "pin", since = "1.33.0")]
24722472
impl<T: ?Sized> Unpin for Arc<T> {}
24732473

2474-
/// Get the offset within an `ArcInner` for
2475-
/// a payload of type described by a pointer.
2474+
/// Get the offset within an `ArcInner` for the payload behind a pointer.
24762475
///
24772476
/// # Safety
24782477
///

0 commit comments

Comments
 (0)