]> git.lizzy.rs Git - rust.git/commitdiff
Link to PhantomData in NonNull documentation
authorChris Gregory <czipperz@gmail.com>
Mon, 25 Mar 2019 22:04:42 +0000 (18:04 -0400)
committerChris Gregory <czipperz@gmail.com>
Mon, 25 Mar 2019 22:04:42 +0000 (18:04 -0400)
src/libcore/ptr.rs

index a9a029d606d6f84315931b1b69381dfe663c1de4..daae71d36e140444963f95c30a9bee2193321ef6 100644 (file)
@@ -2869,10 +2869,10 @@ fn from(p: NonNull<T>) -> Self {
 /// 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 @@ fn from(p: NonNull<T>) -> 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<T>`]: ../cell/struct.UnsafeCell.html
 #[stable(feature = "nonnull", since = "1.25.0")]
 #[repr(transparent)]