Struct rustc::middle::infer::InferCtxt [−] [src]

pub struct InferCtxt<'a, 'tcx> {
    pub tcx: &'a ctxt<'tcx>,
    // some fields omitted
}
Unstable

Fields

tcx
Unstable

Methods

impl<'a, 'tcx> InferCtxt<'a, 'tcx>

fn freshen<T: TypeFoldable<'tcx>>(&self, t: T) -> T

Unstable

fn type_var_diverges(&'a self, ty: Ty) -> bool

Unstable

fn freshener<'b>(&'b self) -> TypeFreshener<'b, 'tcx>

Unstable

fn type_is_unconstrained_numeric(&'a self, ty: Ty) -> UnconstrainedNumeric

Unstable

fn equate(&'a self, a_is_expected: bool, trace: TypeTrace<'tcx>) -> Equate<'a, 'tcx>

Unstable

fn sub(&'a self, a_is_expected: bool, trace: TypeTrace<'tcx>) -> Sub<'a, 'tcx>

Unstable

fn lub(&'a self, a_is_expected: bool, trace: TypeTrace<'tcx>) -> Lub<'a, 'tcx>

Unstable

fn glb(&'a self, a_is_expected: bool, trace: TypeTrace<'tcx>) -> Glb<'a, 'tcx>

Unstable

fn commit_unconditionally<R, F>(&self, f: F) -> R where F: FnOnce() -> R

Unstable

Execute f and commit the bindings

fn commit_if_ok<T, E, F>(&self, f: F) -> Result<T, E> where F: FnOnce(&CombinedSnapshot) -> Result<T, E>

Unstable

Execute f and commit the bindings if closure f returns Ok(_)

fn commit_regions_if_ok<T, E, F>(&self, f: F) -> Result<T, E> where F: FnOnce() -> Result<T, E>

Unstable

Execute f and commit only the region bindings if successful. The function f must be very careful not to leak any non-region variables that get created.

fn probe<R, F>(&self, f: F) -> R where F: FnOnce(&CombinedSnapshot) -> R

Unstable

Execute f then unroll any bindings it creates

fn add_given(&self, sub: FreeRegion, sup: RegionVid)

Unstable

fn sub_types(&self, a_is_expected: bool, origin: TypeOrigin, a: Ty<'tcx>, b: Ty<'tcx>) -> UnitResult<'tcx>

Unstable

fn eq_types(&self, a_is_expected: bool, origin: TypeOrigin, a: Ty<'tcx>, b: Ty<'tcx>) -> UnitResult<'tcx>

Unstable

fn sub_trait_refs(&self, a_is_expected: bool, origin: TypeOrigin, a: TraitRef<'tcx>, b: TraitRef<'tcx>) -> UnitResult<'tcx>

Unstable

fn sub_poly_trait_refs(&self, a_is_expected: bool, origin: TypeOrigin, a: PolyTraitRef<'tcx>, b: PolyTraitRef<'tcx>) -> UnitResult<'tcx>

Unstable

fn construct_skolemized_subst(&self, generics: &Generics<'tcx>, snapshot: &CombinedSnapshot) -> (Substs<'tcx>, SkolemizationMap)

Unstable

See higher_ranked::construct_skolemized_subst

fn skolemize_late_bound_regions<T>(&self, value: &Binder<T>, snapshot: &CombinedSnapshot) -> (T, SkolemizationMap) where T: TypeFoldable<'tcx> + Repr<'tcx>

Unstable

See higher_ranked::skolemize_late_bound_regions

fn leak_check(&self, skol_map: &SkolemizationMap, snapshot: &CombinedSnapshot) -> UnitResult<'tcx>

Unstable

See higher_ranked::leak_check

fn plug_leaks<T>(&self, skol_map: SkolemizationMap, snapshot: &CombinedSnapshot, value: &T) -> T where T: TypeFoldable<'tcx> + Repr<'tcx>

Unstable

See higher_ranked::plug_leaks

fn equality_predicate(&self, span: Span, predicate: &PolyEquatePredicate<'tcx>) -> UnitResult<'tcx>

Unstable

fn region_outlives_predicate(&self, span: Span, predicate: &PolyRegionOutlivesPredicate) -> UnitResult<'tcx>

Unstable

fn next_ty_var_id(&self, diverging: bool) -> TyVid

Unstable

fn next_ty_var(&self) -> Ty<'tcx>

Unstable

fn next_diverging_ty_var(&self) -> Ty<'tcx>

Unstable

fn next_ty_vars(&self, n: usize) -> Vec<Ty<'tcx>>

Unstable

fn next_int_var_id(&self) -> IntVid

Unstable

fn next_float_var_id(&self) -> FloatVid

Unstable

fn next_region_var(&self, origin: RegionVariableOrigin) -> Region

Unstable

fn region_vars_for_defs(&self, span: Span, defs: &[RegionParameterDef]) -> Vec<Region>

Unstable

fn fresh_substs_for_generics(&self, span: Span, generics: &Generics<'tcx>) -> Substs<'tcx>

Unstable

Given a set of generics defined on a type or impl, returns a substitution mapping each type/region parameter to a fresh inference variable.

fn fresh_substs_for_trait(&self, span: Span, generics: &Generics<'tcx>, self_ty: Ty<'tcx>) -> Substs<'tcx>

Unstable

Given a set of generics defined on a trait, returns a substitution mapping each output type/region parameter to a fresh inference variable, and mapping the self type to self_ty.

fn fresh_bound_region(&self, debruijn: DebruijnIndex) -> Region

Unstable

fn resolve_regions_and_report_errors(&self, free_regions: &FreeRegionMap, subject_node_id: NodeId)

Unstable

fn ty_to_string(&self, t: Ty<'tcx>) -> String

Unstable

fn tys_to_string(&self, ts: &[Ty<'tcx>]) -> String

Unstable

fn trait_ref_to_string(&self, t: &TraitRef<'tcx>) -> String

Unstable

fn shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx>

Unstable

fn resolve_type_vars_if_possible<T: TypeFoldable<'tcx>>(&self, value: &T) -> T

Unstable

Where possible, replaces type/int/float variables in value with their final value. Note that region variables are unaffected. If a type variable has not been unified, it is left as is. This is an idempotent operation that does not affect inference state in any way and so you can do it at will.

fn fully_resolve<T: TypeFoldable<'tcx>>(&self, value: &T) -> fres<T>

Unstable

Attempts to resolve all type/region variables in value. Region inference must have been run already (e.g., by calling resolve_regions_and_report_errors). If some variable was never unified, an Err results.

This method is idempotent, but it not typically not invoked except during the writeback phase.

fn type_error_message_str<M>(&self, sp: Span, mk_msg: M, actual_ty: String, err: Option<&type_err<'tcx>>) where M: FnOnce(Option<String>, String) -> String

Unstable

fn type_error_message_str_with_expected<M>(&self, sp: Span, mk_msg: M, expected_ty: Option<Ty<'tcx>>, actual_ty: String, err: Option<&type_err<'tcx>>) where M: FnOnce(Option<String>, String) -> String

Unstable

fn type_error_message<M>(&self, sp: Span, mk_msg: M, actual_ty: Ty<'tcx>, err: Option<&type_err<'tcx>>) where M: FnOnce(String) -> String

Unstable

fn report_mismatched_types(&self, span: Span, expected: Ty<'tcx>, actual: Ty<'tcx>, err: &type_err<'tcx>)

Unstable

fn replace_late_bound_regions_with_fresh_var<T>(&self, span: Span, lbrct: LateBoundRegionConversionTime, value: &Binder<T>) -> (T, FnvHashMap<BoundRegion, Region>) where T: TypeFoldable<'tcx> + Repr<'tcx>

Unstable

fn verify_generic_bound(&self, origin: SubregionOrigin<'tcx>, kind: GenericKind<'tcx>, a: Region, bs: Vec<Region>)

Unstable

See verify_generic_bound method in region_inference

fn can_equate<'b, T>(&'b self, a: &T, b: &T) -> UnitResult<'tcx> where T: Relate<'b, 'tcx> + Repr<'tcx>

Unstable

Trait Implementations

impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx>

fn report_region_errors(&self, errors: &Vec<RegionResolutionError<'tcx>>)

fn process_errors(&self, errors: &Vec<RegionResolutionError<'tcx>>) -> Vec<RegionResolutionError<'tcx>>

fn report_type_error(&self, trace: TypeTrace<'tcx>, terr: &type_err<'tcx>)

fn report_and_explain_type_error(&self, trace: TypeTrace<'tcx>, terr: &type_err<'tcx>)

fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<String>

fn expected_found_str<T: UserString<'tcx> + Resolvable<'tcx>>(&self, exp_found: &expected_found<T>) -> Option<String>

fn report_generic_bound_failure(&self, origin: SubregionOrigin<'tcx>, bound_kind: GenericKind<'tcx>, sub: Region, _sups: Vec<Region>)

fn report_concrete_failure(&self, origin: SubregionOrigin<'tcx>, sub: Region, sup: Region)

fn report_sub_sup_conflict(&self, var_origin: RegionVariableOrigin, sub_origin: SubregionOrigin<'tcx>, sub_region: Region, sup_origin: SubregionOrigin<'tcx>, sup_region: Region)

fn report_sup_sup_conflict(&self, var_origin: RegionVariableOrigin, origin1: SubregionOrigin<'tcx>, region1: Region, origin2: SubregionOrigin<'tcx>, region2: Region)

fn report_processed_errors(&self, var_origins: &[RegionVariableOrigin], trace_origins: &[(TypeTrace<'tcx>, type_err<'tcx>)], same_regions: &[SameRegions])

fn give_suggestion(&self, same_regions: &[SameRegions])