Skip to content

Commit

Permalink
Get rid of trait_ref_is_knowable from delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jul 7, 2024
1 parent a982471 commit ab27c2f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
9 changes: 0 additions & 9 deletions compiler/rustc_next_trait_solver/src/delegate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::fmt::Debug;
use std::ops::Deref;

use rustc_type_ir::fold::TypeFoldable;
Expand Down Expand Up @@ -99,14 +98,6 @@ pub trait SolverDelegate:

fn reset_opaque_types(&self);

fn trait_ref_is_knowable<E: Debug>(
&self,
trait_ref: ty::TraitRef<Self::Interner>,
lazily_normalize_ty: impl FnMut(
<Self::Interner as Interner>::Ty,
) -> Result<<Self::Interner as Interner>::Ty, E>,
) -> Result<bool, E>;

fn fetch_eligible_assoc_item(
&self,
param_env: <Self::Interner as Interner>::ParamEnv,
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use rustc_type_ir::{self as ty, CanonicalVarValues, InferCtxtLike, Interner};
use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
use tracing::{instrument, trace};

use crate::coherence;
use crate::delegate::SolverDelegate;
use crate::solve::inspect::{self, ProofTreeBuilder};
use crate::solve::search_graph::SearchGraph;
Expand Down Expand Up @@ -906,7 +907,8 @@ where
) -> Result<bool, NoSolution> {
let delegate = self.delegate;
let lazily_normalize_ty = |ty| self.structurally_normalize_ty(param_env, ty);
delegate.trait_ref_is_knowable(trait_ref, lazily_normalize_ty)
coherence::trait_ref_is_knowable(&**delegate, trait_ref, lazily_normalize_ty)
.map(|is_knowable| is_knowable.is_ok())
}

pub(super) fn fetch_eligible_assoc_item(
Expand Down
10 changes: 0 additions & 10 deletions compiler/rustc_trait_selection/src/solve/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt as _};
use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
use rustc_type_ir::solve::{Certainty, NoSolution, SolverMode};

use crate::traits::coherence::trait_ref_is_knowable;
use crate::traits::specialization_graph;

#[repr(transparent)]
Expand Down Expand Up @@ -200,15 +199,6 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
let _ = self.take_opaque_types();
}

fn trait_ref_is_knowable<E: std::fmt::Debug>(
&self,
trait_ref: ty::TraitRef<'tcx>,
lazily_normalize_ty: impl FnMut(Ty<'tcx>) -> Result<Ty<'tcx>, E>,
) -> Result<bool, E> {
trait_ref_is_knowable(&self.0, trait_ref, lazily_normalize_ty)
.map(|is_knowable| is_knowable.is_ok())
}

fn fetch_eligible_assoc_item(
&self,
param_env: ty::ParamEnv<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_type_ir/src/infer_ctxt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::relate::Relate;
use crate::solve::{Goal, NoSolution, SolverMode};
use crate::{self as ty, Interner};

pub trait InferCtxtLike {
pub trait InferCtxtLike: Sized {
type Interner: Interner;
fn cx(&self) -> Self::Interner;

Expand Down

0 comments on commit ab27c2f

Please sign in to comment.