Skip to main content

InferCtxtLike

Trait InferCtxtLike 

Source
pub trait InferCtxtLike: Sized {
    type Interner: Interner;
    type OpaqueTypeStorageEntries: OpaqueTypeStorageEntries;

Show 61 methods // Required methods fn cx(&self) -> Self::Interner; fn enable_next_solver_overflow_fcw(&self) -> bool; fn disable_trait_solver_fast_paths(&self) -> bool; fn typing_mode_raw(&self) -> TypingMode<Self::Interner>; fn universe(&self) -> UniverseIndex; fn create_next_universe(&self) -> UniverseIndex; fn insert_placeholder_assumptions( &self, u: UniverseIndex, assumptions: Option<Assumptions<Self::Interner>>, ); fn get_placeholder_assumptions( &self, u: UniverseIndex, ) -> Option<Assumptions<Self::Interner>>; fn get_solver_region_constraint(&self) -> RegionConstraint<Self::Interner>; fn overwrite_solver_region_constraint( &self, constraint: RegionConstraint<Self::Interner>, span: <Self::Interner as Interner>::Span, ); fn universe_of_ty(&self, ty: TyVid) -> Option<UniverseIndex>; fn universe_of_region(&self, lt: RegionVid) -> Option<UniverseIndex>; fn universe_of_const(&self, ct: ConstVid) -> Option<UniverseIndex>; fn root_ty_var(&self, var: TyVid) -> TyVid; fn sub_unification_table_root_var(&self, var: TyVid) -> TyVid; fn is_sub_unification_table_root_var(&self, var: TyVid) -> bool; fn root_const_var(&self, var: ConstVid) -> ConstVid; fn shallow_resolve_ty_var( &self, vid: TyVid, ) -> <Self::Interner as Interner>::Ty; fn shallow_resolve_int_var( &self, vid: IntVid, ) -> <Self::Interner as Interner>::Ty; fn shallow_resolve_float_var( &self, vid: FloatVid, ) -> <Self::Interner as Interner>::Ty; fn shallow_resolve_const_var( &self, vid: ConstVid, ) -> <Self::Interner as Interner>::Const; fn shallow_resolve_region_var( &self, vid: RegionVid, ) -> Region<Self::Interner>; fn ty_or_const_infer_var_changed(&self, var: TyOrConstInferVar) -> bool; fn next_region_infer(&self) -> Region<Self::Interner>; fn next_ty_infer(&self) -> <Self::Interner as Interner>::Ty; fn next_const_infer(&self) -> <Self::Interner as Interner>::Const; fn fresh_args_for_item( &self, def_id: <Self::Interner as Interner>::DefId, ) -> <Self::Interner as Interner>::GenericArgs; fn instantiate_binder_with_infer<T: TypeFoldable<Self::Interner> + Copy>( &self, value: Binder<Self::Interner, T>, ) -> T; fn enter_forall_without_assumptions<T: TypeFoldable<Self::Interner>, U>( &self, value: Binder<Self::Interner, T>, f: impl FnOnce(T) -> U, ) -> U; fn enter_forall_with_empty_assumptions<T: TypeFoldable<Self::Interner>, U>( &self, value: Binder<Self::Interner, T>, f: impl FnOnce(T) -> U, ) -> U; fn equate_ty_vids_raw(&self, a: TyVid, b: TyVid); fn sub_unify_ty_vids_raw(&self, a: TyVid, b: TyVid); fn equate_int_vids_raw(&self, a: IntVid, b: IntVid); fn equate_float_vids_raw(&self, a: FloatVid, b: FloatVid); fn equate_const_vids_raw(&self, a: ConstVid, b: ConstVid); fn instantiate_ty_var_raw( &self, vid: TyVid, ty: <Self::Interner as Interner>::Ty, ); fn instantiate_const_var_raw( &self, vid: ConstVid, ct: <Self::Interner as Interner>::Const, ); fn instantiate_ty_var<R: PredicateEmittingRelation<Self>>( &self, relation: &mut R, target_is_expected: bool, target_vid: TyVid, instantiation_variance: Variance, source_ty: <Self::Interner as Interner>::Ty, ) -> RelateResult<Self::Interner, ()>; fn instantiate_int_var_raw(&self, vid: IntVid, value: IntVarValue); fn instantiate_float_var_raw(&self, vid: FloatVid, value: FloatVarValue); fn instantiate_const_var<R: PredicateEmittingRelation<Self>>( &self, relation: &mut R, target_is_expected: bool, target_vid: ConstVid, source_ct: <Self::Interner as Interner>::Const, ) -> RelateResult<Self::Interner, ()>; fn set_tainted_by_errors( &self, e: <Self::Interner as Interner>::ErrorGuaranteed, ); fn shallow_resolve( &self, ty: <Self::Interner as Interner>::Ty, ) -> <Self::Interner as Interner>::Ty; fn shallow_resolve_const( &self, ty: <Self::Interner as Interner>::Const, ) -> <Self::Interner as Interner>::Const; fn deeply_resolve_ignoring_regions<T>(&self, value: T) -> T where T: TypeFoldable<Self::Interner>; fn probe<T>(&self, probe: impl FnOnce() -> T) -> T; fn commit_if_ok<T, E>( &self, f: impl FnOnce() -> Result<T, E>, ) -> Result<T, E>; fn sub_regions( &self, sub: Region<Self::Interner>, sup: Region<Self::Interner>, vis: VisibleForLeakCheck, span: <Self::Interner as Interner>::Span, ); fn equate_regions( &self, a: Region<Self::Interner>, b: Region<Self::Interner>, vis: VisibleForLeakCheck, span: <Self::Interner as Interner>::Span, ); fn register_solver_region_constraint( &self, c: RegionConstraint<Self::Interner>, span: <Self::Interner as Interner>::Span, ); fn register_ty_outlives( &self, ty: <Self::Interner as Interner>::Ty, r: Region<Self::Interner>, span: <Self::Interner as Interner>::Span, ); fn opaque_types_storage_num_entries(&self) -> Self::OpaqueTypeStorageEntries; fn clone_opaque_types_lookup_table( &self, ) -> Vec<(OpaqueTypeKey<Self::Interner>, <Self::Interner as Interner>::Ty)>; fn clone_duplicate_opaque_types( &self, ) -> Vec<(OpaqueTypeKey<Self::Interner>, <Self::Interner as Interner>::Ty)>; fn clone_opaque_types_added_since( &self, prev_entries: Self::OpaqueTypeStorageEntries, ) -> Vec<(OpaqueTypeKey<Self::Interner>, <Self::Interner as Interner>::Ty)>; fn opaques_with_sub_unified_hidden_type( &self, ty: TyVid, ) -> Vec<OpaqueAliasTy<Self::Interner>> ; fn register_hidden_type_in_storage( &self, opaque_type_key: OpaqueTypeKey<Self::Interner>, hidden_ty: <Self::Interner as Interner>::Ty, span: <Self::Interner as Interner>::Span, ) -> Option<<Self::Interner as Interner>::Ty>; fn add_duplicate_opaque_type( &self, opaque_type_key: OpaqueTypeKey<Self::Interner>, hidden_ty: <Self::Interner as Interner>::Ty, span: <Self::Interner as Interner>::Span, ); fn reset_opaque_types(&self); // Provided methods fn next_trait_solver(&self) -> bool { ... } fn deeply_resolve_via_unification_table<T: TypeFoldable<Self::Interner>>( &self, value: T, ) -> T { ... }
}
Expand description

