1
Fork 0

Move an extension trait method onto the type directly and reuse it

This commit is contained in:
Oli Scherer 2022-05-10 09:26:09 +00:00
parent 7e2e3d4ebe
commit 704bbe5210
5 changed files with 36 additions and 46 deletions

View file

@ -301,14 +301,10 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
let extend = |traits::PredicateObligation { predicate, mut cause, .. }| {
if let Some(parent_trait_pred) = predicate.to_opt_poly_trait_pred() {
cause.map_code(|parent_code| {
{
traits::ObligationCauseCode::DerivedObligation(
traits::DerivedObligationCause { parent_trait_pred, parent_code },
)
}
.into()
});
cause = cause.derived_cause(
parent_trait_pred,
traits::ObligationCauseCode::DerivedObligation,
);
}
extend_cause_with_original_assoc_item_obligation(
tcx, trait_ref, item, &mut cause, predicate,