Module inspect
Expand description
Data structure used to inspect trait solver behavior.
During trait solving we optionally build “proof trees”, the root of which is a GoalEvaluation. These trees are used by the compiler to inspect the behavior of the trait solver and to access its internal state, e.g. for diagnostics and when selecting impls during codegen.
Because each nested goal in the solver gets canonicalized separately
and we discard inference progress via “probes”, we cannot mechanically
use proof trees without somehow “lifting up” data local to the current
InferCtxt
. To use the data from evaluation we therefore canonicalize
it and store it as a CanonicalState.
Proof trees are only shallow, we do not compute the proof tree for nested goals. Visiting proof trees instead recomputes nested goals in the parents inference context when necessary.
Structs§
- When evaluating a goal we also store the original values for the
CanonicalVarValues
of the canonicalized goal. We use this to map any CanonicalState from the localInferCtxt
of the solver query to theInferCtxt
of the caller. - A self-contained computation during trait solving. This either corresponds to a
EvalCtxt::probe(_X)
call or the root evaluation of a goal. - Some
data
together with information about how they relate to the input of the canonical query.
Enums§
- What kind of probe we’re in. In case the probe represents a candidate, or the final result of the current goal - via ProbeKind::Root - we also store the QueryResult.