Skip to content

Commit c3ffdd5

Browse files
committed
change impl Zeroable for Option<NonNull<T>> to ZeroableOption for NonNull<T>
This brings it in line with references. It too is listed in [1]. Link: https://doc.rust-lang.org/stable/std/option/index.html#representation Signed-off-by: Benno Lossin <[email protected]>
1 parent 09dcb4f commit c3ffdd5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1552,6 +1552,9 @@ unsafe impl<T> ZeroableOption for &T {}
15521552
// SAFETY: `Option<&mut T>` is part of the option layout optimization guarantee:
15531553
// <https://doc.rust-lang.org/stable/std/option/index.html#representation>.
15541554
unsafe impl<T> ZeroableOption for &mut T {}
1555+
// SAFETY: `Option<NonNull<T>>` is part of the option layout optimization guarantee:
1556+
// <https://doc.rust-lang.org/stable/std/option/index.html#representation>.
1557+
unsafe impl<T> ZeroableOption for NonNull<T> {}
15551558

15561559
/// Create an initializer for a zeroed `T`.
15571560
///
@@ -1630,7 +1633,6 @@ impl_zeroable! {
16301633
Option<NonZeroU128>, Option<NonZeroUsize>,
16311634
Option<NonZeroI8>, Option<NonZeroI16>, Option<NonZeroI32>, Option<NonZeroI64>,
16321635
Option<NonZeroI128>, Option<NonZeroIsize>,
1633-
{<T>} Option<NonNull<T>>,
16341636

16351637
// SAFETY: `null` pointer is valid.
16361638
//

0 commit comments

Comments
 (0)