Module rustc_infer::traits::solve::inspect

source ·
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 local InferCtxt of the solver query to the InferCtxt 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§

Type Aliases§