Skip to content

trait solver: Track canonical response universe assumptions - #159987

Open
Dnreikronos wants to merge 2 commits into
rust-lang:mainfrom
Dnreikronos:trait_solver/canonical_response_assumptions
Open

trait solver: Track canonical response universe assumptions#159987
Dnreikronos wants to merge 2 commits into
rust-lang:mainfrom
Dnreikronos:trait_solver/canonical_response_assumptions

Conversation

@Dnreikronos

@Dnreikronos Dnreikronos commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #159889

Canonical responses recreate universes for placeholders created while evaluating a query. Region constraints are handled inside the query, but opaque type constraints can still carry those placeholders back to the caller. Without an assumptions entry, eager placeholder handling hits the unwrap() in get_placeholder_assumptions.

Record empty assumptions when recreating response universes under -Zassumptions-on-binders. idk if empty assumptions is the final shape irl, but imo keeping this next to create_next_universe is the right local fix. It restores the invariant where the universe enters the caller and matches bookkeeping from other binder entry paths. fyi the issue repro now reports E0277 instead of ICEing.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jul 27, 2026
@rustbot

rustbot commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

r? @nnethercote

rustbot has assigned @nnethercote.
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: compiler
  • compiler expanded to 74 candidates
  • Random selection from 16 candidates

@rustbot

This comment has been minimized.

@Dnreikronos
Dnreikronos force-pushed the trait_solver/canonical_response_assumptions branch from 8402992 to 53bab87 Compare July 27, 2026 01:53
@rust-log-analyzer

This comment has been minimized.

@Dnreikronos
Dnreikronos marked this pull request as draft July 27, 2026 02:00
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 27, 2026
Canonical responses can return query-created placeholders through opaque type constraints. Record empty assumptions when recreating those universes in the caller so eager placeholder handling does not ICE.
@Dnreikronos
Dnreikronos force-pushed the trait_solver/canonical_response_assumptions branch from 53bab87 to 698320c Compare July 27, 2026 02:01
@Dnreikronos
Dnreikronos marked this pull request as ready for review July 27, 2026 11:56
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 27, 2026
@nnethercote

Copy link
Copy Markdown
Contributor

r? types

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Jul 28, 2026
@rustbot rustbot assigned oli-obk and unassigned nnethercote Jul 28, 2026
@oli-obk

oli-obk commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

r? @lcnr

@rustbot rustbot assigned lcnr and unassigned oli-obk Jul 28, 2026
@lcnr

lcnr commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

r? BoxyUwU

@rustbot rustbot assigned BoxyUwU and unassigned lcnr Jul 29, 2026
@rustbot

rustbot commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

BoxyUwU is currently at their maximum review capacity.
They may take a while to respond.

@lcnr

lcnr commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Handling opaques here is interesting :/ I guess this might be fine as a temporary hack, I've been chatting about this with Boxy before and rust-lang/trait-system-refactor-initiative#271 partially removes the need for this, but to fully remove it will take a while probably

@lcnr

lcnr commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

we should at least have a FIXME here I think

@Dnreikronos

Copy link
Copy Markdown
Contributor Author

Added the FIXME, fyi. imo this workaround is a bit gross, but I think the damage is fairly limited here because the query already handles the region constraints. The annoying bit is that opaque type constraints can still carry query-created placeholders back out through the canonical response, so the recreated universes still need an assumptions entry.

idk if trying to compute more precise assumptions here is worth doing asap. The irl fix seems closer to the opaque storage work in rust-lang/trait-system-refactor-initiative#271, so I left this as an empty-assumptions temporary hack for now. btw ltm if you want the FIXME to point at that issue directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: assumptions on binders: None context.rs

7 participants