Module rustc_trait_selection::solve
source · Expand description
The next-generation trait solver, currently still WIP.
As a user of rust, you can use -Ztrait-solver=next
or next-coherence
to enable the new trait solver always, or just within coherence, respectively.
As a developer of rustc, you shouldn’t be using the new trait
solver without asking the trait-system-refactor-initiative, but it can
be enabled with InferCtxtBuilder::with_next_trait_solver
. This will
ensure that trait solving using that inference context will be routed
to the new trait solver.
For a high-level overview of how this solver works, check out the relevant section of the rustc-dev-guide.
FIXME(@lcnr): Write that section. If you read this before then ask me about it on zulip.
Modules
- Implements the
AliasRelate
goal, which is used when unifying aliases. Doing this via a separate goal is called “deferred alias relation” and part of our more general approach to “lazy normalization”. - assembly 🔒Code shared by trait and projection goals for candidate assembly.
- fulfill 🔒
- Computes a normalizes-to (projection) goal for inherent associated types,
#![feature(inherent_associated_type)]
. Since astconv already determines which impl the IAT is being projected from, we just: - opaques 🔒Computes a normalizes-to (projection) goal for opaque types. This goal behaves differently depending on the param-env’s reveal mode and whether the opaque is in a defining scope.
- Dealing with trait goals, i.e.
T: Trait<'a, U>
. - Computes a normalizes-to (projection) goal for inherent associated types,
#![feature(lazy_type_alias)]
and#![feature(type_alias_impl_trait)]
.
Structs
- A trait engine using the new trait solver.