docs: link Zeroable::zeroed and pin_init::zeroed in documentation - #158
Merged
Conversation
nbdd0121
reviewed
Jul 10, 2026
nbdd0121
reviewed
Jul 12, 2026
nicoan
force-pushed
the
zeroed_docs
branch
2 times, most recently
from
July 15, 2026 12:49
3f07ab7 to
cd9092b
Compare
Modify the comments in the `pin_init::zeroed` and `Zeroable::zeroed` functions to cross-reference each other and make developers aware of both options. This also adapts the example code in `Zeroable::zeroed` doc comments to use that function. Suggested-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/rust-for-linux/CANiq72kdCAyRUmXFcqQfkHpk1miG8Gagsn0_5U8p4WpKxv9d_g@mail.gmail.com/ Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com> [ Fix link. - Gary ] Signed-off-by: Gary Guo <gary@garyguo.net>
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains two commits.
docs: link
Zeroable::zeroedandpin_init::zeroedin documentationModify the comments in the
pin_init::zeroedandZeroable::zeroedfunctions to cross-reference each other and make developers aware of
both options.
This also adapts the example code in
Zeroable::zeroeddoc comments touse that function.
mark pin_init::zeroed and Zeroable::zeroed as #[inline]
The
pin_init::zeroedfunction is a trivial wrapper aroundunsafe { core::mem::zeroed() }, whereasZeroable::zeroedis atrivial wrapper around
pin_init::zeroed. Mark them both as#[inline]to avoid generating unnecessary symbols for them.