[−][src]Struct rustc_mir::borrow_check::type_check::TypeChecker
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.
Fields
infcx: &'a InferCtxt<'a, 'tcx>param_env: ParamEnv<'tcx>last_span: Spanbody: &'a Body<'tcx>user_type_annotations: &'a CanonicalUserTypeAnnotations<'tcx>User type annotations are shared between the main MIR and the MIR of all of the promoted items.
region_bound_pairs: &'a RegionBoundPairs<'tcx>implicit_region_bound: Region<'tcx>reported_errors: FxHashSet<(Ty<'tcx>, Span)>borrowck_context: &'a mut BorrowCheckContext<'a, 'tcx>universal_region_relations: &'a UniversalRegionRelations<'tcx>opaque_type_values: FxHashMap<DefId, ResolvedOpaqueTy<'tcx>>Implementations
impl<'a, 'tcx> TypeChecker<'a, 'tcx>[src]
pub(in borrow_check::type_check) fn equate_inputs_and_outputs(
&mut self,
body: &Body<'tcx>,
universal_regions: &UniversalRegions<'tcx>,
normalized_inputs_and_output: &[Ty<'tcx>]
)[src]
&mut self,
body: &Body<'tcx>,
universal_regions: &UniversalRegions<'tcx>,
normalized_inputs_and_output: &[Ty<'tcx>]
)
pub(in borrow_check::type_check::input_output) fn equate_normalized_input_or_output(
&mut self,
a: Ty<'tcx>,
b: Ty<'tcx>,
span: Span
)[src]
&mut self,
a: Ty<'tcx>,
b: Ty<'tcx>,
span: Span
)
impl<'a, 'tcx> TypeChecker<'a, 'tcx>[src]
pub(in borrow_check::type_check) fn new(
infcx: &'a InferCtxt<'a, 'tcx>,
body: &'a Body<'tcx>,
param_env: ParamEnv<'tcx>,
region_bound_pairs: &'a RegionBoundPairs<'tcx>,
implicit_region_bound: Region<'tcx>,
borrowck_context: &'a mut BorrowCheckContext<'a, 'tcx>,
universal_region_relations: &'a UniversalRegionRelations<'tcx>
) -> Self[src]
infcx: &'a InferCtxt<'a, 'tcx>,
body: &'a Body<'tcx>,
param_env: ParamEnv<'tcx>,
region_bound_pairs: &'a RegionBoundPairs<'tcx>,
implicit_region_bound: Region<'tcx>,
borrowck_context: &'a mut BorrowCheckContext<'a, 'tcx>,
universal_region_relations: &'a UniversalRegionRelations<'tcx>
) -> Self
pub(in borrow_check::type_check) fn unsized_feature_enabled(
&self
) -> bool[src]
&self
) -> bool
pub(in borrow_check::type_check) fn check_user_type_annotations(
&mut self
)[src]
&mut self
)
Equate the inferred type and the annotated type for user type annotations
pub(in borrow_check::type_check) fn fully_perform_op<R>(
&mut self,
locations: Locations,
category: ConstraintCategory,
op: impl TypeOp<'tcx, Output = R>
) -> Fallible<R>[src]
&mut self,
locations: Locations,
category: ConstraintCategory,
op: impl TypeOp<'tcx, Output = R>
) -> Fallible<R>
Given some operation op that manipulates types, proves
predicates, or otherwise uses the inference context, executes
op and then executes all the further obligations that op
returns. This will yield a set of outlives constraints amongst
regions which are extracted and stored as having occurred at
locations.
Any rustc_infer::infer operations that might generate region
constraints should occur within this method so that those
constraints can be properly localized!
pub(in borrow_check::type_check) fn push_region_constraints(
&mut self,
locations: Locations,
category: ConstraintCategory,
data: &QueryRegionConstraints<'tcx>
)[src]
&mut self,
locations: Locations,
category: ConstraintCategory,
data: &QueryRegionConstraints<'tcx>
)
pub(in borrow_check::type_check) fn relate_types(
&mut self,
a: Ty<'tcx>,
v: Variance,
b: Ty<'tcx>,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>[src]
&mut self,
a: Ty<'tcx>,
v: Variance,
b: Ty<'tcx>,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>
Convenient wrapper around relate_tys::relate_types -- see
that fn for docs.
pub(in borrow_check::type_check) fn sub_types(
&mut self,
sub: Ty<'tcx>,
sup: Ty<'tcx>,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>[src]
&mut self,
sub: Ty<'tcx>,
sup: Ty<'tcx>,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>
pub(in borrow_check::type_check) fn sub_types_or_anon(
&mut self,
sub: Ty<'tcx>,
sup: Ty<'tcx>,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>[src]
&mut self,
sub: Ty<'tcx>,
sup: Ty<'tcx>,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>
Try to relate sub <: sup; if this fails, instantiate opaque
variables in sub with their inferred definitions and try
again. This is used for opaque types in places (e.g., let x: impl Foo = ..).
pub(in borrow_check::type_check) fn eq_types(
&mut self,
a: Ty<'tcx>,
b: Ty<'tcx>,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>[src]
&mut self,
a: Ty<'tcx>,
b: Ty<'tcx>,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>
pub(in borrow_check::type_check) fn relate_type_and_user_type(
&mut self,
a: Ty<'tcx>,
v: Variance,
user_ty: &UserTypeProjection,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>[src]
&mut self,
a: Ty<'tcx>,
v: Variance,
user_ty: &UserTypeProjection,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>
pub(in borrow_check::type_check) fn eq_opaque_type_and_type(
&mut self,
revealed_ty: Ty<'tcx>,
anon_ty: Ty<'tcx>,
anon_owner_def_id: LocalDefId,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>[src]
&mut self,
revealed_ty: Ty<'tcx>,
anon_ty: Ty<'tcx>,
anon_owner_def_id: LocalDefId,
locations: Locations,
category: ConstraintCategory
) -> Fallible<()>
pub(in borrow_check::type_check) fn tcx(
&self
) -> TyCtxt<'tcx>[src]
&self
) -> TyCtxt<'tcx>
pub(in borrow_check::type_check) fn check_stmt(
&mut self,
body: &Body<'tcx>,
stmt: &Statement<'tcx>,
location: Location
)[src]
&mut self,
body: &Body<'tcx>,
stmt: &Statement<'tcx>,
location: Location
)
pub(in borrow_check::type_check) fn check_terminator(
&mut self,
body: &Body<'tcx>,
term: &Terminator<'tcx>,
term_location: Location
)[src]
&mut self,
body: &Body<'tcx>,
term: &Terminator<'tcx>,
term_location: Location
)
pub(in borrow_check::type_check) fn check_call_dest(
&mut self,
body: &Body<'tcx>,
term: &Terminator<'tcx>,
sig: &FnSig<'tcx>,
destination: &Option<(Place<'tcx>, BasicBlock)>,
term_location: Location
)[src]
&mut self,
body: &Body<'tcx>,
term: &Terminator<'tcx>,
sig: &FnSig<'tcx>,
destination: &Option<(Place<'tcx>, BasicBlock)>,
term_location: Location
)
pub(in borrow_check::type_check) fn check_call_inputs(
&mut self,
body: &Body<'tcx>,
term: &Terminator<'tcx>,
sig: &FnSig<'tcx>,
args: &[Operand<'tcx>],
term_location: Location,
from_hir_call: bool
)[src]
&mut self,
body: &Body<'tcx>,
term: &Terminator<'tcx>,
sig: &FnSig<'tcx>,
args: &[Operand<'tcx>],
term_location: Location,
from_hir_call: bool
)
pub(in borrow_check::type_check) fn check_iscleanup(
&mut self,
body: &Body<'tcx>,
block_data: &BasicBlockData<'tcx>
)[src]
&mut self,
body: &Body<'tcx>,
block_data: &BasicBlockData<'tcx>
)
pub(in borrow_check::type_check) fn assert_iscleanup(
&mut self,
body: &Body<'tcx>,
ctxt: &dyn Debug,
bb: BasicBlock,
iscleanuppad: bool
)[src]
&mut self,
body: &Body<'tcx>,
ctxt: &dyn Debug,
bb: BasicBlock,
iscleanuppad: bool
)
pub(in borrow_check::type_check) fn check_local(
&mut self,
body: &Body<'tcx>,
local: Local,
local_decl: &LocalDecl<'tcx>
)[src]
&mut self,
body: &Body<'tcx>,
local: Local,
local_decl: &LocalDecl<'tcx>
)
pub(in borrow_check::type_check) fn ensure_place_sized(
&mut self,
ty: Ty<'tcx>,
span: Span
)[src]
&mut self,
ty: Ty<'tcx>,
span: Span
)
pub(in borrow_check::type_check) fn aggregate_field_ty(
&mut self,
ak: &AggregateKind<'tcx>,
field_index: usize,
location: Location
) -> Result<Ty<'tcx>, FieldAccessError>[src]
&mut self,
ak: &AggregateKind<'tcx>,
field_index: usize,
location: Location
) -> Result<Ty<'tcx>, FieldAccessError>
pub(in borrow_check::type_check) fn check_rvalue(
&mut self,
body: &Body<'tcx>,
rvalue: &Rvalue<'tcx>,
location: Location
)[src]
&mut self,
body: &Body<'tcx>,
rvalue: &Rvalue<'tcx>,
location: Location
)
pub(in borrow_check::type_check) fn rvalue_user_ty(
&self,
rvalue: &Rvalue<'tcx>
) -> Option<UserTypeAnnotationIndex>[src]
&self,
rvalue: &Rvalue<'tcx>
) -> Option<UserTypeAnnotationIndex>
If this rvalue supports a user-given type annotation, then extract and return it. This represents the final type of the rvalue and will be unified with the inferred type.
pub(in borrow_check::type_check) fn check_aggregate_rvalue(
&mut self,
body: &Body<'tcx>,
rvalue: &Rvalue<'tcx>,
aggregate_kind: &AggregateKind<'tcx>,
operands: &[Operand<'tcx>],
location: Location
)[src]
&mut self,
body: &Body<'tcx>,
rvalue: &Rvalue<'tcx>,
aggregate_kind: &AggregateKind<'tcx>,
operands: &[Operand<'tcx>],
location: Location
)
pub(in borrow_check::type_check) fn add_reborrow_constraint(
&mut self,
body: &Body<'tcx>,
location: Location,
borrow_region: Region<'tcx>,
borrowed_place: &Place<'tcx>
)[src]
&mut self,
body: &Body<'tcx>,
location: Location,
borrow_region: Region<'tcx>,
borrowed_place: &Place<'tcx>
)
Adds the constraints that arise from a borrow expression &'a P at the location L.
Parameters
location: the locationLwhere the borrow expression occursborrow_region: the region'aassociated with the borrowborrowed_place: the placePbeing borrowed
pub(in borrow_check::type_check) fn prove_aggregate_predicates(
&mut self,
aggregate_kind: &AggregateKind<'tcx>,
location: Location
)[src]
&mut self,
aggregate_kind: &AggregateKind<'tcx>,
location: Location
)
pub(in borrow_check::type_check) fn prove_closure_bounds(
&mut self,
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
substs: SubstsRef<'tcx>,
location: Location
) -> InstantiatedPredicates<'tcx>[src]
&mut self,
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
substs: SubstsRef<'tcx>,
location: Location
) -> InstantiatedPredicates<'tcx>
pub(in borrow_check::type_check) fn prove_trait_ref(
&mut self,
trait_ref: TraitRef<'tcx>,
locations: Locations,
category: ConstraintCategory
)[src]
&mut self,
trait_ref: TraitRef<'tcx>,
locations: Locations,
category: ConstraintCategory
)
pub(in borrow_check::type_check) fn normalize_and_prove_instantiated_predicates(
&mut self,
instantiated_predicates: InstantiatedPredicates<'tcx>,
locations: Locations
)[src]
&mut self,
instantiated_predicates: InstantiatedPredicates<'tcx>,
locations: Locations
)
pub(in borrow_check::type_check) fn prove_predicates(
&mut self,
predicates: impl IntoIterator<Item = impl ToPredicate<'tcx>>,
locations: Locations,
category: ConstraintCategory
)[src]
&mut self,
predicates: impl IntoIterator<Item = impl ToPredicate<'tcx>>,
locations: Locations,
category: ConstraintCategory
)
pub(in borrow_check::type_check) fn prove_predicate(
&mut self,
predicate: Predicate<'tcx>,
locations: Locations,
category: ConstraintCategory
)[src]
&mut self,
predicate: Predicate<'tcx>,
locations: Locations,
category: ConstraintCategory
)
pub(in borrow_check::type_check) fn typeck_mir(
&mut self,
body: &Body<'tcx>
)[src]
&mut self,
body: &Body<'tcx>
)
pub(in borrow_check::type_check) fn normalize<T>(
&mut self,
value: T,
location: impl NormalizeLocation
) -> T where
T: Normalizable<'tcx> + Copy + 'tcx, [src]
&mut self,
value: T,
location: impl NormalizeLocation
) -> T where
T: Normalizable<'tcx> + Copy + 'tcx,
Auto Trait Implementations
impl<'a, 'tcx> !RefUnwindSafe for TypeChecker<'a, 'tcx>
impl<'a, 'tcx> !Send for TypeChecker<'a, 'tcx>
impl<'a, 'tcx> !Sync for TypeChecker<'a, 'tcx>
impl<'a, 'tcx> Unpin for TypeChecker<'a, 'tcx> where
'tcx: 'a,
'tcx: 'a,
impl<'a, 'tcx> !UnwindSafe for TypeChecker<'a, 'tcx>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.