Update safety docs for Ptr::assert_unique
(#17394)
# Objective The safety documentation for `Ptr::assert_unique` is incomplete. Currently it only mentions the existence of other `Ptr` instances, but it should also mention that the underlying data must be mutable and that there cannot be active references to it.
This commit is contained in:
parent
72f70745c5
commit
77fd7bf7ce
@ -289,7 +289,9 @@ impl<'a, A: IsAligned> Ptr<'a, A> {
|
|||||||
/// Transforms this [`Ptr`] into an [`PtrMut`]
|
/// Transforms this [`Ptr`] into an [`PtrMut`]
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
/// Another [`PtrMut`] for the same [`Ptr`] must not be created until the first is dropped.
|
/// * The data pointed to by this `Ptr` must be valid for writes.
|
||||||
|
/// * There must be no active references (mutable or otherwise) to the data underlying this `Ptr`.
|
||||||
|
/// * Another [`PtrMut`] for the same [`Ptr`] must not be created until the first is dropped.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn assert_unique(self) -> PtrMut<'a, A> {
|
pub unsafe fn assert_unique(self) -> PtrMut<'a, A> {
|
||||||
PtrMut(self.0, PhantomData)
|
PtrMut(self.0, PhantomData)
|
||||||
|
Loading…
Reference in New Issue
Block a user