diff options
| author | Michael Goulet <michael@errs.io> | 2025-06-19 21:03:10 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-06-19 21:03:50 +0000 |
| commit | 24ea06cbe8e5b735a4807d08da14b5925db896cc (patch) | |
| tree | 9c50a191f0201e612a3d02969a45226bfb13e7e8 /compiler/rustc_next_trait_solver/src | |
| parent | 8de4c7234dd9b97c9d76b58671343fdbbc9a433e (diff) | |
| download | rust-24ea06cbe8e5b735a4807d08da14b5925db896cc.tar.gz rust-24ea06cbe8e5b735a4807d08da14b5925db896cc.zip | |
Apply impl_super_outlives optimization to new trait solver
Diffstat (limited to 'compiler/rustc_next_trait_solver/src')
| -rw-r--r-- | compiler/rustc_next_trait_solver/src/solve/trait_goals.rs | 15 |
1 files changed, 6 insertions, 9 deletions
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) }) |
