Skip to content

Commit c4bb3d8

Browse files
lcnrlqd
andauthored
next-solver 2025h2 (#318)
* next-solver 2025h2 * rarw * this goal is not accepted yet Co-authored-by: Rémy Rakic <[email protected]> --------- Co-authored-by: Rémy Rakic <[email protected]>
1 parent 11d5629 commit c4bb3d8

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

src/2025h2/next-solver.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Next-generation trait solver
2+
3+
| Metadata | |
4+
|:-----------------|-------------------------------------------|
5+
| Point of contact | @lcnr |
6+
| Teams | <!-- TEAMS WITH ASKS --> |
7+
| Task owners | <!-- TASK OWNERS --> |
8+
| Status | Proposed |
9+
| Tracking issue | [rust-lang/rust-project-goals#113] |
10+
| Zulip channel | [#t-types/trait-system-refactor][channel] |
11+
12+
[channel]: https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor
13+
14+
15+
## Summary
16+
17+
Continue work towards the stabilization of `-Znext-solver=globally`, collecting and resolving remaining blockers. Extend its use in lints and rustdoc.
18+
19+
## Motivation
20+
21+
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. It's tracking issue is [#107374](https://github.com/rust-lang/rust/issues/107374).
22+
23+
### The status quo
24+
25+
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.
26+
27+
Fixing these issues in the existing implementation is prohibitively difficult as the required changes are interconnected and require major changes to the underlying structure of the trait solver. The Types Team therefore decided to rewrite the trait solver in-tree, and has been working on it since EOY 2022.
28+
29+
### The next six months
30+
31+
- finish and merge in-flight opaque types changes: [#139587](https://github.com/rust-lang/rust/pull/139587) and [#140497](https://github.com/rust-lang/rust/pull/140497)
32+
- decide and document inference guidance for unconstrained opaques in the defining scope
33+
- continue work on performance
34+
- fix last known exponential slowdown when reevaluating goals due to changed provisional results
35+
- get all benchmarks to be neutral or improvements
36+
- fix remaining minor issues from user reports, crater, and our test suite
37+
- move additional lints and rustdoc to use the new solver by default
38+
- document the new solver and work on the stabilization report
39+
- publicly ask for testing of `-Znext-solver=globally`
40+
41+
### The "shiny future" we are working towards
42+
43+
- we are able to remove the existing trait solver implementation and significantly cleanup the type system in general, e.g. removing most `normalize` in the caller by handling unnormalized types in the trait system
44+
- all remaining type system unsoundnesses are fixed
45+
- many future type system improvements are unblocked and get implemented
46+
- the type system is more performant, resulting in better compile times
47+
48+
## Design axioms
49+
50+
In order of importance, the next-generation trait solver should be:
51+
- sound: the new trait solver is sound and its design enables us to fix all known type system unsoundnesses
52+
- backwards-compatible: the breakage caused by the switch to the new solver should be minimal
53+
- maintainable: the implementation is maintainable, extensible, and approachable to new contributors
54+
- performant: the implementation is efficient, improving compile-times
55+
56+
[da]: ../about/design_axioms.md
57+
58+
## Ownership and team asks
59+
60+
**Owner:** @lcnr
61+
62+
Add'l implementation work: @compiler-errors
63+
64+
| Task | Owner(s) or team(s) | Notes |
65+
|------------------------------|-------------------------|----------------------------|
66+
| Discussion and moral support | ![Team][] [types] | |
67+
| Implementation | @lcnr, @compiler-errors, @BoxyUwU | |
68+
| Standard reviews | ![Team][] [types] | |
69+
| FCP decision(s) | ![Team][] [types][] | for necessary refactorings |
70+
71+
### Support needed from the project
72+
73+
* [Types] team
74+
* review design decisions
75+
* provide technical feedback and suggestion
76+
77+
## Outputs and milestones
78+
79+
See next few steps :3 while we don't expect to fully stabilize the new solver this year, we expect to get quite close.
80+
81+
## Frequently asked questions
82+
83+
### What do I do with this space?
84+
85+
*This is a good place to elaborate on your reasoning above -- for example, why did you put the design axioms in the order that you did? It's also a good place to put the answers to any questions that come up during discussion. The expectation is that this FAQ section will grow as the goal is discussed and eventually should contain a complete summary of the points raised along the way.*
86+
87+
[unsoundnesses]: https://github.com/orgs/rust-lang/projects/44

0 commit comments

Comments
 (0)