Stop using ty::GenericPredicates for non-predicates_of queries

This commit is contained in:
Michael Goulet 2024-08-29 00:17:40 -04:00
parent 508a7b4b38
commit 5bbb0d41f1
3 changed files with 3 additions and 4 deletions

View file

@ -246,7 +246,7 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
&& let [.., path] = poly_trait.trait_ref.path.segments
&& poly_trait.bound_generic_params.is_empty()
&& let Some(trait_def_id) = path.res.opt_def_id()
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).predicates
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).skip_binder()
// If the trait has no supertrait, there is no need to collect anything from that bound
&& !predicates.is_empty()
{

View file

@ -25,8 +25,7 @@ fn is_subtrait_of_any(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
|| cx
.tcx
.explicit_super_predicates_of(tr.def_id)
.predicates
.iter()
.iter_identity_copied()
.any(|(clause, _)| {
matches!(clause.kind().skip_binder(), ty::ClauseKind::Trait(super_tr)
if cx.tcx.is_diagnostic_item(sym::Any, super_tr.def_id()))

View file

@ -91,7 +91,7 @@ fn path_to_sized_bound(cx: &LateContext<'_>, trait_bound: &PolyTraitRef<'_>) ->
return true;
}
for &(predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).predicates {
for (predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).iter_identity_copied() {
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
&& trait_predicate.polarity == PredicatePolarity::Positive
&& !path.contains(&trait_predicate.def_id())