use rustc_middle::arena::ArenaAllocatable;
use rustc_middle::infer::canonical::{Canonical, CanonicalizedQueryResponse, QueryResponse};
use rustc_middle::traits::query::Fallible;
-use rustc_middle::ty::subst::SubstsRef;
-use rustc_middle::ty::ToPredicate;
use rustc_middle::ty::{self, Ty, TypeFoldable, TypeVisitable};
+use rustc_middle::ty::{GenericArg, ToPredicate};
use rustc_span::{Span, DUMMY_SP};
use std::fmt::Debug;
/// The inputs are:
///
/// - the def-id of the trait
- /// - the self type
- /// - the *other* type parameters of the trait, excluding the self-type
+ /// - the type parameters of the trait, including the self-type
/// - the parameter environment
///
/// Invokes `evaluate_obligation`, so in the event that evaluating
fn type_implements_trait(
&self,
trait_def_id: DefId,
- ty: Ty<'tcx>,
- params: SubstsRef<'tcx>,
+ params: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
param_env: ty::ParamEnv<'tcx>,
) -> traits::EvaluationResult;
}
InferOk { value, obligations }
}
- #[instrument(level = "debug", skip(self), ret)]
+ #[instrument(level = "debug", skip(self, params), ret)]
fn type_implements_trait(
&self,
trait_def_id: DefId,
- ty: Ty<'tcx>,
- params: SubstsRef<'tcx>,
+ params: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
param_env: ty::ParamEnv<'tcx>,
) -> traits::EvaluationResult {
- let trait_ref =
- ty::TraitRef { def_id: trait_def_id, substs: self.tcx.mk_substs_trait(ty, params) };
+ let trait_ref = self.tcx.mk_trait_ref(trait_def_id, params);
let obligation = traits::Obligation {
cause: traits::ObligationCause::dummy(),