Skip to content

internal: add missing where clause to projection types#121

Open
mqqz wants to merge 1 commit intoRust-for-Linux:mainfrom
mqqz:where-fix
Open

internal: add missing where clause to projection types#121
mqqz wants to merge 1 commit intoRust-for-Linux:mainfrom
mqqz:where-fix

Conversation

@mqqz
Copy link

@mqqz mqqz commented Mar 12, 2026

#[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.

Add a regression test covering #[pin_data] with where-clause bounds.

Bless expand tests (only many_generics.rs) that became outdated.

Link: https://rust-for-linux.zulipchat.com/#narrow/channel/561532-pin-init/topic/generic.20bounds.20and.20.60.23.5Bpin_data.5D.60/with/578381591
Reported-by: Andreas Hindborg a.hindborg@kernel.org

`#[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.

Add a regression test covering `#[pin_data]` with `where`-clause
bounds.

Bless expand tests (only `many_generics.rs`) that became outdated.

Link: https://rust-for-linux.zulipchat.com/#narrow/channel/561532-pin-init/topic/generic.20bounds.20and.20.60.23.5Bpin_data.5D.60/with/578381591
Reported-by: Andreas Hindborg <a.hindborg@kernel.org>
Signed-off-by: Mohamad Alsadhan <mo@sdhn.cc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant