Skip to content

Commit fd42918

Browse files
committed
Link to PhantomData in NonNull documentation
1 parent 4c27fb1 commit fd42918

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/ptr.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2869,10 +2869,10 @@ impl<'a, T: ?Sized> From<NonNull<T>> for Unique<T> {
28692869
/// However the pointer may still dangle if it isn't dereferenced.
28702870
///
28712871
/// Unlike `*mut T`, `NonNull<T>` is covariant over `T`. If this is incorrect
2872-
/// for your use case, you should include some PhantomData in your type to
2872+
/// for your use case, you should include some [`PhantomData`] in your type to
28732873
/// provide invariance, such as `PhantomData<Cell<T>>` or `PhantomData<&'a mut T>`.
28742874
/// Usually this won't be necessary; covariance is correct for most safe abstractions,
2875-
/// such as Box, Rc, Arc, Vec, and LinkedList. This is the case because they
2875+
/// such as `Box`, `Rc`, `Arc`, `Vec`, and `LinkedList`. This is the case because they
28762876
/// provide a public API that follows the normal shared XOR mutable rules of Rust.
28772877
///
28782878
/// 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> {
28832883
/// it is your responsibility to ensure that `as_mut` is never called, and `as_ptr`
28842884
/// is never used for mutation.
28852885
///
2886+
/// [`PhantomData`]: ../marker/struct.PhantomData.html
28862887
/// [`UnsafeCell<T>`]: ../cell/struct.UnsafeCell.html
28872888
#[stable(feature = "nonnull", since = "1.25.0")]
28882889
#[repr(transparent)]

0 commit comments

Comments
 (0)