Better names?
This commit is contained in:
parent
868aa42f4b
commit
84d254ead0
@ -102,8 +102,8 @@ impl<'tcx> InherentCollect<'tcx> {
|
|||||||
if let Some(simp) = simplify_type(
|
if let Some(simp) = simplify_type(
|
||||||
self.tcx,
|
self.tcx,
|
||||||
self_ty,
|
self_ty,
|
||||||
TreatParams::AsInfer,
|
TreatParams::AsCandidateKey,
|
||||||
TreatProjections::DefaultCandidate,
|
TreatProjections::AsCandidateKey,
|
||||||
) {
|
) {
|
||||||
self.impls_map.incoherent_impls.entry(simp).or_default().push(impl_def_id);
|
self.impls_map.incoherent_impls.entry(simp).or_default().push(impl_def_id);
|
||||||
} else {
|
} else {
|
||||||
@ -164,9 +164,12 @@ impl<'tcx> InherentCollect<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(simp) =
|
if let Some(simp) = simplify_type(
|
||||||
simplify_type(self.tcx, ty, TreatParams::AsInfer, TreatProjections::DefaultCandidate)
|
self.tcx,
|
||||||
{
|
ty,
|
||||||
|
TreatParams::AsCandidateKey,
|
||||||
|
TreatProjections::AsCandidateKey,
|
||||||
|
) {
|
||||||
self.impls_map.incoherent_impls.entry(simp).or_default().push(impl_def_id);
|
self.impls_map.incoherent_impls.entry(simp).or_default().push(impl_def_id);
|
||||||
} else {
|
} else {
|
||||||
bug!("unexpected primitive type: {:?}", ty);
|
bug!("unexpected primitive type: {:?}", ty);
|
||||||
|
@ -700,7 +700,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn assemble_inherent_candidates_for_incoherent_ty(&mut self, self_ty: Ty<'tcx>) {
|
fn assemble_inherent_candidates_for_incoherent_ty(&mut self, self_ty: Ty<'tcx>) {
|
||||||
let Some(simp) = simplify_type(self.tcx, self_ty, TreatParams::AsInfer, TreatProjections::DefaultCandidate) else {
|
let Some(simp) = simplify_type(self.tcx, self_ty, TreatParams::AsCandidateKey, TreatProjections::AsCandidateKey) else {
|
||||||
bug!("unexpected incoherent type: {:?}", self_ty)
|
bug!("unexpected incoherent type: {:?}", self_ty)
|
||||||
};
|
};
|
||||||
for &impl_def_id in self.tcx.incoherent_impls(simp) {
|
for &impl_def_id in self.tcx.incoherent_impls(simp) {
|
||||||
|
@ -1258,7 +1258,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
let target_ty = self
|
let target_ty = self
|
||||||
.autoderef(sugg_span, rcvr_ty)
|
.autoderef(sugg_span, rcvr_ty)
|
||||||
.find(|(rcvr_ty, _)| {
|
.find(|(rcvr_ty, _)| {
|
||||||
DeepRejectCtxt { treat_obligation_params: TreatParams::AsInfer }
|
DeepRejectCtxt { treat_obligation_params: TreatParams::AsCandidateKey }
|
||||||
.types_may_unify(*rcvr_ty, impl_ty)
|
.types_may_unify(*rcvr_ty, impl_ty)
|
||||||
})
|
})
|
||||||
.map_or(impl_ty, |(ty, _)| ty)
|
.map_or(impl_ty, |(ty, _)| ty)
|
||||||
@ -1517,7 +1517,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.any(|info| self.associated_value(info.def_id, item_name).is_some());
|
.any(|info| self.associated_value(info.def_id, item_name).is_some());
|
||||||
let found_assoc = |ty: Ty<'tcx>| {
|
let found_assoc = |ty: Ty<'tcx>| {
|
||||||
simplify_type(tcx, ty, TreatParams::AsInfer, TreatProjections::DefaultCandidate)
|
simplify_type(tcx, ty, TreatParams::AsCandidateKey, TreatProjections::AsCandidateKey)
|
||||||
.and_then(|simp| {
|
.and_then(|simp| {
|
||||||
tcx.incoherent_impls(simp)
|
tcx.incoherent_impls(simp)
|
||||||
.iter()
|
.iter()
|
||||||
@ -2649,8 +2649,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
} else if let Some(simp_rcvr_ty) = simplify_type(
|
} else if let Some(simp_rcvr_ty) = simplify_type(
|
||||||
self.tcx,
|
self.tcx,
|
||||||
rcvr_ty,
|
rcvr_ty,
|
||||||
TreatParams::AsPlaceholder,
|
TreatParams::ForLookup,
|
||||||
TreatProjections::DefaultLookup,
|
TreatProjections::ForLookup,
|
||||||
) {
|
) {
|
||||||
let mut potential_candidates = Vec::new();
|
let mut potential_candidates = Vec::new();
|
||||||
let mut explicitly_negative = Vec::new();
|
let mut explicitly_negative = Vec::new();
|
||||||
@ -2667,8 +2667,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
let imp_simp = simplify_type(
|
let imp_simp = simplify_type(
|
||||||
self.tcx,
|
self.tcx,
|
||||||
imp.self_ty(),
|
imp.self_ty(),
|
||||||
TreatParams::AsPlaceholder,
|
TreatParams::ForLookup,
|
||||||
TreatProjections::DefaultLookup,
|
TreatProjections::ForLookup,
|
||||||
);
|
);
|
||||||
imp_simp.map_or(false, |s| s == simp_rcvr_ty)
|
imp_simp.map_or(false, |s| s == simp_rcvr_ty)
|
||||||
})
|
})
|
||||||
|
@ -1858,8 +1858,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||||||
let simplified_self_ty = fast_reject::simplify_type(
|
let simplified_self_ty = fast_reject::simplify_type(
|
||||||
self.tcx,
|
self.tcx,
|
||||||
trait_ref.self_ty(),
|
trait_ref.self_ty(),
|
||||||
TreatParams::AsInfer,
|
TreatParams::AsCandidateKey,
|
||||||
TreatProjections::DefaultCandidate,
|
TreatProjections::AsCandidateKey,
|
||||||
);
|
);
|
||||||
|
|
||||||
fx_hash_map
|
fx_hash_map
|
||||||
|
@ -51,9 +51,12 @@ pub enum SimplifiedType {
|
|||||||
/// generic parameters as if they were inference variables in that case.
|
/// generic parameters as if they were inference variables in that case.
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
||||||
pub enum TreatParams {
|
pub enum TreatParams {
|
||||||
/// Treat parameters as placeholders in the given environment.
|
/// Treat parameters as infer vars. This is the correct mode for caching
|
||||||
AsPlaceholder,
|
/// an impl's type for lookup.
|
||||||
AsInfer,
|
AsCandidateKey,
|
||||||
|
/// Treat parameters as placeholders in the given environment. This is the
|
||||||
|
/// correct mode for *lookup*, as during candidate selection.
|
||||||
|
ForLookup,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// During fast-rejection, we have the choice of treating projection types
|
/// During fast-rejection, we have the choice of treating projection types
|
||||||
@ -67,13 +70,13 @@ pub enum TreatProjections {
|
|||||||
/// We must assume that the `impl<T> Trait<T> for <T as Id>::This`
|
/// We must assume that the `impl<T> Trait<T> for <T as Id>::This`
|
||||||
/// can apply to all self types so we don't return a simplified type
|
/// can apply to all self types so we don't return a simplified type
|
||||||
/// for `<T as Id>::This`.
|
/// for `<T as Id>::This`.
|
||||||
DefaultCandidate,
|
AsCandidateKey,
|
||||||
/// In the old solver we don't try to normalize projections
|
/// In the old solver we don't try to normalize projections
|
||||||
/// when looking up impls and only access them by using the
|
/// when looking up impls and only access them by using the
|
||||||
/// current self type. This means that if the self type is
|
/// current self type. This means that if the self type is
|
||||||
/// a projection which could later be normalized, we must not
|
/// a projection which could later be normalized, we must not
|
||||||
/// treat it as rigid.
|
/// treat it as rigid.
|
||||||
DefaultLookup,
|
ForLookup,
|
||||||
/// We can treat projections in the self type as opaque as
|
/// We can treat projections in the self type as opaque as
|
||||||
/// we separately look up impls for the normalized self type.
|
/// we separately look up impls for the normalized self type.
|
||||||
NextSolverLookup,
|
NextSolverLookup,
|
||||||
@ -133,13 +136,13 @@ pub fn simplify_type<'tcx>(
|
|||||||
ty::FnPtr(f) => Some(FunctionSimplifiedType(f.skip_binder().inputs().len())),
|
ty::FnPtr(f) => Some(FunctionSimplifiedType(f.skip_binder().inputs().len())),
|
||||||
ty::Placeholder(..) => Some(PlaceholderSimplifiedType),
|
ty::Placeholder(..) => Some(PlaceholderSimplifiedType),
|
||||||
ty::Param(_) => match treat_params {
|
ty::Param(_) => match treat_params {
|
||||||
TreatParams::AsPlaceholder => Some(PlaceholderSimplifiedType),
|
TreatParams::ForLookup => Some(PlaceholderSimplifiedType),
|
||||||
TreatParams::AsInfer => None,
|
TreatParams::AsCandidateKey => None,
|
||||||
},
|
},
|
||||||
ty::Alias(..) => match treat_projections {
|
ty::Alias(..) => match treat_projections {
|
||||||
TreatProjections::DefaultLookup if !ty.needs_infer() => Some(PlaceholderSimplifiedType),
|
TreatProjections::ForLookup if !ty.needs_infer() => Some(PlaceholderSimplifiedType),
|
||||||
TreatProjections::NextSolverLookup => Some(PlaceholderSimplifiedType),
|
TreatProjections::NextSolverLookup => Some(PlaceholderSimplifiedType),
|
||||||
TreatProjections::DefaultCandidate | TreatProjections::DefaultLookup => None,
|
TreatProjections::AsCandidateKey | TreatProjections::ForLookup => None,
|
||||||
},
|
},
|
||||||
ty::Foreign(def_id) => Some(ForeignSimplifiedType(def_id)),
|
ty::Foreign(def_id) => Some(ForeignSimplifiedType(def_id)),
|
||||||
ty::Bound(..) | ty::Infer(_) | ty::Error(_) => None,
|
ty::Bound(..) | ty::Infer(_) | ty::Error(_) => None,
|
||||||
@ -307,8 +310,8 @@ impl DeepRejectCtxt {
|
|||||||
// Depending on the value of `treat_obligation_params`, we either
|
// Depending on the value of `treat_obligation_params`, we either
|
||||||
// treat generic parameters like placeholders or like inference variables.
|
// treat generic parameters like placeholders or like inference variables.
|
||||||
ty::Param(_) => match self.treat_obligation_params {
|
ty::Param(_) => match self.treat_obligation_params {
|
||||||
TreatParams::AsPlaceholder => false,
|
TreatParams::ForLookup => false,
|
||||||
TreatParams::AsInfer => true,
|
TreatParams::AsCandidateKey => true,
|
||||||
},
|
},
|
||||||
|
|
||||||
ty::Infer(_) => true,
|
ty::Infer(_) => true,
|
||||||
@ -345,8 +348,8 @@ impl DeepRejectCtxt {
|
|||||||
let k = impl_ct.kind();
|
let k = impl_ct.kind();
|
||||||
match obligation_ct.kind() {
|
match obligation_ct.kind() {
|
||||||
ty::ConstKind::Param(_) => match self.treat_obligation_params {
|
ty::ConstKind::Param(_) => match self.treat_obligation_params {
|
||||||
TreatParams::AsPlaceholder => false,
|
TreatParams::ForLookup => false,
|
||||||
TreatParams::AsInfer => true,
|
TreatParams::AsCandidateKey => true,
|
||||||
},
|
},
|
||||||
|
|
||||||
// As we don't necessarily eagerly evaluate constants,
|
// As we don't necessarily eagerly evaluate constants,
|
||||||
|
@ -127,7 +127,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
self.for_each_relevant_impl_treating_projections(
|
self.for_each_relevant_impl_treating_projections(
|
||||||
trait_def_id,
|
trait_def_id,
|
||||||
self_ty,
|
self_ty,
|
||||||
TreatProjections::DefaultLookup,
|
TreatProjections::ForLookup,
|
||||||
f,
|
f,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -156,8 +156,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
if let Some(simp) = fast_reject::simplify_type(
|
if let Some(simp) = fast_reject::simplify_type(
|
||||||
self,
|
self,
|
||||||
self_ty,
|
self_ty,
|
||||||
TreatParams::AsInfer,
|
TreatParams::AsCandidateKey,
|
||||||
TreatProjections::DefaultCandidate,
|
TreatProjections::AsCandidateKey,
|
||||||
) {
|
) {
|
||||||
if let Some(impls) = impls.non_blanket_impls.get(&simp) {
|
if let Some(impls) = impls.non_blanket_impls.get(&simp) {
|
||||||
return impls.iter().copied();
|
return impls.iter().copied();
|
||||||
@ -196,7 +196,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
// `T: Clone` this is incredibly useful as we would otherwise look at all the impls
|
// `T: Clone` this is incredibly useful as we would otherwise look at all the impls
|
||||||
// of `Clone` for `Option<T>`, `Vec<T>`, `ConcreteType` and so on.
|
// of `Clone` for `Option<T>`, `Vec<T>`, `ConcreteType` and so on.
|
||||||
if let Some(simp) =
|
if let Some(simp) =
|
||||||
fast_reject::simplify_type(self, self_ty, TreatParams::AsPlaceholder, treat_projections)
|
fast_reject::simplify_type(self, self_ty, TreatParams::ForLookup, treat_projections)
|
||||||
{
|
{
|
||||||
if let Some(impls) = impls.non_blanket_impls.get(&simp) {
|
if let Some(impls) = impls.non_blanket_impls.get(&simp) {
|
||||||
for &impl_def_id in impls {
|
for &impl_def_id in impls {
|
||||||
@ -261,8 +261,8 @@ pub(super) fn trait_impls_of_provider(tcx: TyCtxt<'_>, trait_id: DefId) -> Trait
|
|||||||
if let Some(simplified_self_ty) = fast_reject::simplify_type(
|
if let Some(simplified_self_ty) = fast_reject::simplify_type(
|
||||||
tcx,
|
tcx,
|
||||||
impl_self_ty,
|
impl_self_ty,
|
||||||
TreatParams::AsInfer,
|
TreatParams::AsCandidateKey,
|
||||||
TreatProjections::DefaultCandidate,
|
TreatProjections::AsCandidateKey,
|
||||||
) {
|
) {
|
||||||
impls.non_blanket_impls.entry(simplified_self_ty).or_default().push(impl_def_id);
|
impls.non_blanket_impls.entry(simplified_self_ty).or_default().push(impl_def_id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -368,7 +368,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
drop_trait,
|
drop_trait,
|
||||||
ty,
|
ty,
|
||||||
// FIXME: This could also be some other mode, like "unexpected"
|
// FIXME: This could also be some other mode, like "unexpected"
|
||||||
TreatProjections::DefaultLookup,
|
TreatProjections::ForLookup,
|
||||||
|impl_did| {
|
|impl_did| {
|
||||||
if let Some(item_id) = self.associated_item_def_ids(impl_did).first() {
|
if let Some(item_id) = self.associated_item_def_ids(impl_did).first() {
|
||||||
if validate(self, impl_did).is_ok() {
|
if validate(self, impl_did).is_ok() {
|
||||||
|
@ -2215,7 +2215,7 @@ impl CheckAttrVisitor<'_> {
|
|||||||
// `fn(TokenStream) -> TokenStream` after some substitution of generic arguments.
|
// `fn(TokenStream) -> TokenStream` after some substitution of generic arguments.
|
||||||
//
|
//
|
||||||
// Properly checking this means pulling in additional `rustc` crates, so we don't.
|
// Properly checking this means pulling in additional `rustc` crates, so we don't.
|
||||||
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::AsInfer };
|
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::AsCandidateKey };
|
||||||
|
|
||||||
if sig.abi != Abi::Rust {
|
if sig.abi != Abi::Rust {
|
||||||
tcx.sess.emit_err(errors::ProcMacroInvalidAbi {
|
tcx.sess.emit_err(errors::ProcMacroInvalidAbi {
|
||||||
|
@ -184,7 +184,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
|
|||||||
|
|
||||||
let goal_trait_ref = goal.predicate.projection_ty.trait_ref(tcx);
|
let goal_trait_ref = goal.predicate.projection_ty.trait_ref(tcx);
|
||||||
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
|
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
|
||||||
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::AsPlaceholder };
|
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::ForLookup };
|
||||||
if iter::zip(goal_trait_ref.substs, impl_trait_ref.skip_binder().substs)
|
if iter::zip(goal_trait_ref.substs, impl_trait_ref.skip_binder().substs)
|
||||||
.any(|(goal, imp)| !drcx.generic_args_may_unify(goal, imp))
|
.any(|(goal, imp)| !drcx.generic_args_may_unify(goal, imp))
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
|
|||||||
let tcx = ecx.tcx();
|
let tcx = ecx.tcx();
|
||||||
|
|
||||||
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
|
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
|
||||||
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::AsPlaceholder };
|
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::ForLookup };
|
||||||
if iter::zip(goal.predicate.trait_ref.substs, impl_trait_ref.skip_binder().substs)
|
if iter::zip(goal.predicate.trait_ref.substs, impl_trait_ref.skip_binder().substs)
|
||||||
.any(|(goal, imp)| !drcx.generic_args_may_unify(goal, imp))
|
.any(|(goal, imp)| !drcx.generic_args_may_unify(goal, imp))
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ pub fn overlapping_impls(
|
|||||||
// Before doing expensive operations like entering an inference context, do
|
// Before doing expensive operations like entering an inference context, do
|
||||||
// a quick check via fast_reject to tell if the impl headers could possibly
|
// a quick check via fast_reject to tell if the impl headers could possibly
|
||||||
// unify.
|
// unify.
|
||||||
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::AsInfer };
|
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::AsCandidateKey };
|
||||||
let impl1_ref = tcx.impl_trait_ref(impl1_def_id);
|
let impl1_ref = tcx.impl_trait_ref(impl1_def_id);
|
||||||
let impl2_ref = tcx.impl_trait_ref(impl2_def_id);
|
let impl2_ref = tcx.impl_trait_ref(impl2_def_id);
|
||||||
let may_overlap = match (impl1_ref, impl2_ref) {
|
let may_overlap = match (impl1_ref, impl2_ref) {
|
||||||
|
@ -1803,7 +1803,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||||||
self.tcx.find_map_relevant_impl(
|
self.tcx.find_map_relevant_impl(
|
||||||
id,
|
id,
|
||||||
proj.projection_ty.self_ty(),
|
proj.projection_ty.self_ty(),
|
||||||
TreatProjections::DefaultLookup,
|
TreatProjections::ForLookup,
|
||||||
|did| {
|
|did| {
|
||||||
self.tcx
|
self.tcx
|
||||||
.associated_items(did)
|
.associated_items(did)
|
||||||
@ -2185,7 +2185,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||||||
self.tcx.find_map_relevant_impl(
|
self.tcx.find_map_relevant_impl(
|
||||||
trait_def_id,
|
trait_def_id,
|
||||||
trait_ref.skip_binder().self_ty(),
|
trait_ref.skip_binder().self_ty(),
|
||||||
TreatProjections::DefaultLookup,
|
TreatProjections::ForLookup,
|
||||||
Some,
|
Some,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
@ -784,7 +784,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
let relevant_impl = self.tcx().find_map_relevant_impl(
|
let relevant_impl = self.tcx().find_map_relevant_impl(
|
||||||
self.tcx().require_lang_item(LangItem::Drop, None),
|
self.tcx().require_lang_item(LangItem::Drop, None),
|
||||||
obligation.predicate.skip_binder().trait_ref.self_ty(),
|
obligation.predicate.skip_binder().trait_ref.self_ty(),
|
||||||
TreatProjections::DefaultLookup,
|
TreatProjections::ForLookup,
|
||||||
Some,
|
Some,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2558,7 +2558,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
|||||||
// We can avoid creating type variables and doing the full
|
// We can avoid creating type variables and doing the full
|
||||||
// substitution if we find that any of the input types, when
|
// substitution if we find that any of the input types, when
|
||||||
// simplified, do not match.
|
// simplified, do not match.
|
||||||
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::AsPlaceholder };
|
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::ForLookup };
|
||||||
iter::zip(obligation.predicate.skip_binder().trait_ref.substs, impl_trait_ref.substs)
|
iter::zip(obligation.predicate.skip_binder().trait_ref.substs, impl_trait_ref.substs)
|
||||||
.any(|(obl, imp)| !drcx.generic_args_may_unify(obl, imp))
|
.any(|(obl, imp)| !drcx.generic_args_may_unify(obl, imp))
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
|
|||||||
if let Some(st) = fast_reject::simplify_type(
|
if let Some(st) = fast_reject::simplify_type(
|
||||||
tcx,
|
tcx,
|
||||||
trait_ref.self_ty(),
|
trait_ref.self_ty(),
|
||||||
TreatParams::AsInfer,
|
TreatParams::AsCandidateKey,
|
||||||
fast_reject::TreatProjections::DefaultCandidate,
|
TreatProjections::AsCandidateKey,
|
||||||
) {
|
) {
|
||||||
debug!("insert_blindly: impl_def_id={:?} st={:?}", impl_def_id, st);
|
debug!("insert_blindly: impl_def_id={:?} st={:?}", impl_def_id, st);
|
||||||
self.non_blanket_impls.entry(st).or_default().push(impl_def_id)
|
self.non_blanket_impls.entry(st).or_default().push(impl_def_id)
|
||||||
@ -72,8 +72,8 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
|
|||||||
if let Some(st) = fast_reject::simplify_type(
|
if let Some(st) = fast_reject::simplify_type(
|
||||||
tcx,
|
tcx,
|
||||||
trait_ref.self_ty(),
|
trait_ref.self_ty(),
|
||||||
TreatParams::AsInfer,
|
TreatParams::AsCandidateKey,
|
||||||
TreatProjections::DefaultCandidate,
|
TreatProjections::AsCandidateKey,
|
||||||
) {
|
) {
|
||||||
debug!("remove_existing: impl_def_id={:?} st={:?}", impl_def_id, st);
|
debug!("remove_existing: impl_def_id={:?} st={:?}", impl_def_id, st);
|
||||||
vec = self.non_blanket_impls.get_mut(&st).unwrap();
|
vec = self.non_blanket_impls.get_mut(&st).unwrap();
|
||||||
@ -313,8 +313,8 @@ impl<'tcx> GraphExt<'tcx> for Graph {
|
|||||||
let simplified = fast_reject::simplify_type(
|
let simplified = fast_reject::simplify_type(
|
||||||
tcx,
|
tcx,
|
||||||
trait_ref.self_ty(),
|
trait_ref.self_ty(),
|
||||||
TreatParams::AsInfer,
|
TreatParams::AsCandidateKey,
|
||||||
TreatProjections::DefaultCandidate,
|
TreatProjections::AsCandidateKey,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Descend the specialization tree, where `parent` is the current parent node.
|
// Descend the specialization tree, where `parent` is the current parent node.
|
||||||
|
@ -735,7 +735,7 @@ fn trait_impls_for<'a>(
|
|||||||
trace!("considering explicit impl for trait {:?}", trait_);
|
trace!("considering explicit impl for trait {:?}", trait_);
|
||||||
|
|
||||||
// Look at each trait implementation to see if it's an impl for `did`
|
// Look at each trait implementation to see if it's an impl for `did`
|
||||||
tcx.find_map_relevant_impl(trait_, ty, TreatProjections::DefaultLookup, |impl_| {
|
tcx.find_map_relevant_impl(trait_, ty, TreatProjections::ForLookup, |impl_| {
|
||||||
let trait_ref = tcx.impl_trait_ref(impl_).expect("this is not an inherent impl");
|
let trait_ref = tcx.impl_trait_ref(impl_).expect("this is not an inherent impl");
|
||||||
// Check if these are the same type.
|
// Check if these are the same type.
|
||||||
let impl_type = trait_ref.skip_binder().self_ty();
|
let impl_type = trait_ref.skip_binder().self_ty();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user