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 type_implements_trait(
&self,
trait_def_id: DefId,
params: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
param_env: ParamEnv<'tcx>
) -> EvaluationResult;
}
Required Methods§
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
sourcefn type_implements_trait(
&self,
trait_def_id: DefId,
params: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
param_env: ParamEnv<'tcx>
) -> EvaluationResult
fn type_implements_trait(
&self,
trait_def_id: DefId,
params: impl IntoIterator<Item = impl 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.