[PATCH 0/4] rust: pin-init: support tuple structs

Gary Guo posted 4 patches 3 weeks, 1 day ago
rust/pin-init/internal/src/init.rs     | 494 ++++++++++++++++++++++++++++-----
rust/pin-init/internal/src/lib.rs      |  12 +-
rust/pin-init/internal/src/pin_data.rs | 129 ++++++---
rust/pin-init/internal/src/util.rs     |  54 ++++
rust/pin-init/src/lib.rs               |  71 ++++-
5 files changed, 638 insertions(+), 122 deletions(-)
[PATCH 0/4] rust: pin-init: support tuple structs
Posted by Gary Guo 3 weeks, 1 day ago
This is a long requested feature to support tuple structs. There are a few
cases that structs have to be converted to become normal structs so
pin-init can be used.

This series add tuple struct support as you'd expect to work. A caveat is
that pinned initialization syntax (`<-`) only works with struct expression
initializers. So

    #[pin_data]
    struct Foo<T>(#[pin] T, usize)

would need

    pin_init!(Foo {
        0 <- expr,
        1: 0
    })

This is to avoid introducing new syntax.

The upstream pull request for this series is
https://github.com/Rust-for-Linux/pin-init/pull/155

Signed-off-by: Gary Guo <gary@garyguo.net>
---
Gary Guo (1):
      rust: pin-init: internal: extract utility code to new module

Mohamad Alsadhan (3):
      rust: pin-init: internal: pin_data: support tuple struct projections
      rust: pin-init: internal: init: support tuple structs in `[pin_]init!`
      rust: pin-init: internal: init: support tuple struct constructor syntax

 rust/pin-init/internal/src/init.rs     | 494 ++++++++++++++++++++++++++++-----
 rust/pin-init/internal/src/lib.rs      |  12 +-
 rust/pin-init/internal/src/pin_data.rs | 129 ++++++---
 rust/pin-init/internal/src/util.rs     |  54 ++++
 rust/pin-init/src/lib.rs               |  71 ++++-
 5 files changed, 638 insertions(+), 122 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260904-tuple-struct-5b5b6e6a75f9

Best regards,
--  
Gary Guo <gary@garyguo.net>
Re: [PATCH 0/4] rust: pin-init: support tuple structs
Posted by Gary Guo 1 week, 5 days ago
On Fri Sep 4, 2026 at 3:12 PM BST, Gary Guo wrote:
> This is a long requested feature to support tuple structs. There are a few
> cases that structs have to be converted to become normal structs so
> pin-init can be used.
>
> This series add tuple struct support as you'd expect to work. A caveat is
> that pinned initialization syntax (`<-`) only works with struct expression
> initializers. So
>
>     #[pin_data]
>     struct Foo<T>(#[pin] T, usize)
>
> would need
>
>     pin_init!(Foo {
>         0 <- expr,
>         1: 0
>     })
>
> This is to avoid introducing new syntax.
>
> The upstream pull request for this series is
> https://github.com/Rust-for-Linux/pin-init/pull/155
>
> Signed-off-by: Gary Guo <gary@garyguo.net>
> ---
> Gary Guo (1):
>       rust: pin-init: internal: extract utility code to new module
>
> Mohamad Alsadhan (3):
>       rust: pin-init: internal: pin_data: support tuple struct projections
>       rust: pin-init: internal: init: support tuple structs in `[pin_]init!`
>       rust: pin-init: internal: init: support tuple struct constructor syntax

Applied to pin-init-next.

Best,
Gary

>
>  rust/pin-init/internal/src/init.rs     | 494 ++++++++++++++++++++++++++++-----
>  rust/pin-init/internal/src/lib.rs      |  12 +-
>  rust/pin-init/internal/src/pin_data.rs | 129 ++++++---
>  rust/pin-init/internal/src/util.rs     |  54 ++++
>  rust/pin-init/src/lib.rs               |  71 ++++-
>  5 files changed, 638 insertions(+), 122 deletions(-)
> ---
> base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
> change-id: 20260904-tuple-struct-5b5b6e6a75f9
>
> Best regards,
> --  
> Gary Guo <gary@garyguo.net>