InferCtxtLike is one of the two traits abstracting over the InferCtxt, which had to be split due to coherence reasons:

  • InferCtxtLike] contains the parts that have to live in rustc_infer, and thus aren’t only about trait-solving. It is implemented directly on InferCtxt,
  • SolverDelegate contains the parts depending on trait-solving logic, to provide functionality in rustc_trait_selection, and is implemented by a simple wrapper over InferCtxt there.

More information can also be found in the dedicated chapter in the dev-guide, in this section.

Required Associated Types§

Required Methods§

Source

fn cx(&self) -> Self::Interner

Source

fn enable_next_solver_overflow_fcw(&self) -> bool

Source

fn disable_trait_solver_fast_paths(&self) -> bool

Source

fn typing_mode_raw(&self) -> TypingMode<Self::Interner>

Source

fn universe(&self) -> UniverseIndex

Source

fn create_next_universe(&self) -> UniverseIndex

Source

fn insert_placeholder_assumptions( &self, u: UniverseIndex, assumptions: Option<Assumptions<Self::Interner>>, )

Source

fn get_placeholder_assumptions( &self, u: UniverseIndex, ) -> Option<Assumptions<Self::Interner>>

Source

fn get_solver_region_constraint(&self) -> RegionConstraint<Self::Interner>

