rename RcBox in other places too · qinheping/verify-rust-std@34f7831 (original) (raw)
`@@ -319,7 +319,7 @@ pub struct Weak<
`
319
319
`// but it is not necessarily a valid pointer.
`
320
320
`` // Weak::new
sets this to usize::MAX
so that it doesn’t need
``
321
321
`// to allocate space on the heap. That's not a value a real pointer
`
322
``
`-
// will ever have because RcBox has alignment at least 2.
`
``
322
`+
// will ever have because RcInner has alignment at least 2.
`
323
323
`` // This is only possible when T: Sized
; unsized T
never dangle.
``
324
324
`ptr: NonNull<ArcInner>,
`
325
325
`alloc: A,
`
`@@ -1581,7 +1581,7 @@ impl<T: ?Sized, A: Allocator> Arc<T, A> {
`
1581
1581
`pub fn as_ptr(this: &Self) -> *const T {
`
1582
1582
`let ptr: *mut ArcInner = NonNull::as_ptr(this.ptr);
`
1583
1583
``
1584
``
`-
// SAFETY: This cannot go through Deref::deref or RcBoxPtr::inner because
`
``
1584
`+
// SAFETY: This cannot go through Deref::deref or RcInnerPtr::inner because
`
1585
1585
`` // this is required to retain raw/mut provenance such that e.g. get_mut
can
``
1586
1586
`` // write through the pointer after the Rc is recovered through from_raw
.
``
1587
1587
`unsafe { &raw mut (*ptr).data }
`
`@@ -2936,7 +2936,7 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
`
2936
2936
`// Otherwise, we're guaranteed the pointer came from a nondangling Weak.
`
2937
2937
`// SAFETY: data_offset is safe to call, as ptr references a real (potentially dropped) T.
`
2938
2938
`let offset = unsafe { data_offset(ptr) };
`
2939
``
`-
// Thus, we reverse the offset to get the whole RcBox.
`
``
2939
`+
// Thus, we reverse the offset to get the whole RcInner.
`
2940
2940
`// SAFETY: the pointer originated from a Weak, so this offset is safe.
`
2941
2941
`unsafe { ptr.byte_sub(offset) as *mut ArcInner }
`
2942
2942
`};
`
`@@ -3861,7 +3861,7 @@ impl<T: ?Sized, A: Allocator> Unpin for Arc<T, A> {}
`
3861
3861
`/// valid instance of T, but the T is allowed to be dropped.
`
3862
3862
`unsafe fn data_offset<T: ?Sized>(ptr: *const T) -> usize {
`
3863
3863
`// Align the unsized value to the end of the ArcInner.
`
3864
``
`-
// Because RcBox is repr(C), it will always be the last field in memory.
`
``
3864
`+
// Because RcInner is repr(C), it will always be the last field in memory.
`
3865
3865
`// SAFETY: since the only unsized types possible are slices, trait objects,
`
3866
3866
`// and extern types, the input safety requirement is currently enough to
`
3867
3867
`// satisfy the requirements of align_of_val_raw; this is an implementation
`