<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/rust/pin-init/src, branch v6.16</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.16</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.16'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-05-01T16:16:22Z</updated>
<entry>
<title>rust: pin-init: improve documentation for `Zeroable` derive macros</title>
<updated>2025-05-01T16:16:22Z</updated>
<author>
<name>Benno Lossin</name>
<email>benno.lossin@proton.me</email>
</author>
<published>2025-04-26T08:39:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9de1a293c8ece00d226b21a35751ec178be2a9fa'/>
<id>urn:sha1:9de1a293c8ece00d226b21a35751ec178be2a9fa</id>
<content type='text'>
Specify that both `MaybeZeroable` and `Zeroable` work on `union`s. Add a
doc example for a union. Also include an example with visibility on the
field.

Link: https://github.com/Rust-for-Linux/pin-init/pull/48/commits/ab0985a0e08df06c60a32ca5888f74adcc2c1cf3
Reviewed-by: Christian Schrefl &lt;chrisi.schrefl@gmail.com&gt;
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: fix typos</title>
<updated>2025-05-01T16:15:37Z</updated>
<author>
<name>Benno Lossin</name>
<email>benno.lossin@proton.me</email>
</author>
<published>2025-04-26T08:39:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a919ba21594bfa1e67639785d409e1bdce332097'/>
<id>urn:sha1:a919ba21594bfa1e67639785d409e1bdce332097</id>
<content type='text'>
Correct two typos in the `Wrapper::pin_init` documentation.

Link: https://github.com/Rust-for-Linux/pin-init/pull/48/commits/fd0bf5e244b685188dc642fc4a0bd3f042468fdb
Reviewed-by: Christian Schrefl &lt;chrisi.schrefl@gmail.com&gt;
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: add `MaybeZeroable` derive macro</title>
<updated>2025-05-01T16:15:26Z</updated>
<author>
<name>Benno Lossin</name>
<email>benno.lossin@proton.me</email>
</author>
<published>2025-04-21T22:18:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=00fccd3ecc2129ee32fd181079eb643f497044c4'/>
<id>urn:sha1:00fccd3ecc2129ee32fd181079eb643f497044c4</id>
<content type='text'>
This derive macro implements `Zeroable` for structs &amp; unions precisely
if all fields also implement `Zeroable` and does nothing otherwise. The
plain `Zeroable` derive macro instead errors when it cannot derive
`Zeroable` safely. The `MaybeZeroable` derive macro is useful in cases
where manual checking is infeasible such as with the bindings crate.

Move the zeroable generics parsing into a standalone function in order
to avoid code duplication between the two derive macros.

Link: https://github.com/Rust-for-Linux/pin-init/pull/42/commits/1165cdad1a391b923efaf30cf76bc61e38da022e
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: allow `Zeroable` derive macro to also be applied to unions</title>
<updated>2025-05-01T16:15:12Z</updated>
<author>
<name>Benno Lossin</name>
<email>benno.lossin@proton.me</email>
</author>
<published>2025-04-21T22:18:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a313d41a2b515bbb76d56df490b731ff6d64e571'/>
<id>urn:sha1:a313d41a2b515bbb76d56df490b731ff6d64e571</id>
<content type='text'>
Enabling the same behavior for unions as for structs is correct, but
could be relaxed: the valid bit patterns for unions are the union of all
valid bit patterns of their fields. So for a union to implement
`Zeroable`, only a single field needs to implement `Zeroable`. This can
be a future improvement, as it is currently only needed for unions where
all fields implement `Zeroable`.

There is no danger for mis-parsing with the two optional tokens (ie
neither one or both tokens are parsed), as the compiler will already
have rejected that before giving it as the input to the derive macro.

Link: https://github.com/Rust-for-Linux/pin-init/pull/42/commits/5927b497ce522d82f6c082d5ba9235df57bfdb32
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: allow `pub` fields in `derive(Zeroable)`</title>
<updated>2025-05-01T16:14:46Z</updated>
<author>
<name>Benno Lossin</name>
<email>benno.lossin@proton.me</email>
</author>
<published>2025-04-21T22:18:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=983d13fc2cf12f0a753700d48be7d04155a1272c'/>
<id>urn:sha1:983d13fc2cf12f0a753700d48be7d04155a1272c</id>
<content type='text'>
Add support for parsing `pub`, `pub(crate)` and `pub(super)` to the
derive macro `Zeroable`.

