From 24ea06cbe8e5b735a4807d08da14b5925db896cc Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 19 Jun 2025 21:03:10 +0000 Subject: Apply impl_super_outlives optimization to new trait solver --- compiler/rustc_next_trait_solver/src/solve/trait_goals.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'compiler/rustc_next_trait_solver/src') diff --git a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs index 8ee116b090d..8aaa8e9ca87 100644 --- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs +++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs @@ -103,15 +103,12 @@ where // We currently elaborate all supertrait outlives obligations from impls. // This can be removed when we actually do coinduction correctly, and prove // all supertrait obligations unconditionally. - 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.add_goals( + GoalSource::Misc, + cx.impl_super_outlives(impl_def_id) + .iter_instantiated(cx, impl_args) + .map(|pred| goal.with(cx, pred)), + ); ecx.evaluate_added_goals_and_make_canonical_response(maximal_certainty) }) -- cgit 1.4.1-3-g733a5