Trait rustc_trait_selection::infer::InferCtxtExt
source · [−]pub trait InferCtxtExt<'tcx> {
fn type_is_copy_modulo_regions(
&self,
param_env: ParamEnv<'tcx>,
ty: Ty<'tcx>,
span: Span
) -> bool;
fn type_is_sized_modulo_regions(
&self,
param_env: ParamEnv<'tcx>,
ty: Ty<'tcx>,
span: Span
) -> bool;
fn partially_normalize_associated_types_in<T>(
&self,
cause: ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
value: T
) -> InferOk<'tcx, T>
where
T: TypeFoldable<'tcx>;
fn type_implements_trait(
&self,
trait_def_id: DefId,
ty: Ty<'tcx>,
params: SubstsRef<'tcx>,
param_env: ParamEnv<'tcx>
) -> EvaluationResult;
}
Required Methods
sourcefn type_is_copy_modulo_regions(
fn type_is_copy_modulo_regions(
&self,
param_env: ParamEnv<'tcx>,
ty: Ty<'tcx>,
span: Span
) -> bool
sourcefn type_is_sized_modulo_regions(
fn type_is_sized_modulo_regions(
&self,
param_env: ParamEnv<'tcx>,
ty: Ty<'tcx>,
span: Span
) -> bool
sourcefn partially_normalize_associated_types_in<T>(
fn partially_normalize_associated_types_in<T>(
&self,
cause: ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
value: T
) -> InferOk<'tcx, T>where
T: TypeFoldable<'tcx>,
sourcefn type_implements_trait(
&self,
trait_def_id: DefId,
ty: Ty<'tcx>,
params: SubstsRef<'tcx>,
param_env: ParamEnv<'tcx>
) -> EvaluationResult
fn type_implements_trait(
&self,
trait_def_id: DefId,
ty: Ty<'tcx>,
params: SubstsRef<'tcx>,
param_env: ParamEnv<'tcx>
) -> EvaluationResult
Check whether a ty
implements given trait(trait_def_id).
The inputs are:
- the def-id of the trait
- the self type
- the other type parameters of the trait, excluding the self-type
- the parameter environment
Invokes evaluate_obligation
, so in the event that evaluating
Ty: Trait
causes overflow, EvaluatedToRecur (or EvaluatedToUnknown)
will be returned.