Expand description
The next-generation trait solver, currently still WIP.
As a user of rust, you can use -Znext-solver
to enable the new trait solver.
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.
Modules§
- alias_
relate 🔒 - 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.
- effect_
goals 🔒 - Dealing with host effect goals, i.e. enforcing the constness in
T: const Trait
orT: ~const Trait
. - eval_
ctxt 🔒 - inspect
- normalizes_
to 🔒 - project_
goals 🔒 - search_
graph 🔒 - trait_
goals 🔒 - Dealing with trait goals, i.e.
T: Trait<'a, U>
.
Structs§
- Eval
Ctxt - External
Constraints Data - Additional constraints returned on success.
- Goal
- A goal is a statement, i.e.
predicate
, we want to prove given some assumptions, i.e.param_env
. - Nested
Normalization Goals - NoSolution
- Predefined
Opaques Data - Opaques that are defined in the inference context before a query is called.
- Query
Input - Response
Enums§
- AdtDestructor
Kind - Indicates that a
impl Drop for Adt
isconst
or not. - Builtin
Impl Source - Candidate
Source - Possible ways the given goal can be proven.
- Certainty
- Generate
Proof Tree - Goal
Evaluation 🔒Kind - Goal
Source - Why a specific goal has to be proven.
- HasChanged
- Whether evaluating this goal ended up changing the inference state.
- Maybe
Cause - Why we failed to evaluate a goal.
Constants§
- FIXPOINT_
STEP_ 🔒LIMIT - How many fixpoint iterations we should attempt inside of the solver before bailing with overflow.
Traits§
Functions§
Type Aliases§
- Canonical
Input - Canonical
Response - Query
Result - The result of evaluating a canonical query.