Skip to content

Commit

Permalink
Finish uplifting supertraits
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jul 7, 2024
1 parent 66eb346 commit 15d16f1
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
6 changes: 0 additions & 6 deletions compiler/rustc_next_trait_solver/src/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_trait_selection/src/solve/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 _};
Expand Down Expand Up @@ -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>,
Expand Down

0 comments on commit 15d16f1

Please sign in to comment.