Skip to content

Commit

Permalink
put const_zeroed into the changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Lokathor committed May 13, 2024
1 parent 9319f48 commit a41510f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,10 @@ pub fn fill_zeroes<T: Zeroable>(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: Zeroable>() -> T {
unsafe { core::mem::zeroed() }
}

0 comments on commit a41510f

Please sign in to comment.