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:
@@ -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);
|
||||
|
||||
@@ -361,8 +361,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, associated_items: &[hir::TraitItemRe
|
||||
param_env,
|
||||
item_def_id,
|
||||
tcx.explicit_item_bounds(item_def_id)
|
||||
.transpose_iter()
|
||||
.map(|bound| bound.map_bound(|b| *b).subst_identity())
|
||||
.subst_identity_iter_copied()
|
||||
.collect::<Vec<_>>(),
|
||||
&FxIndexSet::default(),
|
||||
gat_def_id.def_id,
|
||||
@@ -1128,8 +1127,7 @@ fn check_associated_type_bounds(wfcx: &WfCheckingCtxt<'_, '_>, item: ty::AssocIt
|
||||
let bounds = wfcx.tcx().explicit_item_bounds(item.def_id);
|
||||
|
||||
debug!("check_associated_type_bounds: bounds={:?}", bounds);
|
||||
let wf_obligations = bounds.transpose_iter().flat_map(|b| {
|
||||
let (bound, bound_span) = b.map_bound(|b| *b).subst_identity();
|
||||
let wf_obligations = bounds.subst_identity_iter_copied().flat_map(|(bound, bound_span)| {
|
||||
let normalized_bound = wfcx.normalize(span, None, bound);
|
||||
traits::wf::predicate_obligations(
|
||||
wfcx.infcx,
|
||||
|
||||
Reference in New Issue
Block a user