Rust pin-init for v6.18
Benno Lossin
reviewerHi Danilo,
As discussed with Miguel, I'm sending my PR to you this time.
The code changes themselves aren't that big, but functionality-wise there are three important ones: pin-projections, code blocks and access to previously initialized fields. More syntax changes will be on the way for v6.19 and I hope I'll be a bit earlier in that cycle :)
The commits have been in linux-next for one day.
I have a conflict with your devres fix that's in -rc3, the resolution in linux-next looks good.
Please pull for v6.18 -- thanks!
---
Cheers,
Benno
The following changes since commit 8f5ae30d69d7543eee0d70083daf4de8fe15d585:
Linux 6.17-rc1 (2025-08-10 19:41:16 +0300)
are available in the Git repository at:
https://github.com/Rust-for-Linux/linux.git tags/pin-init-v6.18
for you to fetch changes up to 42415d163e5df6db799c7de6262d707e402c2c7e:
rust: pin-init: add references to previously initialized fields (2025-09-11 23:30:02 +0200)
----------------------------------------------------------------
pin-init changes for v6.18
Changed:
- #[pin_data] now generates a *Projection struct similar to the pin-project crate.
- Add initializer code blocks to [try_][pin_]init! macros: make initializer macros accept any number of _: {/* arbitrary code */}, & make them run the code at that point.
- Make the [try_][pin_]init! macros expose initialized fields via a let binding as &mut T or Pin<&mut T> for later fields.
Upstream dev news:
- Released v0.0.10 before the changes included in this tag.
- Inform users of the impending rename from pinned-init to pin-init (in the kernel the rename already happened).
- More CI improvements.
----------------------------------------------------------------
Benno Lossin (6):
rust: pin-init: examples: error: use Error in fn main()
rust: pin-init: README: add information banner on the rename to pin-init
rust: pin-init: rename project -> project_this in doctest
rust: pin-init: add pin projections to #[pin_data]
rust: pin-init: add code blocks to [try_][pin_]init! macros
rust: pin-init: add references to previously initialized fields
rust/kernel/devres.rs | 6 +- rust/kernel/workqueue.rs | 9 +- rust/pin-init/README.md | 12 ++ rust/pin-init/examples/error.rs | 4 +- rust/pin-init/src/lib.rs | 4 +- rust/pin-init/src/macros.rs | 239 ++++++++++++++++++++++++++++++++++------ samples/rust/rust_driver_pci.rs | 2 +- 7 files changed, 227 insertions(+), 49 deletions(-)
Quoted 1 line · Benno Lossin
Please pull for v6.18 -- thanks!
Merged into drm-rust-next, thanks!