Skip to content

internal: add missing where clause to projection types#121

Merged
nbdd0121 merged 1 commit intoRust-for-Linux:mainfrom
mqqz:where-fix
Apr 23, 2026
Merged

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

Conversation

@mqqz
Copy link
Copy Markdown
Contributor

@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

@mqqz mqqz force-pushed the where-fix branch 2 times, most recently from cc86c47 to 8b0f7c0 Compare March 12, 2026 09:51
nbdd0121
nbdd0121 previously approved these changes Apr 23, 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.

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>
[ Trimmed commit message, removed feature gates in tests no longer
  necessary after MSRV bump. - Gary ]
Signed-off-by: Gary Guo <gary@garyguo.net>
@nbdd0121 nbdd0121 merged commit 7b0dd96 into Rust-for-Linux:main Apr 23, 2026
26 checks passed
@mqqz mqqz deleted the where-fix branch April 24, 2026 05:42
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.

2 participants