diff options
| author | Mohamad Alsadhan <mo@sdhn.cc> | 2026-04-28 14:10:54 +0100 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2026-05-10 22:58:34 +0100 |
| commit | 5edf8ac281ad04433c606917a1a9e88bf8fa10d8 (patch) | |
| tree | ab81dc020db5f9f42986bd7ccfca08335f29c6ab /rust/pin-init | |
| parent | de54c2cb052952df2a6f91617471d1f02f213d4e (diff) | |
rust: pin-init: internal: add missing where clause to projection types
`#[pin_data]` failed to propagate the struct's `where` clause to the
generated projection struct. As a result, bounds written in a `where`
clause could be dropped during expansion, causing type errors when
fields depended on those bounds.
Fix this by adding the missing `where` clause to the generated
projection struct.
Reported-by: Andreas Hindborg <a.hindborg@kernel.org>
Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/561532-pin-init/topic/generic.20bounds.20and.20.60.23.5Bpin_data.5D.60/with/578381591
Signed-off-by: Mohamad Alsadhan <mo@sdhn.cc>
Reviewed-by: Gary Guo <gary@garyguo.net>
[ Reworded commit message - Gary ]
Link: https://patch.msgid.link/20260428-pin-init-sync-v1-5-07f9bd3859fb@garyguo.net
Signed-off-by: Gary Guo <gary@garyguo.net>
Diffstat (limited to 'rust/pin-init')
| -rw-r--r-- | rust/pin-init/internal/src/pin_data.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rust/pin-init/internal/src/pin_data.rs b/rust/pin-init/internal/src/pin_data.rs index 7d871236b49c..6b1b8f26379a 100644 --- a/rust/pin-init/internal/src/pin_data.rs +++ b/rust/pin-init/internal/src/pin_data.rs @@ -304,7 +304,9 @@ fn generate_projections( #[doc = #docs] #[allow(dead_code)] #[doc(hidden)] - #vis struct #projection #generics_with_pin_lt { + #vis struct #projection #generics_with_pin_lt + #whr + { #(#fields_decl)* ___pin_phantom_data: ::core::marker::PhantomData<&'__pin mut ()>, } |
