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

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.

Implementors