Skip to content

Introduce SolverRelating type relation to the new solver code - #128744

Closed
compiler-errors wants to merge 3 commits into
rust-lang:masterfrom
compiler-errors:solver-relating
Closed

Introduce SolverRelating type relation to the new solver code#128744
compiler-errors wants to merge 3 commits into
rust-lang:masterfrom
compiler-errors:solver-relating

Conversation

@compiler-errors

Copy link
Copy Markdown
Contributor

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.

@rustbotrustbot 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
Copy Markdown
Collaborator

changes to the core type system

cc @compiler-errors, @lcnr

@rust-log-analyzer

This comment has been minimized.

@lcnr

lcnr commented Aug 7, 2024

Copy link
Copy Markdown
Contributor

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

Comment threadcompiler/rustc_infer/src/infer/context.rs
@lcnr

lcnr commented Aug 14, 2024

Copy link
Copy Markdown
Contributor

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

lcnr commented Aug 14, 2024

Copy link
Copy Markdown
Contributor

@rustbot author

@rustbotrustbot 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

bors commented Aug 22, 2024

Copy link
Copy Markdown
Collaborator

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

@alex-semenyukalex-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
Copy Markdown
ContributorAuthor

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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-authorStatus: This is awaiting some action (such as code changes or more information) from the author.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@compiler-errors@rustbot@rust-log-analyzer@lcnr@bors@alex-semenyuk