File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -592,11 +592,9 @@ impl<T: ?Sized> Rc<T> {
592592 pub fn as_ptr ( this : & Self ) -> * const T {
593593 let ptr: * mut RcBox < T > = NonNull :: as_ptr ( this. ptr ) ;
594594
595- // SAFETY: This cannot go through Deref::deref.
596- // Instead, we manually offset the pointer rather than manifesting a reference.
597- // This is so that the returned pointer retains the same provenance as our pointer.
598- // This is required so that e.g. `get_mut` can write through the pointer
599- // after the Rc is recovered through `from_raw`.
595+ // SAFETY: This cannot go through Deref::deref or Rc::inner.
596+ // This is required to retain raw/mut provenance such that e.g. `get_mut` can
597+ // write through the pointer after the Rc is recovered through `from_raw`.
600598 unsafe { & raw const ( * ptr) . value }
601599 }
602600
Original file line number Diff line number Diff line change @@ -591,11 +591,9 @@ impl<T: ?Sized> Arc<T> {
591591 pub fn as_ptr ( this : & Self ) -> * const T {
592592 let ptr: * mut ArcInner < T > = NonNull :: as_ptr ( this. ptr ) ;
593593
594- // SAFETY: This cannot go through Deref::deref.
595- // Instead, we manually offset the pointer rather than manifesting a reference.
596- // This is so that the returned pointer retains the same provenance as our pointer.
597- // This is required so that e.g. `get_mut` can write through the pointer
598- // after the Arc is recovered through `from_raw`.
594+ // SAFETY: This cannot go through Deref::deref or RcBoxPtr::inner.
595+ // This is required to retain raw/mut provenance such that e.g. `get_mut` can
596+ // write through the pointer after the Rc is recovered through `from_raw`.
599597 unsafe { & raw const ( * ptr) . data }
600598 }
601599
You can’t perform that action at this time.
0 commit comments