Skip to main content

Crate rustc_hir_typeck

Crate rustc_hir_typeck 

Source

Re-exportsΒ§

pub(crate) use rustc_data_structures::unord::UnordSet; πŸ”’
pub(crate) use Applicability; πŸ”’
pub(crate) use Diag; πŸ”’
pub(crate) use ErrorGuaranteed; πŸ”’
pub(crate) use struct_span_code_err; πŸ”’
pub(crate) use rustc_hir as hir; πŸ”’
pub(crate) use DefKind; πŸ”’
pub(crate) use Res; πŸ”’
pub(crate) use HirId; πŸ”’
pub(crate) use HirIdMap; πŸ”’
pub(crate) use Node; πŸ”’
pub(crate) use rustc_hir_analysis::check::check_abi; πŸ”’
pub(crate) use rustc_hir_analysis::hir_ty_lowering::HirTyLowerer; πŸ”’
pub(crate) use ObligationCauseCode; πŸ”’
pub(crate) use ObligationInspector; πŸ”’
pub(crate) use TraitEngine; πŸ”’
pub(crate) use WellFormedLoc; πŸ”’
pub(crate) use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; πŸ”’
pub(crate) use rustc_middle::query::Providers; πŸ”’
pub(crate) use self; πŸ”’
pub(crate) use FnSigKind; πŸ”’
pub(crate) use Ty; πŸ”’
pub(crate) use TyCtxt; πŸ”’
pub(crate) use Unnormalized; πŸ”’
pub(crate) use rustc_session::config; πŸ”’
pub(crate) use rustc_span::def_id::LocalDefId; πŸ”’
pub(crate) use Span; πŸ”’
pub(crate) use bug; πŸ”’
pub(crate) use span_bug; πŸ”’
pub(crate) use debug; πŸ”’
pub(crate) use instrument; πŸ”’
pub(crate) use instrument; πŸ”’
pub(crate) use rustc_errors::codes::*; πŸ”’

ModulesΒ§

_match πŸ”’
autoderef πŸ”’
Some helper functions for AutoDeref.
callee πŸ”’
cast
Code for type-checking cast expressions.
check πŸ”’
closure πŸ”’
Code for type-checking closure expressions.
coercion πŸ”’
Type Coercion
demand πŸ”’
diagnostics πŸ”’
Errors emitted by rustc_hir_typeck.
diverges πŸ”’
expectation πŸ”’
expr πŸ”’
Type checking expressions.
expr_use_visitor
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 πŸ”’
gather_locals πŸ”’
inline_asm πŸ”’
intrinsicck πŸ”’
loops πŸ”’
method πŸ”’
Method lookup: the secret sauce of Rust. See the rustc dev guide for more information.
naked_functions πŸ”’
Checks validity of naked functions.
op πŸ”’
Code related to processing overloaded binary and unary operators.
opaque_types πŸ”’
pat πŸ”’
place_op πŸ”’
typeck_root_ctxt πŸ”’
upvar πŸ”’
Inferring borrow kinds for upvars
writeback πŸ”’
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.

MacrosΒ§

type_error_struct

StructsΒ§

BreakableCtxt
CoerceMany πŸ”’
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.
CoroutineTypes πŸ”’
When check_fn is invoked on a coroutine (i.e., a body that includes yield), it returns back some information about the yield points.
EnclosingBreakables
FnCtxt πŸ”’
The FnCtxt stores type-checking context needed to type-check bodies of functions, closures, and consts, including performing type inference with InferCtxt.
GatherLocalsVisitor πŸ”’
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).
LoweredTy πŸ”’
The ty representation of a user-provided type. Depending on the use-site we want to either use the unnormalized or the normalized form of this type.
TypeckRootCtxt πŸ”’
Data shared between a β€œtypeck root” and its nested bodies, e.g. closures defined within the function. For example:

EnumsΒ§

Diverges πŸ”’
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).
Expectation πŸ”’
When type-checking an expression, we propagate downward whatever type hint we are able in the form of an Expectation.
Needs
PlaceOp
TupleArgumentsFlag πŸ”’
Controls whether all arguments are tupled. This is used for the call operator only.

FunctionsΒ§

can_coerce
Check whether ty can be coerced to output_ty. Used from clippy.
check_fn πŸ”’
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.
extend_err_with_const_context πŸ”’
fatally_break_rust πŸ”’
infer_type_if_missing πŸ”’
inspect_typeck
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.
provide
Adds query implementations to the Providers vtable, see rustc_middle::query
typeck_root πŸ”’
typeck_with_inspect πŸ”’
used_trait_imports πŸ”’