Module rustc_typeck::check[][src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Re-exports

pub use self::Expectation::*;
use self::autoderef::Autoderef;
use self::callee::DeferredCallResolution;
use self::coercion::CoerceMany;
use self::coercion::DynamicCoerceMany;
pub use self::compare_method::compare_impl_method;
pub use self::compare_method::compare_const_impl;
use self::method::MethodCallee;
use self::TupleArgumentsFlag::*;
use astconv::AstConv;
use hir::def::Def;
use hir::def_id::CrateNum;
use hir::def_id::DefId;
use hir::def_id::LOCAL_CRATE;
use std::slice;
use namespace::Namespace;
use rustc::infer;
use rustc::infer::InferCtxt;
use rustc::infer::InferOk;
use rustc::infer::RegionVariableOrigin;
use rustc::infer::anon_types::AnonTypeDecl;
use rustc::infer::type_variable::TypeVariableOrigin;
use rustc::middle::region;
use rustc::mir::interpret::GlobalId;
use rustc::ty::subst::Kind;
use rustc::ty::subst::Subst;
use rustc::ty::subst::Substs;
use rustc::traits;
use rustc::traits::ObligationCause;
use rustc::traits::ObligationCauseCode;
use rustc::traits::TraitEngine;
use rustc::ty;
use rustc::ty::Ty;
use rustc::ty::TyCtxt;
use rustc::ty::Visibility;
use rustc::ty::ToPredicate;
use rustc::ty::adjustment::Adjust;
use rustc::ty::adjustment::Adjustment;
use rustc::ty::adjustment::AllowTwoPhase;
use rustc::ty::adjustment::AutoBorrow;
use rustc::ty::adjustment::AutoBorrowMutability;
use rustc::ty::fold::TypeFoldable;
use rustc::ty::maps::Providers;
use rustc::ty::util::Representability;
use rustc::ty::util::IntTypeExt;
use rustc::ty::util::Discr;
use errors::DiagnosticBuilder;
use errors::DiagnosticId;
use require_c_abi_if_variadic;
use session::CompileIncomplete;
use session::config;
use session::Session;
use TypeAndSubsts;
use lint;
use util::common::ErrorReported;
use util::common::indenter;
use util::nodemap::DefIdMap;
use util::nodemap::DefIdSet;
use util::nodemap::FxHashMap;
use util::nodemap::NodeMap;
use std::cell::Cell;
use std::cell::RefCell;
use std::cell::Ref;
use std::cell::RefMut;
use rustc_data_structures::sync::Lrc;
use std::collections::hash_map::Entry;
use std::cmp;
use std::fmt::Display;
use std::mem::replace;
use std::iter;
use std::ops;
use std::ops::Deref;
use rustc_target::spec::abi::Abi;
use syntax::ast;
use syntax::attr;
use syntax::codemap::original_sp;
use syntax::codemap::Spanned;
use syntax::feature_gate::GateIssue;
use syntax::feature_gate::emit_feature_err;
use syntax::ptr::P;
use syntax::symbol::Symbol;
use syntax::symbol::LocalInternedString;
use syntax::symbol::keywords;
use syntax::util::lev_distance::find_best_match_for_name;
use syntax_pos;
use syntax_pos::BytePos;
use syntax_pos::Span;
use syntax_pos::MultiSpan;
use rustc::hir::intravisit;
use rustc::hir::intravisit::Visitor;
use rustc::hir::intravisit::NestedVisitorMap;
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir::map::Node;
use rustc::hir;
use rustc::hir::PatKind;
use rustc::middle::lang_items;

Modules

_match [
Experimental
]
autoderef [
Experimental
]
callee [
Experimental
]
cast [
Experimental
]

Code for type-checking cast expressions.

closure [
Experimental
]

Code for type-checking closure expressions.

coercion [
Experimental
]

Type Coercion

compare_method [
Experimental
]
demand [
Experimental
]
dropck [
Experimental
]
generator_interior [
Experimental
]

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.

intrinsic [
Experimental
]

Type-checking for the rust-intrinsic and platform-intrinsic intrinsics that the compiler exposes.

method [
Experimental
]

Method lookup: the secret sauce of Rust. See the rustc guide chapter.

op [
Experimental
]

Code related to processing overloaded binary and unary operators.

regionck [
Experimental
]

The region check is a final pass that runs over the AST after we have inferred the type constraints but before we have actually finalized the types. Its purpose is to embed a variety of region constraints. Inserting these constraints as a separate pass is good because (1) it localizes the code that has to do with region inference and (2) often we cannot know what constraints are needed until the basic types have been inferred.

upvar [
Experimental
]

Inferring borrow kinds for upvars

wfcheck [
Experimental
]
writeback [
Experimental
]

Structs

BreakableCtxt [
Experimental
]
CheckItemTypesVisitor [
Experimental
]
EnclosingBreakables [
Experimental
]
FnCtxt [
Experimental
]
GatherLocalsVisitor [
Experimental
]
GeneratorTypes [
Experimental
]

When check_fn is invoked on a generator (i.e., a body that includes yield), it returns back some information about the yield points.

Inherited [
Experimental
]

closures defined within the function. For example:

InheritedBuilder [
Experimental
]

Helper type of a temporary returned by Inherited::build(...). Necessary because we can't write the following bound: F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(Inherited<'b, 'gcx, 'tcx>).

MaybeInProgressTables [
Experimental
]

A wrapper for InferCtxt's in_progress_tables field.

UnsafetyState [
Experimental
]

Enums

Diverges [
Experimental
]

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 [
Experimental
]

When type-checking an expression, we propagate downward whatever type hint we are able in the form of an Expectation.

Needs [
Experimental
]
PlaceOp [
Experimental
]
TupleArgumentsFlag [
Experimental
]

Controls whether the arguments are tupled. This is used for the call operator.

Functions

adt_destructor [
Experimental
]
check_abi [
Experimental
]
check_bounds_are_used [
Experimental
]
check_const_is_u8_array [
Experimental
]
check_enum [
Experimental
]
check_fn [
Experimental
]

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.

check_impl_item_well_formed [
Experimental
]
check_impl_items_against_trait [
Experimental
]
check_item_bodies [
Experimental
]
check_item_type [
Experimental
]
check_item_types [
Experimental
]
check_item_well_formed [
Experimental
]
check_on_unimplemented [
Experimental
]
check_packed [
Experimental
]
check_packed_inner [
Experimental
]
check_representable [
Experimental
]

Checks whether a type can be represented in memory. In particular, it identifies types that contain themselves without indirection through a pointer, which would mean their size is unbounded.

check_simd [
Experimental
]
check_specialization_validity [
Experimental
]
check_struct [
Experimental
]
check_trait_item_well_formed [
Experimental
]
check_transparent [
Experimental
]
check_union [
Experimental
]
check_wf_new [
Experimental
]
fatally_break_rust [
Experimental
]
has_typeck_tables [
Experimental
]
primary_body_of [
Experimental
]

If this def-id is a "primary tables entry", returns Some((body_id, decl)) with information about it's body-id and fn-decl (if any). Otherwise, returns None.

provide [
Experimental
]
report_forbidden_specialization [
Experimental
]
typeck_item_bodies [
Experimental
]
typeck_tables_of [
Experimental
]
used_trait_imports [
Experimental
]