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() } }