Skip to content

trait_solver: normalize next-gen region constraints#158404

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

trait_solver: normalize next-gen region constraints#158404
Dnreikronos wants to merge 2 commits into
rust-lang:mainfrom
Dnreikronos:trait_solver/canonicalize_next_gen_regions

Conversation

@Dnreikronos

@Dnreikronos Dnreikronos commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

fixes #157729

-zassumptions-on-binders can produce next-gen region constraints that mean the same thing but don't have the same shape. in this case object candidate merging stayed ambiguous and instance resolution later hit the ice. imo normalizing the constraint at the response boundary is the least weird place for this, because candidate selection shouldn't need to know which vtable looks nicer.

canonicalize and evaluate the next-gen region constraint before response canonicalization, then cover the dyn derived

supertrait case from the issue. lgtm locally with the focused test, tests/ui/traits/next-solver, and tests/ui/assumptions_on_binders. idk if there's a better home for the helper call, but ltm this keeps the fix pretty narrow.

@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 Jun 25, 2026
@rustbot

rustbot commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

r? @camelid

rustbot has assigned @camelid.
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 73 candidates
  • Random selection from 19 candidates

@rustbot

This comment has been minimized.

Canonicalize and evaluate next-gen region constraints before query response canonicalization so equivalent constraints merge structurally.
@Dnreikronos Dnreikronos force-pushed the trait_solver/canonicalize_next_gen_regions branch from 0ea1284 to 9c1ee51 Compare June 25, 2026 15:15
Cover the dyn object supertrait case that used to leave equivalent next-gen region constraints in different shapes.
@Dnreikronos Dnreikronos force-pushed the trait_solver/canonicalize_next_gen_regions branch 2 times, most recently from 7588b8f to 12ae52a Compare June 27, 2026 01:45
@camelid

camelid commented Jul 1, 2026

Copy link
Copy Markdown
Member

I don't have familiarity with this code, so rerolling. @rustbot reroll

@rustbot rustbot assigned mati865 and unassigned camelid Jul 1, 2026
@mati865

mati865 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Me neither, @rustbot reroll

@rustbot rustbot assigned hanna-kruppe and unassigned mati865 Jul 2, 2026
@hanna-kruppe

Copy link
Copy Markdown
Contributor

Me three. Let's try something more targeted: r? types

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Jul 2, 2026
@rustbot rustbot assigned lcnr and unassigned hanna-kruppe Jul 2, 2026
@lcnr

lcnr commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

r? BoxyUwU

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

rustbot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

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

@lcnr lcnr added the -Zassumptions-on-binders Unstable option: `-Zassumptions-on-binders label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

-Zassumptions-on-binders Unstable option: `-Zassumptions-on-binders 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: failed to resolve instance for <dyn Derived<()> as Derived<()>>::is_derived

7 participants