#160895·Rust

Next-generation trait solver enabled on nightly

Author: lcnrCreated Aug 11, 2026Updated Sep 17, 2026
LabelsC-tracking-issueT-typesWG-trait-system-refactor

The next-generation trait solver is currently enabled on nightly by default. See the corresponding blog post for more details. This is the largest single change to the Rust compiler since its initial stable release. It completely replaces the existing type system components responsible for proving where-clauses, normalizing associated types, and much more.

It is an internal component of rustc and the main benefits will come in the future as the removal of the old implementation will unblock features such a Type Alias Impl Trait and Return Type Notation, adding new implicit default trait bounds, e.g. Move and Forget, large future compile-time performance improvements and will enable us to fix the remaining type system unsoundnesses. Even so, there are already a lot of intended behavior changes. When developing on nightly, you may rely on subtle type inference or method and trait resolution changes which cause your project to not compile on the previous stable version.

This issue collects intended changes and their impact, both intended and any remaining bugs and issues. If you are affected by this change, please tell us about it. Either here, in a separate GitHub issue, or on zulip.


This is only being enabled on nightly. To disable the next-generation trait solver, you can pass -Znext-solver=coherence to rustc, use RUSTFLAGS=-Znext-solver=coherence, or change your project's .cargo/config.toml configuration file:

[build]
rustflags = ["-Znext-solver=coherence"]

We want to not only know about what changes due to the new implementation, but also how widespread its impact is. Please tell us if you're working on a project which is not on this list, even if the underlying issue is already known.

Known impact and breakage

Avoiding incorrect type inference when relating higher-ranked associated types

When relating higher-ranked types containing associated types, the old implementation sometimes incorrectly guided inference. See https://github.com/mitsuhiko/minijinja/pull/787 for an example of this intended breakage and how to fix it.

Correctly tracking the required recursion depth

The old implementation did not properly track the required recursion depth when using cache entries, causing it to accept programs whose required depth exceeded the recursion_limit. The next-generation trait solver tracks the depth required for cache entries and therefore causes some crates to now hit the recursion limit which previously did not. We have weakened these errors to a Future Compatibility Warning for now.

Trait solver cycles were sometimes treated as errors

Proving where-clauses can sometimes result in cycles. The way they are handled is quite involved depending on which bounds participate in a cycle. The old implementation incorrectly treats some cycles as an error even though these cycles should result in ambiguity. This can then be used to avoid ambiguity in method selection.

Handling of Return Position impl Trait (RPIT)

We have significantly changed the way Return Position impl Trait - but also the unstable Type Alias Impl Trait and Return Type Notation - are handled. This results in a lot of minor type inference changes and fixes, but also breaks some crates.

Most changes here are intended, one exception is that type inference involving associated types of a not-yet-defined RPIT is weaker than with the old solver. This is tracked and https://github.com/rust-lang/trait-system-refactor-initiative/issues/248 we'll fix it going forward.

#[feature(generic_const_exprs)]

This feature is not supported with the next-generation trait solver and is intended to be superseded by feature(generic_const_args) in the near future. For now, we're falling back to the currently stable -Znext-solver=coherence for crates which enable generic_const_exprs while emitting a warning. @rust-lang/project-const-generics will publish a separate blog post explaining its removal and replacement when we remove support for this feature.

Affected crates

When tracking the affected versions, we're using ❌ for versions which are not patched yet while ✔️ indicates that there is a minor version in which this breakage has been fixed. We're also using ️ for breakage which we intend fix in the compiler itself. The required crate does not need any changes in this case.

Compilation errors

crate cause known affected versions
amaru-pure-stage overflow opaque type auto-trait checking #161658 main ✔️
bevy_ecs higher-ranked associated type 0.15 ✔️
commit_verify trait solver cycle handling 0.10-0.11
diskann-wide higher-ranked associated type 0.55
git-url-parse non dyn-compatible trait object 0.6
gizmo-core higher-ranked associated type 0.1-0.8
glaredb_core higher-ranked associated type 25
loess Assoc type of RPIT inference 0.2
minijinja higher-ranked associated type 0.23-0.341 ✔️ 2 ✔️
sparsey higher-ranked associated type 0.13 ✔️
tera higher-ranked associated type 2 ✔️
wasmtime-wasi-http higher-ranked associated type 48.0.1 ✔️

Hangs

crate cause known affected versions
varisat exponential number of unconstrained regions 0.2.2 ✔️

Future compatibility warnings

crate cause known affected versions
generic-array recursion depth tracking 1 ✔️
wgpu recursion depth tracking 25-30 :x:

Unintended breakage

The following breakage was found since enabling the next-generation trait solver and should get fixed in the compiler itself:

The following have been fixed: