Make InstantiatedPredicates impl IntoIterator

This commit is contained in:
Michael Goulet 2023-01-03 03:32:59 +00:00
parent 91fd862df0
commit 9b28edb6d7
12 changed files with 74 additions and 65 deletions

View file

@ -2259,25 +2259,23 @@ fn confirm_impl_trait_in_trait_candidate<'tcx>(
tcx.predicates_of(impl_fn_def_id).instantiate(tcx, impl_fn_substs),
&mut obligations,
);
obligations.extend(std::iter::zip(predicates.predicates, predicates.spans).map(
|(pred, span)| {
Obligation::with_depth(
tcx,
ObligationCause::new(
obligation.cause.span,
obligation.cause.body_id,
if span.is_dummy() {
super::ItemObligation(impl_fn_def_id)
} else {
super::BindingObligation(impl_fn_def_id, span)
},
),
obligation.recursion_depth + 1,
obligation.param_env,
pred,
)
},
));
obligations.extend(predicates.into_iter().map(|(pred, span)| {
Obligation::with_depth(
tcx,
ObligationCause::new(
obligation.cause.span,
obligation.cause.body_id,
if span.is_dummy() {
super::ItemObligation(impl_fn_def_id)
} else {
super::BindingObligation(impl_fn_def_id, span)
},
),
obligation.recursion_depth + 1,
obligation.param_env,
pred,
)
}));
let ty = normalize_with_depth_to(
selcx,