From a41510f30350c17dcc82971af873dde95da8f67b Mon Sep 17 00:00:00 2001 From: Lokathor Date: Mon, 13 May 2024 10:59:46 -0600 Subject: [PATCH] put const_zeroed into the changelog --- changelog.md | 5 +++++ src/lib.rs | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 67164a9..2edde97 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # `bytemuck` changelog +## 1.16.0 (UNRELEASED) + +* Adds a `const_zeroed` feature (MSRV 1.75) which puts a `zeroed` fn at the crate root. + This is just like the `Zeroable::zeroed` method, but as a `const fn`. + ## 1.15.0 This primarily relaxes the bounds on a `From` impl. diff --git a/src/lib.rs b/src/lib.rs index b3e3e1a..6474817 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -514,11 +514,10 @@ pub fn fill_zeroes(slice: &mut [T]) { } } -/// Initialize a zeroed `T`. -/// -/// Like [`Zeroable::zeroed`], but supports const. +/// Same as [`Zeroable::zeroed`], but as a `const fn` const. #[cfg(feature = "const_zeroed")] #[inline] +#[must_use] pub const fn zeroed() -> T { unsafe { core::mem::zeroed() } }