1
Fork 0

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

@ -318,11 +318,10 @@ pub(super) fn check_opaque_for_inheriting_lifetimes(
tcx,
selftys: vec![],
};
let prohibit_opaque =
tcx.explicit_item_bounds(def_id).transpose_iter().try_for_each(|bound| {
let predicate = bound.map_bound(|&(predicate, _)| predicate).subst_identity();
predicate.visit_with(&mut visitor)
});
let prohibit_opaque = tcx
.explicit_item_bounds(def_id)
.subst_identity_iter_copied()
.try_for_each(|(predicate, _)| predicate.visit_with(&mut visitor));
if let Some(ty) = prohibit_opaque.break_value() {
visitor.visit_item(&item);