summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Antinori <nico.antinori.7@gmail.com>2026-07-23 19:19:46 +0100
committerGary Guo <gary@garyguo.net>2026-07-27 11:52:08 +0100
commit6d0795b507fb1db2e6aefe533d949db3a4abf4c6 (patch)
treee7f5a249168d39de93cf5894696e45f5b0bae8dd
parent9e813b9abdfb626f0607b1ec94d201a2b8691f4e (diff)
downloadlinux-next-6d0795b507fb1db2e6aefe533d949db3a4abf4c6.tar.gz
linux-next-6d0795b507fb1db2e6aefe533d949db3a4abf4c6.zip
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>
-rw-r--r--rust/pin-init/src/lib.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index 1f5005c110cd..f4ccb0e87200 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -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() }