Skip to content

Handle recursive TAIT item bounds - #160711

Open
amirHdev wants to merge 2 commits into
rust-lang:mainfrom
amirHdev:fix-next-solver-tait
Open

Handle recursive TAIT item bounds#160711
amirHdev wants to merge 2 commits into
rust-lang:mainfrom
amirHdev:fix-next-solver-tait

Conversation

@amirHdev

@amirHdev amirHdev commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

fixes rust-lang/trait-system-refactor-initiative#288

Avoiding normalizing the exact opaque instance currently being checked while continuing to normalize unrelated aliases and it also adds a small fast path in SolverRelating after resolving inference variables inside non-rigid aliases if both sides are identical we skip creating an unnecessary normalization goal

the next revision of the regression failed with item does not constrain Foo::{opaque#0} while the current solver accepts it

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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 Aug 7, 2026
@amirHdev
amirHdev marked this pull request as ready for review August 8, 2026 06:50
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 8, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 8, 2026
@rustbot

rustbot commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

r? @khyperia

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

@khyperia

Copy link
Copy Markdown
Member

sorry, I'm not quite confident enough with t-types yet to know if this is the right approach or not

r? types

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

oli-obk commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

I don't know enough about the next solver's opaque type handling yet to review this properly. My gut feeling on reading the diff is that the changes are solving the problem in a very brute force way, which may be the required way, but I'd basically need to debug this from scratch to understand it.

Can you explain a bit about how you got to this solution? Just looking at logs and checking where things start going wrong?

The fast path should probably be a separate commit and ideally have some (local is fine) benchmarks showing it's necessary at all

r? @lcnr

@rustbot rustbot assigned lcnr and unassigned oli-obk Aug 14, 2026
@lcnr

lcnr commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

My gut feeling on reading the diff is that the changes are solving the problem in a very brute force way, which may be the required way, but I'd basically need to debug this from scratch to understand it.

Can you explain a bit about how you got to this solution? Just looking at logs and checking where things start going wrong?

yeah, I am very worried about adding special cases or different paths to the behavior of the trait solver without a clear reason for why it is necessary and correct. I don't think this issue is particularly important to fix right now as to my knowledge it does not block stabilization and does not cause breakage to stable code in the wild here.

You could look into why exactly your PR changes things. I would expect this to be a larger underlying issue related to cyclic reasoning and maybe it should actually not be a productive cycle

Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
@amirHdev
amirHdev force-pushed the fix-next-solver-tait branch from 38da246 to e05f08f Compare August 17, 2026 08:15
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.

feature(type_alias_impl_trait): error: item does not constrain Foo::{opaque#0}

5 participants