Skip to content

docs: link Zeroable::zeroed and pin_init::zeroed in documentation - #158

Merged
nbdd0121 merged 2 commits into
Rust-for-Linux:mainfrom
nicoan:zeroed_docs
Jul 27, 2026
Merged

docs: link Zeroable::zeroed and pin_init::zeroed in documentation#158
nbdd0121 merged 2 commits into
Rust-for-Linux:mainfrom
nicoan:zeroed_docs

Conversation

@nicoan

@nicoan nicoan commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

This PR contains two commits.

docs: link Zeroable::zeroed and pin_init::zeroed in documentation

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.

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.

Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs
@nicoan nicoan changed the title docs: document preferences for Zeroable::zeroed vs pin_init::zeroed docs: link Zeroable::zeroed and pin_init::zeroed in documentation Jul 13, 2026
@nicoan
nicoan force-pushed the zeroed_docs branch 2 times, most recently from 3f07ab7 to cd9092b Compare July 15, 2026 12:49
nicoan added 2 commits July 27, 2026 12:12
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>
@nbdd0121
nbdd0121 merged commit 4f373cd into Rust-for-Linux:main Jul 27, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants