Skip to content

Fix large_futures ICE with the next solver - #17601

Merged
flip1995 merged 1 commit into
rust-lang:masterfrom
tamird:fix-large-futures-next-solver
Aug 23, 2026
Merged

Fix large_futures ICE with the next solver#17601
flip1995 merged 1 commit into
rust-lang:masterfrom
tamird:fix-large-futures-next-solver

Conversation

@tamird

@tamird tamird commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

With the new trait solver enabled by default in nightly-2026-08-22 1, large_futures can ICE while inspecting an awaited future.

The lint switches to Codegen mode to obtain coroutine layouts but passes a type whose opaque aliases are still marked rigid from type checking. Because layout_of receives an already-Codegen environment, its environment-change path does not clear those markers.

Clear alias rigidity and normalize the awaited type in that environment before querying its layout. Codegen mode must remain: post-analysis layout queries cannot compute coroutine sizes 2.

The regression covers direct and pinned futures under both solvers, without other lint errors that could hide a delayed ICE.

Fixes rust-lang/rust#161495.

changelog: [large_futures]: Fix an ICE on awaited futures with the next trait solver.

With the new trait solver enabled by default in nightly-2026-08-22 [1],
large_futures can ICE while inspecting an awaited future.

The lint switches to Codegen mode to obtain coroutine layouts but passes
a type whose opaque aliases are still marked rigid from type checking.
Because layout_of receives an already-Codegen environment, its
environment-change path does not clear those markers.

Clear alias rigidity and normalize the awaited type in that environment
before querying its layout. Codegen mode must remain: post-analysis
layout queries cannot compute coroutine sizes [2].

The regression covers direct and pinned futures under both solvers,
without other lint errors that could hide a delayed ICE.

Fixes rust-lang/rust#161495.

[1]: rust-lang/rust#160619
[2]: rust-lang/rust#145477
@rustbot rustbot added the S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. label Aug 22, 2026
@rustbot

rustbot commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request. A reviewer will take a look after it receives 2 community reviews.

In the meantime, we would highly appreciate if you could try to review any of PRs waiting on community reviews.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 22, 2026
@rustbot

rustbot commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@tamird

tamird commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

r? @jdonszelmann

@rustbot

rustbot commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Error: Failed to set assignee to jdonszelmann: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

community review:
not entirely sure I follow why ty::set_aliases_to_non_rigid (that would require a bit of deeper context that @jdonszelmann is likely better to judge 😅), but explanation and testcase sounds plausible to me.

View changes since this review

@tamird

tamird commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

@CommanderStorm

not entirely sure I follow why ty::set_aliases_to_non_rigid

The rigidity marker is specific to the environment where the alias was normalized. We switch to Codegen, so those aliases need to be reconsidered in the new environment. The original design review explicitly requested resetting rigidity alongside the environment change.

layout_of already does this when it changes environments itself, but here it receives an already-Codegen environment, so that reset is skipped. The patch uses the same reset-then-normalize pattern as rustc's MIR mode-transition pass.

@CommanderStorm

Copy link
Copy Markdown
Contributor

Ah, makes sense.

@jdonszelmann

jdonszelmann commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

This seems correct to me. Only thing I'm afraid of is that more of clippy may be using the wrong typing mode w.r.t. the new trait solver. Lemme do a quick investigation. Otherwise if I were a clippy maintainer

bors-r-plus

@jdonszelmann

Copy link
Copy Markdown
Contributor

is_uninit_value_valid_for_ty_fallback should probably also use codegen (it calls into layout_of right after), that's the only other example I could find

@tamird

tamird commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

@jdonszelmann

is_uninit_value_valid_for_ty_fallback should probably also use codegen

I checked that path: its local PostAnalysis environment is used only to normalize field types. Recursive checks return to cx.layout_of with the original LateContext environment, so layout_of still performs its own mode transition and rigidity reset. Changing the fallback's local environment to Codegen alone wouldn't change those layout queries' mode.

The existing uninit_assumed_init and uninit_vec fixtures also complete under both solvers with matching warnings, kept nonfatal so delayed ICEs remain visible. I haven't found a reason to change that helper in this PR.

CI is green. If you're happy with the current patch, could you submit an approving GitHub review? CommanderStorm has approved; Clippy needs two community approvals before assigning a maintainer.

@jdonszelmann jdonszelmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved officially, after my previous comment :)

View changes since this review

@rustbot rustbot removed the S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. label Aug 22, 2026
@rustbot

rustbot commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

r? @dswij

rustbot has assigned @dswij for the project review.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 9 candidates
  • 9 candidates expanded to 9 candidates
  • Random selection from Jarcho, Manishearth, blyxyas, dswij, llogiq

@flip1995

Copy link
Copy Markdown
Member

r? @flip1995

Testing this commit in #17607 as well. But LGTM. Once lintcheck passes there I'll merge this and sync it to the Rust repo.

@rustbot rustbot assigned flip1995 and unassigned dswij Aug 23, 2026

@flip1995 flip1995 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for the quick fix 🙏

View changes since this review

@flip1995
flip1995 added this pull request to the merge queue Aug 23, 2026
Merged via the queue into rust-lang:master with commit c58c138 Aug 23, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 23, 2026
@tamird
tamird deleted the fix-large-futures-next-solver branch August 23, 2026 17:13
zheylmun pushed a commit to luminartech/simple_someip that referenced this pull request Aug 24, 2026
Every nightly from 2026-08-22 onward ICEs on this job with `unexpected rigid
alias in layout_of after normalization`, on the opaque returned by
`bare_metal_tasks::run_someip`. `main` has been red since 08-22 with no code
change.

The trigger is `clippy::pedantic` enabling `large_futures`, which switches to
Codegen mode to read a coroutine layout while the opaque aliases are still
marked rigid from type checking. Confirmed as a toolchain bug, not ours: plain
`cargo check` on the same nightly is clean, only `cargo clippy` fails, and it
reproduces on unmodified `main`. Bisected to the nightly-2026-08-21 →
nightly-2026-08-22 window.

rust-lang/rust-clippy#17601 fixed it on 2026-08-23, but the fix has to ride a
clippy subtree sync into rustc before any nightly carries it, so the lane
stays red until then.

Pinning to the last known-good nightly rather than allowing the lint keeps
`large_futures` running — it is worth more here than anywhere else in the tree,
since a fat future on the bare-metal runtime is a static pool sized to hold it.
All four steps of the job pass on the pinned toolchain.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE] Unexpected rigid alias in layout_of after normalization

6 participants