From: Chris Gregory Date: Mon, 25 Mar 2019 22:04:42 +0000 (-0400) Subject: Link to PhantomData in NonNull documentation X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=fd42918a41c0093ac8db6bcf757f906c6adeaffa;p=rust.git Link to PhantomData in NonNull documentation --- 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 @@ fn from(p: NonNull) -> Self { /// However the pointer may still dangle if it isn't dereferenced. /// /// Unlike `*mut T`, `NonNull` 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>` 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` has a `From` instance for `&T`. However, this does @@ -2883,6 +2883,7 @@ fn from(p: NonNull) -> Self { /// 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`]: ../cell/struct.UnsafeCell.html #[stable(feature = "nonnull", since = "1.25.0")] #[repr(transparent)]