A different sort of visitor for walking fn bodies. Unlike the
normal visitor, which just walks the entire body in one shot, the
ExprUseVisitor determines how expressions are being used.
During type inference, partially inferred terms are
represented using inference variables (ty::Infer). These donβt appear in
the final ty::TypeckResults since all of the types should have been
inferred once typeck is done.
CoerceMany encapsulates the pattern you should use when you have
many expressions that are all getting coerced to a common
type. This arises, for example, when you have a match (the result
of each arm is coerced to a common type). It also arises in less
obvious places, such as when you have many break foo expressions
that target the same loop, or the various return expressions in
a function.
The FnCtxt stores type-checking context needed to type-check bodies of
functions, closures, and consts, including performing type inference
with InferCtxt.
The GatherLocalsVisitor is responsible for initializing local variable types
in the ty::TypeckResults for all subpatterns in statements and expressions
like let, match, and params of function bodies. It also adds Sized bounds
for these types (with exceptions for unsized feature gates like unsized_fn_params).
Tracks whether executing a node may exit normally (versus
return/break/panic, which βdivergeβ, leaving dead code in their
wake). Tracked semi-automatically (through type variables marked
as diverging), with some manual adjustments for control-flow
primitives (approximating a CFG).
Helper used for fns and closures. Does the grungy work of checking a function
body and returns the function context used for that purpose, since in the case of a fn item
there is still a bit more to do.
Same as typeck but inspect is invoked on evaluation of each root obligation.
Inspecting obligations only works with the new trait solver.
This function is only to be used by external tools, it should not be
called from within rustc. Note, this is not a query, and thus is not cached.