InferCtxtLike in rustc_infer::infer::canonical::ir - Rust
Description: API documentation for the Rust `InferCtxtLike` trait in crate `rustc_infer`.

Skip to main content

## InferCtxtLike

# Trait InferCtxtLike

Source

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

    Show 54 methods    // Required methods
        fn cx(&self) -> Self::Interner;
        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>,
        );
        fn universe_of_ty(&self, ty: TyVid) -> Option<UniverseIndex>;
        fn universe_of_lt(&self, lt: RegionVid) -> Option<UniverseIndex>;
        fn universe_of_ct(&self, ct: ConstVid) -> Option<UniverseIndex>;
        fn root_ty_var(&self, var: TyVid) -> TyVid;
        fn sub_unification_table_root_var(&self, var: TyVid) -> TyVid;
        fn root_const_var(&self, var: ConstVid) -> ConstVid;
        fn opportunistic_resolve_ty_var(
            &self,
            vid: TyVid,
        ) -> <Self::Interner as Interner>::Ty;
        fn opportunistic_resolve_int_var(
            &self,
            vid: IntVid,
        ) -> <Self::Interner as Interner>::Ty;
        fn opportunistic_resolve_float_var(
            &self,
            vid: FloatVid,
        ) -> <Self::Interner as Interner>::Ty;
        fn opportunistic_resolve_ct_var(
            &self,
            vid: ConstVid,
        ) -> <Self::Interner as Interner>::Const;
        fn opportunistic_resolve_lt_var(
            &self,
            vid: RegionVid,
        ) -> <Self::Interner as Interner>::Region;
        fn is_changed_arg(
            &self,
            arg: <Self::Interner as Interner>::GenericArg,
        ) -> bool;
        fn next_region_infer(&self) -> <Self::Interner as Interner>::Region;
        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>(
            &self,
            value: Binder<Self::Interner, T>,
        ) -> T
           where T: TypeFoldable<Self::Interner> + Copy;
        fn enter_forall<T, U>(
            &self,
            value: Binder<Self::Interner, T>,
            f: impl FnOnce(T) -> U,
        ) -> U
           where T: TypeFoldable<Self::Interner>;
        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<R>(
            &self,
            relation: &mut R,
            target_is_expected: bool,
            target_vid: TyVid,
            instantiation_variance: Variance,
            source_ty: <Self::Interner as Interner>::Ty,
        ) -> Result<(), TypeError<Self::Interner>>
           where R: PredicateEmittingRelation<Self>;
        fn instantiate_int_var_raw(&self, vid: IntVid, value: IntVarValue);
        fn instantiate_float_var_raw(&self, vid: FloatVid, value: FloatVarValue);
        fn instantiate_const_var_raw<R>(
            &self,
            relation: &mut R,
            target_is_expected: bool,
            target_vid: ConstVid,
            source_ct: <Self::Interner as Interner>::Const,
        ) -> Result<(), TypeError<Self::Interner>>
           where R: PredicateEmittingRelation<Self>;
        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 resolve_vars_if_possible<T>(&self, value: T) -> T
           where T: TypeFoldable<Self::Interner>;
        fn probe<T>(&self, probe: impl FnOnce() -> T) -> T;
        fn sub_regions(
            &self,
            sub: <Self::Interner as Interner>::Region,
            sup: <Self::Interner as Interner>::Region,
            vis: VisibleForLeakCheck,
            span: <Self::Interner as Interner>::Span,
        );
        fn equate_regions(
            &self,
            a: <Self::Interner as Interner>::Region,
            b: <Self::Interner as Interner>::Region,
            vis: VisibleForLeakCheck,
            span: <Self::Interner as Interner>::Span,
        );
        fn register_solver_region_constraint(
            &self,
            c: RegionConstraint<Self::Interner>,
        );
        fn register_ty_outlives(
            &self,
            ty: <Self::Interner as Interner>::Ty,
            r: <Self::Interner as Interner>::Region,
            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<AliasTy<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 method
        fn next_trait_solver(&self) -> bool { ... }
    }

## Required Associated Types§

Source

#### type Interner: Interner

Source

#### type OpaqueTypeStorageEntries: OpaqueTypeStorageEntries

## Required Methods§

Source

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

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>, )

Source

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

Source

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

Source

#### fn universe_of_ct(&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 root_const_var(&self, var: ConstVid) -> ConstVid

Source

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

Source

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

Source

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

Source

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

Source

#### fn opportunistic_resolve_lt_var( &self, vid: RegionVid, ) -> <Self::Interner as Interner>::Region

Source

#### fn is_changed_arg(&self, arg: <Self::Interner as Interner>::GenericArg) -> bool

Source

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

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>( &self, value: Binder<Self::Interner, T>, ) -> T
where T: TypeFoldable<Self::Interner> + Copy,

Source

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

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<R>( &self, relation: &mut R, target_is_expected: bool, target_vid: TyVid, instantiation_variance: Variance, source_ty: <Self::Interner as Interner>::Ty, ) -> Result<(), TypeError<Self::Interner>>
where R: PredicateEmittingRelation<Self>,

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_raw<R>( &self, relation: &mut R, target_is_expected: bool, target_vid: ConstVid, source_ct: <Self::Interner as Interner>::Const, ) -> Result<(), TypeError<Self::Interner>>
where R: PredicateEmittingRelation<Self>,

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 resolve_vars_if_possible<T>(&self, value: T) -> T
where T: TypeFoldable<Self::Interner>,

Source

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

Source

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

Source

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

Source

#### fn register_solver_region_constraint(&self, c: RegionConstraint<Self::Interner>)

Source

#### fn register_ty_outlives( &self, ty: <Self::Interner as Interner>::Ty, r: <Self::Interner as Interner>::Region, 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<AliasTy<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.

## Dyn Compatibility§

This trait is not dyn compatible.

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

## Implementors§

Source§

### impl<'tcx> InferCtxtLike for InferCtxt<'tcx>

Source§

#### type Interner = TyCtxt<'tcx>

Source§

#### type OpaqueTypeStorageEntries = OpaqueTypeStorageEntries