diff options
| author | Chris Gregory <czipperz@gmail.com> | 2019-03-25 18:04:42 -0400 |
|---|---|---|
| committer | Chris Gregory <czipperz@gmail.com> | 2019-03-25 18:04:42 -0400 |
| commit | fd42918a41c0093ac8db6bcf757f906c6adeaffa (patch) | |
| tree | 5c17325ed6a07462dcd8695a037366785798b5a5 /src | |
| parent | 4c27fb19ba15a2e45485e601a79914c6280196b0 (diff) | |
| download | rust-fd42918a41c0093ac8db6bcf757f906c6adeaffa.tar.gz rust-fd42918a41c0093ac8db6bcf757f906c6adeaffa.zip | |
Link to PhantomData in NonNull documentation
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/ptr.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index a9a029d606d..daae71d36e1 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2869,10 +2869,10 @@ impl<'a, T: ?Sized> From<NonNull<T>> for Unique<T> { /// However the pointer may still dangle if it isn't dereferenced. /// /// Unlike `*mut T`, `NonNull<T>` is covariant over `T`. If this is incorrect -/// for your use case, you should include some PhantomData in your type to +/// for your use case, you should include some [`PhantomData`] in your type to /// provide invariance, such as `PhantomData<Cell<T>>` or `PhantomData<&'a mut T>`. /// Usually this won't be necessary; covariance is correct for most safe abstractions, -/// such as Box, Rc, Arc, Vec, and LinkedList. This is the case because they +/// such as `Box`, `Rc`, `Arc`, `Vec`, and `LinkedList`. This is the case because they /// provide a public API that follows the normal shared XOR mutable rules of Rust. /// /// Notice that `NonNull<T>` has a `From` instance for `&T`. However, this does @@ -2883,6 +2883,7 @@ impl<'a, T: ?Sized> From<NonNull<T>> for Unique<T> { /// it is your responsibility to ensure that `as_mut` is never called, and `as_ptr` /// is never used for mutation. /// +/// [`PhantomData`]: ../marker/struct.PhantomData.html /// [`UnsafeCell<T>`]: ../cell/struct.UnsafeCell.html #[stable(feature = "nonnull", since = "1.25.0")] #[repr(transparent)] |
