Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Stabilize the next-generation trait solver

Metadata
Point of contactlcnr
StatusProposed
FlagshipUnblocking dormant traits
Tracking issuerust-lang/rust-project-goals#113
Other tracking issuesrust-lang/rust#107374
Zulip channel#t-types/trait-system-refactor
Stabilizationtrue
types championlcnr
lang championNiko Matsakis
Teamslang, types
Task owners(none)

Summary

Stabilize -Znext-solver=globally, replacing the existing trait solver implementation entirely.

Motivation

The next-generation trait solver is intended to fully replace the existing type system components responsible for proving trait bounds, normalizing associated types, and much more. This should fix many long-standing (soundness) bugs, enable future type system improvements, and improve compile-times.

The status quo

There are multiple type system unsoundnesses blocked on the next-generation trait solver: [project board][unsoundnesses]. Desirable features such as coinductive trait semantics and perfect derive, where-bounds on binders, and better handling of higher-ranked bounds and types are also stalled due to shortcomings of the existing implementation.

Since starting to work on this at the EOY 2022, we’ve:

  • stabilized its use in coherence checking in Rust 1.84
  • replaced the use of chalk in rust-analyzer
  • done full crater runs and all large regressions are either fixed or intended
  • improved performance and diagnostics, even if they is still more work to do

What we propose to do about it

Stabilize -Znext-solver=globally and rip out the old implementation

  • finish triaging the crater and and resolve remaining issues tracked in the project board
  • achieve performance parity with the old solver
  • write an RFC for the cycle semantics used by the new trait solver
  • document the behavior of the new trait solver and write stabilization reports

Work items over the next year

TaskOwner(s)Notes
figure out and resolve remaining blockerslcnr
achieve performance paritylcnr
cycle semantics RFClcnr, Niko Matsakis
complete stabilization reportlcnr
stabilizationlcnr
remove old implementationlcnr

Team asks

TeamSupport levelNotes
langMediumStabilization decision for user facing changes
typesLargeStabilization decision, ongoing review work

Frequently asked questions

What do I do with this space?