Skip to content

Introduce SolverRelating type relation to the new solver code #128744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

compiler-errors
Copy link
Member

This "uplifts" (i.e. duplicates) the TypeRelating delegate into the new solver as a new relation called SolverRelating, so we can use that rather than exposing InferCtxtLike::relate for implementations to have to implement themselves.

The reason I duplicated rather than fully uplifted TypeRelating is because it's so complicated.

  • CombineFields is a bunch of unnecessary machinery that only exists to track a Trace and to make it easy to swap between Lub/Glb.
  • There are a bunch of next_trait_solver branches in in the super_combine_{const,ty} functions, and in the TypeRelating code itself that can be folded away.

This then allows us to remove StructurallyRelateAliases from PredicateEmittingRelation and move it directly onto the generalizer instantiate_*_var functions.

r? @lcnr -- I'm curious what you think of this approach in general.

@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 Aug 6, 2024
@rustbot
Copy link
Collaborator

rustbot commented Aug 6, 2024

changes to the core type system

cc @compiler-errors, @lcnr

@rust-log-analyzer

This comment has been minimized.

@lcnr
Copy link
Contributor

lcnr commented Aug 7, 2024

generally in favor of splitting TypeRelating between old and new solver, have a bunch of vibes about how to do that though, probably useful to chat about them in sync though

@lcnr
Copy link
Contributor

lcnr commented Aug 14, 2024

we discussed that we'll have to add InferCtxtLike::next_trait_solver anyways to uplift the generalizer, at which point I strongly preferred to uplift super_combine instead of duplicating the type relations.

@lcnr
Copy link
Contributor

lcnr commented Aug 14, 2024

@rustbot author

@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 Aug 14, 2024
@bors
Copy link
Collaborator

bors commented Aug 22, 2024

☔ The latest upstream changes (presumably #129365) made this pull request unmergeable. Please resolve the merge conflicts.

@alex-semenyuk alex-semenyuk 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 28, 2024
@compiler-errors
Copy link
Member Author

I'll need to totally rework this, so closing for now and putting it back onto my TODO list for a fresh PR, which will be soon hopefully.

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 10, 2024
Introduce SolverRelating type relation to the new solver

Redux of rust-lang#128744.

Splits out relate for the new solver so that implementors don't need to implement it themselves.

r? lcnr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants