Skip to content
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

Next-generation trait solver #113

Open
10 of 13 tasks
nikomatsakis opened this issue Jul 22, 2024 · 5 comments
Open
10 of 13 tasks

Next-generation trait solver #113

nikomatsakis opened this issue Jul 22, 2024 · 5 comments

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jul 22, 2024

Metadata
Owner(s) @lcnr
Team(s) rust-analyzer, types
Goal document 2024h2/next-solver

Summary

In the next 6 months we plan to extend the next-generation trait solver as follows:

  • stabilize the use of the next-generation trait solver in coherence checking
  • use the new implementation in rustdoc and lints where applicable
  • share the solver with rust-analyser
  • successfully bootstrap the compiler when exclusively using the new implementation and run crater

Tasks and status

  • Discussion and moral support (types Team)
  • Stabilize next-generation solver in coherence
    • Prototype implementation (@lcnr, @compiler-errors)
    • Standard reviews (types Team)
    • Resolve hang with complex auto-trait cycles
    • Stabilization PR merged (types Team)
    • Address performance impacton nalgebra
    • Stabilization decision (types Team)
  • Support next-generation solver in rust-analyzer
@nikomatsakis nikomatsakis added this to the 2024h2 milestone Jul 22, 2024
@rust-lang rust-lang locked and limited conversation to collaborators Jul 25, 2024
@nikomatsakis
Copy link
Contributor Author

This issue is intended for status updates only.

For general questions or comments, please contact the owner(s) directly.

@lcnr
Copy link
Contributor

lcnr commented Aug 1, 2024

I am currently working on caching in the trait solver. The current implementation results in hangs when encountering complex auto-trait cycles. See https://rust-lang.zulipchat.com/#narrow/stream/364551-t-types.2Ftrait-system-refactor/topic/Fuchsia.20hanging.20on.20.60-Znext-solver.3Dcoherence.60 for the progress here. We now have an approach which fixes the performance regression. It'll still take at least multiple weeks until it's ready for merge however.

The librarification of the trait solver is in a very good state thanks to a lot of work by @compiler-errors. We're currently discussing its use in r-a on zulip: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/New.20Trait.20Solver. While there are still components we intend to move from rustc into the shared library to enable their reuse, all major ones have already been moved by now.

@lcnr
Copy link
Contributor

lcnr commented Sep 2, 2024

Since the last update, we've landed the new caching optimization in rust-lang/rust#128828 and hope to land the -Znext-solver=coherence stabilization PR this week.

There has been one other bug fix in the last month, see https://github.com/rust-lang/rust/pulls?q=is%3Apr+is%3Amerged+label%3AWG-trait-system-refactor+-label%3Arollup+closed%3A%3C2024-09-02+-closed%3A%3C2024-08-01 for the full list of PRs.

@lcnr
Copy link
Contributor

lcnr commented Oct 8, 2024

We've tried to stabilize -Znext-solver=coherence in rust-lang/rust#121848 which we had to revert later (rust-lang/rust#130249) as it caused a hang in nalgebra.

We mostly fixed this hang with rust-lang/rust#130617 and rust-lang/rust#130821. As nalgebra still ends up hitting the recursion limit with a quite wide search graph, the performance impact of enabling -Znext-solver=coherence is quite bad rust-lang/rust#130654 (comment).

There haven't been any other significant changes to the new solver during the last month.

@lcnr
Copy link
Contributor

lcnr commented Nov 19, 2024

We stabilized -Znext-solver=coherence again in rust-lang/rust#130654. It's looking like the stabilization will actually go through this time.

We're currently refactoring the way the current "typing mode" is tracked, cc rust-lang/types-team#128. This is necessary to fix rust-lang/trait-system-refactor-initiative#106. I also started an FCP to clean up the way we merge candidates when proving trait goals: rust-lang/rust#132325. I intend to pretty much exactly match this behavior in the new solver as well, so I expect all of our issues there to be resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants