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
nbdd0121 added a commit to nbdd0121/linux that referenced this pull request Apr 27, 2026
This series collects all upstream developments of pin-init to date and
synchronize them to the kernel tree.

A major change in this cycle is the bump of MSRV to 1.82 to get rid of
unstable features, following the kernel version bump in 7.1. The MSRV is
bumped straight to 1.85 as pin-init can also be used outside kernel, so we
avoid bumping unless there is a need for new version.

Here are the list of merged changes included in the series:

- examples: mark as `#[inline]` all `From::from()`s for `Error`
  Rust-for-Linux/pin-init#126
- bump minimum Rust version to 1.82
  Rust-for-Linux/pin-init#129
- cleanup `Zeroable` and `ZeroableOptions`
  Rust-for-Linux/pin-init#118
- internal: add missing where clause to projection types
  Rust-for-Linux/pin-init#121
- internal: internal: remove redundant `#[pin]` filtering
  Rust-for-Linux/pin-init#131

For information, here are the list of upstream-only changes, which are
related to Cargo or tests/CI changes only.

- build.rs: use `option_env!` to register env variable dependency
  Rust-for-Linux/pin-init#128
- clean up dependencies
  Rust-for-Linux/pin-init#130
- tests: add test for check correct macro hygiene 
  Rust-for-Linux/pin-init#133
- ci: use tagged release of actions
  Rust-for-Linux/pin-init#134
- ci: have a single job to gate all required jobs
  Rust-for-Linux/pin-init#138

Best,
Gary

--- b4-submit-tracking ---
# This section is used internally by b4 prep for tracking purposes.
{
  "series": {
    "revision": 1,
    "change-id": "20260414-pin-init-sync-ae407945a726",
    "prefixes": [],
    "presubject": ""
  }
}
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