Crate rustc_hir_typeck
source ·Modules
_match 🔒
Some helper functions for
AutoDeref
callee 🔒
Code for type-checking cast expressions.
check 🔒
closure 🔒
Code for type-checking closure expressions.
coercion 🔒
Type Coercion
demand 🔒
diverges 🔒
errors 🔒
Errors emitted by
rustc_hir_typeck
.expr 🔒
Type checking expressions.
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.fallback 🔒
fn_ctxt 🔒
This calculates the types which has storage which lives across a suspension point in a
generator from the perspective of typeck. The actual types used at runtime
is calculated in
rustc_mir_transform::generator
and may be a subset of the
types computed here.Categorization
method 🔒
Method lookup: the secret sauce of Rust. See the rustc dev guide for more information.
op 🔒
Code related to processing overloaded binary and unary operators.
pat 🔒
place_op 🔒
upvar 🔒
Inferring borrow kinds for upvars
Macros
Structs
The
FnCtxt
stores type-checking context needed to type-check bodies of
functions, closures, and const
s, including performing type inference
with InferCtxt
.When
check_fn
is invoked on a generator (i.e., a body that
includes yield), it returns back some information about the yield
points.Closures defined within the function. For example:
A temporary returned by
Inherited::build(...)
. This is necessary
for multiple InferCtxt
to share the same typeck_results
without using Rc
or something similar.The type of a local binding, including the revealed type for anon types.
Enums
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).
When type-checking an expression, we propagate downward
whatever type hint we are able in the form of an
Expectation
.Controls whether the arguments are tupled. This is used for the call
operator.
Functions
Used only to get
TypeckResults
for type inference during error recovery.
Currently only used for type inference of static
s and const
s to avoid type cycle errors.If this
DefId
is a “primary tables entry”, returns
Some((body_id, body_ty, fn_sig))
. Otherwise, returns None
.typeck 🔒