Rollup merge of #49473 - joshtriplett:nonnull-size, r=steveklabnik

src/libcore/ptr.rs: Fix documentation for size of `Option<NonNull<T>>`

Seems more useful to say that it has the same size as `*mut T`.
This commit is contained in:
kennytm 2018-03-30 01:31:18 +02:00 committed by GitHub
commit 801deaeea2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2653,7 +2653,7 @@ impl<'a, T: ?Sized> From<NonNull<T>> for Unique<T> {
///
/// Unlike `*mut T`, the pointer must always be non-null, even if the pointer
/// is never dereferenced. This is so that enums may use this forbidden value
/// as a discriminant -- `Option<NonNull<T>>` has the same size as `NonNull<T>`.
/// as a discriminant -- `Option<NonNull<T>>` has the same size as `*mut 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