rust: pin-init: mark pin_init::zeroed and Zeroable::zeroed as #[inline]

The `pin_init::zeroed` function is a trivial wrapper around
`unsafe { core::mem::zeroed() }`, whereas `Zeroable::zeroed` is a trivial
wrapper around `pin_init::zeroed`. Mark them both as `#[inline]` to avoid
generating unnecessary symbols for them.

Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com>
Signed-off-by: Gary Guo <gary@garyguo.net>
This commit is contained in:
Nicolás Antinori
2026-07-27 11:52:08 +01:00
committed by Gary Guo
parent 9e813b9abd
commit 6d0795b507
+2
View File
@@ -1557,6 +1557,7 @@ pub unsafe trait Zeroable {
/// assert_eq!(point.x, 0);
/// assert_eq!(point.y, 0);
/// ```
#[inline]
fn zeroed() -> Self
where
Self: Sized,
@@ -1603,6 +1604,7 @@ pub fn init_zeroed<T: Zeroable>() -> impl Init<T> {
/// assert_eq!(point.x, 0);
/// assert_eq!(point.y, 0);
/// ```
#[inline]
pub const fn zeroed<T: Zeroable>() -> T {
// SAFETY:By the type invariants of `Zeroable`, all zeroes is a valid bit pattern for `T`.
unsafe { core::mem::zeroed() }