pub trait InferCtxtExt<'tcx> {
    // Required methods
    fn type_is_copy_modulo_regions(
        &self,
        param_env: ParamEnv<'tcx>,
        ty: Ty<'tcx>
    ) -> bool;
    fn type_is_sized_modulo_regions(
        &self,
        param_env: ParamEnv<'tcx>,
        ty: Ty<'tcx>
    ) -> bool;
    fn type_implements_trait(
        &self,
        trait_def_id: DefId,
        params: impl IntoIterator<Item: Into<GenericArg<'tcx>>>,
        param_env: ParamEnv<'tcx>
    ) -> EvaluationResult;
}

Required Methods§

source

fn type_is_copy_modulo_regions( &self, param_env: ParamEnv<'tcx>, ty: Ty<'tcx> ) -> bool

source

fn type_is_sized_modulo_regions( &self, param_env: ParamEnv<'tcx>, ty: Ty<'tcx> ) -> bool

source

fn type_implements_trait( &self, trait_def_id: DefId, params: impl IntoIterator<Item: Into<GenericArg<'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 type parameters of the trait, including 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§

source§

impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx>