Module rustc_borrowck::source ·
This pass type-checks the MIR to ensure it is not broken.
- This module contains code to equate the input/output types appearing in the MIR with the expected input/output types from the function signature. This requires a bit of processing, as the expected types are supplied to us before normalization and may contain opaque
impl Traitinstances. In contrast, the input/output types found in the MIR (specifically, in the special local variables for the
RETURN_PLACEthe MIR arguments) are always fully normalized (and contain revealed
- liveness 🔒
infcx.instantiate_opaque_types. Unlike other
TypeOps, this is not canonicalized - it directly affects the main
InferCtxtthat we use during MIR borrowchecking.
- A collection of region constraints that must be satisfied for the program to be considered well-typed.
- The MIR type checker. Visits the MIR and enforces all the constraints needed for it to be valid and well-typed. Along the way, it accrues region constraints – these can later be used by NLL region checking.
- Verifies that MIR types are sane to not crash further checks.
Locationstype summarizes where region constraints are required to hold. Normally, this is at a particular point which created the obligation, but for constraints that the user gave, we want the constraint to hold at all points.
- mirbug 🔒
- Type checks the given
mirin the context of the inference context
infcx. Returns any region constraints that have yet to be proven. This result includes liveness constraints that ensure that regions appearing in the types of all local variables are live at all points where that local variable may later be used.