Source

fn overwrite_solver_region_constraint( &self, constraint: RegionConstraint<Self::Interner>, span: <Self::Interner as Interner>::Span, )

Source

fn universe_of_ty(&self, ty: TyVid) -> Option<UniverseIndex>

Source

fn universe_of_region(&self, lt: RegionVid) -> Option<UniverseIndex>

Source

fn universe_of_const(&self, ct: ConstVid) -> Option<UniverseIndex>

Source

fn root_ty_var(&self, var: TyVid) -> TyVid

Source

fn sub_unification_table_root_var(&self, var: TyVid) -> TyVid

Source

fn is_sub_unification_table_root_var(&self, var: TyVid) -> bool

Source

fn root_const_var(&self, var: ConstVid) -> ConstVid

Source

fn shallow_resolve_ty_var(&self, vid: TyVid) -> <Self::Interner as Interner>::Ty

Source

fn shallow_resolve_int_var( &self, vid: IntVid, ) -> <Self::Interner as Interner>::Ty

Source

fn shallow_resolve_float_var( &self, vid: FloatVid, ) -> <Self::Interner as Interner>::Ty

Source

fn shallow_resolve_const_var( &self, vid: ConstVid, ) -> <Self::Interner as Interner>::Const

Source

fn shallow_resolve_region_var(&self, vid: RegionVid) -> Region<Self::Interner>

Source

fn ty_or_const_infer_var_changed(&self, var: TyOrConstInferVar) -> bool

Source

fn next_region_infer(&self) -> Region<Self::Interner>

Source

fn next_ty_infer(&self) -> <Self::Interner as Interner>::Ty

Source

fn next_const_infer(&self) -> <Self::Interner as Interner>::Const

Source

fn fresh_args_for_item( &self, def_id: <Self::Interner as Interner>::DefId, ) -> <Self::Interner as Interner>::GenericArgs

Source

fn instantiate_binder_with_infer<T: TypeFoldable<Self::Interner> + Copy>( &self, value: Binder<Self::Interner, T>, ) -> T

Source

fn enter_forall_without_assumptions<T: TypeFoldable<Self::Interner>, U>( &self, value: Binder<Self::Interner, T>, f: impl FnOnce(T) -> U, ) -> U

Source

fn enter_forall_with_empty_assumptions<T: TypeFoldable<Self::Interner>, U>( &self, value: Binder<Self::Interner, T>, f: impl FnOnce(T) -> U, ) -> U

FIXME(-Zassumptions-on-binders): Any usage of this method is likely wrong and should be replaced in the long term by actually taking assumptions into account.

Source

fn equate_ty_vids_raw(&self, a: TyVid, b: TyVid)

Source

fn sub_unify_ty_vids_raw(&self, a: TyVid, b: TyVid)

Source

fn equate_int_vids_raw(&self, a: IntVid, b: IntVid)

Source

fn equate_float_vids_raw(&self, a: FloatVid, b: FloatVid)

Source

fn equate_const_vids_raw(&self, a: ConstVid, b: ConstVid)

Source

fn instantiate_ty_var_raw( &self, vid: TyVid, ty: <Self::Interner as Interner>::Ty, )

Use instantiate_ty_var instead unless you have reasons to skip generalization.

Source

fn instantiate_const_var_raw( &self, vid: ConstVid, ct: <Self::Interner as Interner>::Const, )

Use instantiate_const_var instead unless you have reasons to skip generalization.

Source

