1
Fork 0

Enforce supertrait outlives obligations hold when confirming impl

This commit is contained in:
Michael Goulet 2024-07-18 11:37:19 -04:00
parent 9179d9b334
commit 6a891ec4fe
10 changed files with 120 additions and 12 deletions

View file

@ -87,6 +87,19 @@ where
.map(|pred| goal.with(cx, pred));
ecx.add_goals(GoalSource::ImplWhereBound, where_clause_bounds);
// We currently elaborate all supertrait obligations from impls. This
// can be removed when we actually do coinduction correctly and just
// register that the impl header must be WF.
let goal_clause: I::Clause = goal.predicate.upcast(cx);
for clause in elaborate::elaborate(cx, [goal_clause]) {
if matches!(
clause.kind().skip_binder(),
ty::ClauseKind::TypeOutlives(..) | ty::ClauseKind::RegionOutlives(..)
) {
ecx.add_goal(GoalSource::Misc, goal.with(cx, clause));
}
}
ecx.evaluate_added_goals_and_make_canonical_response(maximal_certainty)
})
}