Link: https://github.com/Rust-for-Linux/pin-init/pull/42/commits/e8311e52ca57273e7ed6d099144384971677a0ba
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: Update the structural pinning link in readme.</title>
<updated>2025-05-01T16:14:40Z</updated>
<author>
<name>Christian Schrefl</name>
<email>chrisi.schrefl@gmail.com</email>
</author>
<published>2025-04-21T22:18:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c3815aa4bb5c6248e78785269357e87bfa4d0909'/>
<id>urn:sha1:c3815aa4bb5c6248e78785269357e87bfa4d0909</id>
<content type='text'>
The previous link anchor was broken in rust 1.77, because the
documentation was refactored in upstream rust.
Change the link to refer to the new section in the rust documentation.

Signed-off-by: Christian Schrefl &lt;chrisi.schrefl@gmail.com&gt;
Link: https://github.com/Rust-for-Linux/pin-init/pull/37/commits/a146142fe18cafa52f8c6da306ca2729d789cfbf
[ Fixed commit authorship. - Benno ]
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: Update Changelog and Readme</title>
<updated>2025-05-01T16:14:29Z</updated>
<author>
<name>Christian Schrefl</name>
<email>chrisi.schrefl@gmail.com</email>
</author>
<published>2025-04-21T22:18:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bc5f3e0e01a5f2d067ff4292d5a10093ae680f53'/>
<id>urn:sha1:bc5f3e0e01a5f2d067ff4292d5a10093ae680f53</id>
<content type='text'>
Add Changelog entry for the `Wrapper` trait and document the
`unsafe-pinned` feature in the Readme.

Signed-off-by: Christian Schrefl &lt;chrisi.schrefl@gmail.com&gt;
Link: https://github.com/Rust-for-Linux/pin-init/pull/37/commits/986555f564645efb238e8092c6314388c859efe5
[ Fixed commit authorship. - Benno ]
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: Implement `Wrapper` for `UnsafePinned` behind feature flag.</title>
<updated>2025-05-01T16:13:56Z</updated>
<author>
<name>Christian Schrefl</name>
<email>chrisi.schrefl@gmail.com</email>
</author>
<published>2025-04-21T22:18:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b862aac8fd46601fa20226c9f5d6c6d308678b4d'/>
<id>urn:sha1:b862aac8fd46601fa20226c9f5d6c6d308678b4d</id>
<content type='text'>
Add the `unsafe-pinned` feature which gates the `Wrapper`
implementation of the `core::pin::UnsafePinned` struct.

For now this is just a cargo feature, but once `core::pin::UnsafePinned`
is stable a config flag can be added to allow the usage of this
implementation in the linux kernel.

Signed-off-by: Christian Schrefl &lt;chrisi.schrefl@gmail.com&gt;
Link: https://github.com/Rust-for-Linux/pin-init/pull/37/commits/99cb1934425357e780ea5b0628f66633123847b8
[ Fixed commit authorship. - Benno ]
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: Add the `Wrapper` trait.</title>
<updated>2025-05-01T16:10:54Z</updated>
<author>
<name>Christian Schrefl</name>
<email>chrisi.schrefl@gmail.com</email>
</author>
<published>2025-04-21T22:17:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2f7c73825f8f435ebdfb2cfa3b01cfa2b1c79041'/>
<id>urn:sha1:2f7c73825f8f435ebdfb2cfa3b01cfa2b1c79041</id>
<content type='text'>
This trait allows creating `PinInitializers` for wrapper or new-type
structs with the inner value structurally pinned, when given the
initializer for the inner value.

Implement this trait for `UnsafeCell` and `MaybeUninit`.

Signed-off-by: Christian Schrefl &lt;chrisi.schrefl@gmail.com&gt;
Link: https://github.com/Rust-for-Linux/pin-init/pull/37/commits/3ab4db083bd7b41a1bc23d937224f975d7400e50
[ Reworded commit message into imperative mode, fixed typo and fixed
  commit authorship. - Benno ]
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: add `cast_[pin_]init` functions to change the initialized type</title>
<updated>2025-05-01T16:08:52Z</updated>
<author>
<name>Benno Lossin</name>
<email>benno.lossin@proton.me</email>
</author>
<published>2025-04-21T22:17:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=90348980a305cc24a067cc6e606e1c318e277930'/>
<id>urn:sha1:90348980a305cc24a067cc6e606e1c318e277930</id>
<content type='text'>
These functions cast the given pointer from one type to another. They
are particularly useful when initializing transparent wrapper types.

Link: https://github.com/Rust-for-Linux/pin-init/pull/39/commits/80c03ddee41b154f1099fd8cc7c2bbd8c80af0ad
Reviewed-by: Christian Schrefl &lt;chrisi.schrefl@gmail.com&gt;
Signed-off-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
</content>
</entry>
</feed>
