Get rid of trait_ref_is_knowable from delegate

This commit is contained in:
Michael Goulet 2024-07-06 18:32:06 -04:00
parent a982471e07
commit ab27c2fa77
4 changed files with 4 additions and 21 deletions

View File

@ -1,4 +1,3 @@
use std::fmt::Debug;
use std::ops::Deref;
use rustc_type_ir::fold::TypeFoldable;
@ -99,14 +98,6 @@ fn inject_new_hidden_type_unchecked(
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,

View File

@ -11,6 +11,7 @@
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;
@ -906,7 +907,8 @@ pub(super) fn trait_ref_is_knowable(
) -> 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(

View File

@ -15,7 +15,6 @@
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)]
@ -200,15 +199,6 @@ fn reset_opaque_types(&self) {
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>,

View File

@ -3,7 +3,7 @@
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;