<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/rust/pin-init, 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-18T18:42:49Z</updated>
<entry>
<title>Merge tag 'pin-init-v6.16' of https://github.com/Rust-for-Linux/linux into rust-next</title>
<updated>2025-05-18T18:42:49Z</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2025-05-18T18:42:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b04d17062193dcc0fe5fc87adee5091319a482a0'/>
<id>urn:sha1:b04d17062193dcc0fe5fc87adee5091319a482a0</id>
<content type='text'>
Pull pin-init updates from Benno Lossin:
 "Added:

   - 'Wrapper&lt;T&gt;' trait for creating pin-initializers for wrapper
     structs with a structurally pinned value such as 'UnsafeCell&lt;T&gt;' or
     'MaybeUninit&lt;T&gt;'.

   - 'MaybeZeroable' derive macro to try to derive 'Zeroable', but not
     error if not all fields implement it. This is needed to derive
     'Zeroable' for all bindgen-generated structs.

   - 'unsafe fn cast_[pin_]init()' functions to unsafely change the
     initialized type of an initializer. These are utilized by the
     'Wrapper&lt;T&gt;' implementations.

  Changed:

   - Added support for visibility in 'Zeroable' derive macro.

   - Added support for 'union's in 'Zeroable' derive macro.

  Upstream dev news:

   - The CI has been streamlined &amp; some bugs with it have been fixed. I
     also added new workflows to check if the user-space version and the
     one in the kernel tree have diverged.

   - I also started to use the issues [1] tab to keep track of any
     problems or unexpected/unwanted things. This should help folks
     report and diagnose issues w.r.t. 'pin-init' better.

      [1] https://github.com/rust-for-linux/pin-init/issues"

* tag 'pin-init-v6.16' of https://github.com/Rust-for-Linux/linux:
  rust: pin-init: improve documentation for `Zeroable` derive macros
  rust: pin-init: fix typos
  rust: pin-init: add `MaybeZeroable` derive macro
  rust: pin-init: allow `Zeroable` derive macro to also be applied to unions
  rust: pin-init: allow `pub` fields in `derive(Zeroable)`
  rust: pin-init: Update the structural pinning link in readme.
  rust: pin-init: Update Changelog and Readme
  rust: pin-init: Implement `Wrapper` for `UnsafePinned` behind feature flag.
  rust: pin-init: Add the `Wrapper` trait.
  rust: pin-init: add `cast_[pin_]init` functions to change the initialized type
  rust: pin-init: examples: use `allow` instead of `expect`
  rust: pin-init: examples: conditionally enable `feature(lint_reasons)`
  rust: pin-init: internal: skip rustfmt formatting of kernel-only module
  rust: pin-init: synchronize README.md
</content>
</entry>
<entry>
<title>rust: clean Rust 1.88.0's `clippy::uninlined_format_args` lint</title>
<updated>2025-05-06T22:11:47Z</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2025-05-02T14:02:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=211dcf77856db64c73e0c3b9ce0c624ec855daca'/>
<id>urn:sha1:211dcf77856db64c73e0c3b9ce0c624ec855daca</id>
<content type='text'>
Starting with Rust 1.88.0 (expected 2025-06-26) [1], `rustc` may move
back the `uninlined_format_args` to `style` from `pedantic` (it was
there waiting for rust-analyzer suppotr), and thus we will start to see
lints like:

    warning: variables can be used directly in the `format!` string
       --&gt; rust/macros/kunit.rs:105:37
        |
    105 |         let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{}", test);
        |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
    help: change this to
        |
    105 -         let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{}", test);
    105 +         let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{test}");

There is even a case that is a pure removal:

    warning: variables can be used directly in the `format!` string
      --&gt; rust/macros/module.rs:51:13
       |
    51 |             format!("{field}={content}\0", field = field, content = content)
       |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
    help: change this to
       |
    51 -             format!("{field}={content}\0", field = field, content = content)
    51 +             format!("{field}={content}\0")

The lints all seem like nice cleanups, thus just apply them.

We may want to disable `allow-mixed-uninlined-format-args` in the future.

Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
Link: https://github.com/rust-lang/rust-clippy/pull/14160 [1]
Acked-by: Benno Lossin &lt;lossin@kernel.org&gt;
Reviewed-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Link: https://lore.kernel.org/r/20250502140237.1659624-6-ojeda@kernel.org
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<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>
</feed>
