add subst_identity_iter and subst_identity_iter_copied methods on EarlyBinder; use this to simplify some EarlyBinder noise around explicit_item_bounds calls

This commit is contained in:
Kyle Matsuda 2023-04-17 17:19:08 -06:00
parent f3b279fcc5
commit e54854f6a9
12 changed files with 43 additions and 50 deletions

View file

@ -1800,9 +1800,7 @@ fn check_must_not_suspend_ty<'tcx>(
// FIXME: support adding the attribute to TAITs
ty::Alias(ty::Opaque, ty::AliasTy { def_id: def, .. }) => {
let mut has_emitted = false;
for bound in tcx.explicit_item_bounds(def).transpose_iter() {
let predicate = bound.map_bound(|&(pred, _)| pred).subst_identity();
for (predicate, _) in tcx.explicit_item_bounds(def).subst_identity_iter_copied() {
// We only look at the `DefId`, so it is safe to skip the binder here.
if let ty::PredicateKind::Clause(ty::Clause::Trait(ref poly_trait_predicate)) =
predicate.kind().skip_binder()