Skip to content

Commit cd9092b

Browse files
committed
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>
1 parent 6a7fb43 commit cd9092b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,7 @@ pub unsafe trait Zeroable {
15571557
/// assert_eq!(point.x, 0);
15581558
/// assert_eq!(point.y, 0);
15591559
/// ```
1560+
#[inline]
15601561
fn zeroed() -> Self
15611562
where
15621563
Self: Sized,
@@ -1603,6 +1604,7 @@ pub fn init_zeroed<T: Zeroable>() -> impl Init<T> {
16031604
/// assert_eq!(point.x, 0);
16041605
/// assert_eq!(point.y, 0);
16051606
/// ```
1607+
#[inline]
16061608
pub const fn zeroed<T: Zeroable>() -> T {
16071609
// SAFETY:By the type invariants of `Zeroable`, all zeroes is a valid bit pattern for `T`.
16081610
unsafe { core::mem::zeroed() }

0 commit comments

Comments
 (0)