about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-07-06 12:37:04 -0400
committerMichael Goulet <michael@errs.io>2024-07-07 11:28:01 -0400
commit15d16f1cd6f4daea12c7be4e34ff3b5a776671d2 (patch)
tree31af00f4cefd64a19178544857e47f7511dff3ef
parent66eb346770a97fe96c02a79a740cb151e5232010 (diff)
downloadrust-15d16f1cd6f4daea12c7be4e34ff3b5a776671d2.tar.gz
rust-15d16f1cd6f4daea12c7be4e34ff3b5a776671d2.zip
Finish uplifting supertraits
-rw-r--r--compiler/rustc_next_trait_solver/src/delegate.rs6
-rw-r--r--compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs3
-rw-r--r--compiler/rustc_next_trait_solver/src/solve/trait_goals.rs2
-rw-r--r--compiler/rustc_trait_selection/src/solve/delegate.rs8
4 files changed, 3 insertions, 16 deletions
diff --git a/compiler/rustc_next_trait_solver/src/delegate.rs b/compiler/rustc_next_trait_solver/src/delegate.rs
index 31032dc679a..cdea7363d0e 100644
--- a/compiler/rustc_next_trait_solver/src/delegate.rs
+++ b/compiler/rustc_next_trait_solver/src/delegate.rs
@@ -32,12 +32,6 @@ pub trait SolverDelegate:
     // FIXME: Uplift the leak check into this crate.
     fn leak_check(&self, max_input_universe: ty::UniverseIndex) -> Result<(), NoSolution>;
 
-    // FIXME: This is only here because elaboration lives in `rustc_infer`!
-    fn elaborate_supertraits(
-        cx: Self::Interner,
-        trait_ref: ty::Binder<Self::Interner, ty::TraitRef<Self::Interner>>,
-    ) -> impl Iterator<Item = ty::Binder<Self::Interner, ty::TraitRef<Self::Interner>>>;
-
     fn try_const_eval_resolve(
         &self,
         param_env: <Self::Interner as Interner>::ParamEnv,
diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
index 38a4f7dfe25..01dde9ca587 100644
--- a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
@@ -2,6 +2,7 @@
 
 pub(super) mod structural_traits;
 
+use rustc_type_ir::elaborate;
 use rustc_type_ir::fold::TypeFoldable;
 use rustc_type_ir::inherent::*;
 use rustc_type_ir::lang_items::TraitSolverLangItem;
@@ -667,7 +668,7 @@ where
         // a projection goal.
         if let Some(principal) = bounds.principal() {
             let principal_trait_ref = principal.with_self_ty(cx, self_ty);
-            for (idx, assumption) in D::elaborate_supertraits(cx, principal_trait_ref).enumerate() {
+            for (idx, assumption) in elaborate::supertraits(cx, principal_trait_ref).enumerate() {
                 candidates.extend(G::probe_and_consider_object_bound_candidate(
                     self,
                     CandidateSource::BuiltinImpl(BuiltinImplSource::Object(idx)),
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 f1128f70aaa..4474bbc2351 100644
--- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
@@ -787,7 +787,7 @@ where
             ));
         } else if let Some(a_principal) = a_data.principal() {
             for new_a_principal in
-                D::elaborate_supertraits(self.cx(), a_principal.with_self_ty(cx, a_ty)).skip(1)
+                elaborate::supertraits(self.cx(), a_principal.with_self_ty(cx, a_ty)).skip(1)
             {
                 responses.extend(self.consider_builtin_upcast_to_principal(
                     goal,
diff --git a/compiler/rustc_trait_selection/src/solve/delegate.rs b/compiler/rustc_trait_selection/src/solve/delegate.rs
index f98744e906f..03743e57333 100644
--- a/compiler/rustc_trait_selection/src/solve/delegate.rs
+++ b/compiler/rustc_trait_selection/src/solve/delegate.rs
@@ -8,7 +8,6 @@ use rustc_infer::infer::canonical::{
 };
 use rustc_infer::infer::{InferCtxt, RegionVariableOrigin, TyCtxtInferExt};
 use rustc_infer::traits::solve::Goal;
-use rustc_infer::traits::util::supertraits;
 use rustc_infer::traits::{ObligationCause, Reveal};
 use rustc_middle::ty::fold::TypeFoldable;
 use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt as _};
@@ -82,13 +81,6 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
         self.0.leak_check(max_input_universe, None).map_err(|_| NoSolution)
     }
 
-    fn elaborate_supertraits(
-        interner: TyCtxt<'tcx>,
-        trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
-    ) -> impl Iterator<Item = ty::Binder<'tcx, ty::TraitRef<'tcx>>> {
-        supertraits(interner, trait_ref)
-    }
-
     fn try_const_eval_resolve(
         &self,
         param_env: ty::ParamEnv<'tcx>,