fn instantiate_ty_var<R: PredicateEmittingRelation<Self>>( &self, relation: &mut R, target_is_expected: bool, target_vid: TyVid, instantiation_variance: Variance, source_ty: <Self::Interner as Interner>::Ty, ) -> RelateResult<Self::Interner, ()>

Source

fn instantiate_int_var_raw(&self, vid: IntVid, value: IntVarValue)

Source

fn instantiate_float_var_raw(&self, vid: FloatVid, value: FloatVarValue)

Source

fn instantiate_const_var<R: PredicateEmittingRelation<Self>>( &self, relation: &mut R, target_is_expected: bool, target_vid: ConstVid, source_ct: <Self::Interner as Interner>::Const, ) -> RelateResult<Self::Interner, ()>

Source

fn set_tainted_by_errors( &self, e: <Self::Interner as Interner>::ErrorGuaranteed, )

Source

fn shallow_resolve( &self, ty: <Self::Interner as Interner>::Ty, ) -> <Self::Interner as Interner>::Ty

Source

fn shallow_resolve_const( &self, ty: <Self::Interner as Interner>::Const, ) -> <Self::Interner as Interner>::Const

Source

fn deeply_resolve_ignoring_regions<T>(&self, value: T) -> T
where T: TypeFoldable<Self::Interner>,

Source

fn probe<T>(&self, probe: impl FnOnce() -> T) -> T

Source

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

Source

fn sub_regions( &self, sub: Region<Self::Interner>, sup: Region<Self::Interner>, vis: VisibleForLeakCheck, span: <Self::Interner as Interner>::Span, )

Source

fn equate_regions( &self, a: Region<Self::Interner>, b: Region<Self::Interner>, vis: VisibleForLeakCheck, span: <Self::Interner as Interner>::Span, )

Source

fn register_solver_region_constraint( &self, c: RegionConstraint<Self::Interner>, span: <Self::Interner as Interner>::Span, )

Source

fn register_ty_outlives( &self, ty: <Self::Interner as Interner>::Ty, r: Region<Self::Interner>, span: <Self::Interner as Interner>::Span, )

Source

fn opaque_types_storage_num_entries(&self) -> Self::OpaqueTypeStorageEntries

Source

fn clone_opaque_types_lookup_table( &self, ) -> Vec<(OpaqueTypeKey<Self::Interner>, <Self::Interner as Interner>::Ty)>

Source

fn clone_duplicate_opaque_types( &self, ) -> Vec<(OpaqueTypeKey<Self::Interner>, <Self::Interner as Interner>::Ty)>

Source

fn clone_opaque_types_added_since( &self, prev_entries: Self::OpaqueTypeStorageEntries, ) -> Vec<(OpaqueTypeKey<Self::Interner>, <Self::Interner as Interner>::Ty)>

Source

fn opaques_with_sub_unified_hidden_type( &self, ty: TyVid, ) -> Vec<OpaqueAliasTy<Self::Interner>>

Source

fn register_hidden_type_in_storage( &self, opaque_type_key: OpaqueTypeKey<Self::Interner>, hidden_ty: <Self::Interner as Interner>::Ty, span: <Self::Interner as Interner>::Span, ) -> Option<<Self::Interner as Interner>::Ty>

Source

fn add_duplicate_opaque_type( &self, opaque_type_key: OpaqueTypeKey<Self::Interner>, hidden_ty: <Self::Interner as Interner>::Ty, span: <Self::Interner as Interner>::Span, )

Source

fn reset_opaque_types(&self)

Provided Methods§

Source

fn next_trait_solver(&self) -> bool

Whether the new trait solver is enabled. This only exists because rustc shares code between the new and old trait solvers; for all other users, this should always be true. If this is unknowingly false and you try to use the new trait solver, things will break badly.

Source

fn deeply_resolve_via_unification_table<T: TypeFoldable<Self::Interner>>( &self, value: T, ) -> T

Where possible, replaces type/const/region variables in value with their final value. If a type/const/region variable has not (yet) been unified, it is left as is.

This is an idempotent operation that does not affect inference state in any way, which means it’s safe to call this function at will.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§