Skip to content

Commit 6bbfb44

Browse files
committed
more tpying mode
1 parent a3eb453 commit 6bbfb44

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

compiler/rustc_next_trait_solver/src/delegate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ pub trait SolverDelegate: Deref<Target = <Self as SolverDelegate>::Infcx> + Size
9292

9393
fn fetch_eligible_assoc_item(
9494
&self,
95-
param_env: <Self::Interner as Interner>::ParamEnv,
9695
goal_trait_ref: ty::TraitRef<Self::Interner>,
9796
trait_assoc_def_id: <Self::Interner as Interner>::DefId,
9897
impl_def_id: <Self::Interner as Interner>::DefId,

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -938,17 +938,11 @@ where
938938

939939
pub(super) fn fetch_eligible_assoc_item(
940940
&self,
941-
param_env: I::ParamEnv,
942941
goal_trait_ref: ty::TraitRef<I>,
943942
trait_assoc_def_id: I::DefId,
944943
impl_def_id: I::DefId,
945944
) -> Result<Option<I::DefId>, NoSolution> {
946-
self.delegate.fetch_eligible_assoc_item(
947-
param_env,
948-
goal_trait_ref,
949-
trait_assoc_def_id,
950-
impl_def_id,
951-
)
945+
self.delegate.fetch_eligible_assoc_item(goal_trait_ref, trait_assoc_def_id, impl_def_id)
952946
}
953947

954948
pub(super) fn insert_hidden_type(

compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ where
244244
// return ambiguity this would otherwise be incomplete, resulting in
245245
// unsoundness during coherence (#105782).
246246
let Some(target_item_def_id) = ecx.fetch_eligible_assoc_item(
247-
goal.param_env,
248247
goal_trait_ref,
249248
goal.predicate.def_id(),
250249
impl_def_id,

compiler/rustc_trait_selection/src/solve/delegate.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use rustc_infer::infer::canonical::{
77
Canonical, CanonicalExt as _, CanonicalQueryInput, CanonicalVarInfo, CanonicalVarValues,
88
};
99
use rustc_infer::infer::{InferCtxt, RegionVariableOrigin, TyCtxtInferExt};
10+
use rustc_infer::traits::ObligationCause;
1011
use rustc_infer::traits::solve::Goal;
11-
use rustc_infer::traits::{ObligationCause, Reveal};
1212
use rustc_middle::ty::fold::TypeFoldable;
1313
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt as _};
1414
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
15+
use rustc_type_ir::TypingMode;
1516
use rustc_type_ir::solve::{Certainty, NoSolution};
16-
use tracing::trace;
1717

1818
use crate::traits::specialization_graph;
1919

@@ -190,7 +190,6 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
190190

191191
fn fetch_eligible_assoc_item(
192192
&self,
193-
param_env: ty::ParamEnv<'tcx>,
194193
goal_trait_ref: ty::TraitRef<'tcx>,
195194
trait_assoc_def_id: DefId,
196195
impl_def_id: DefId,
@@ -206,12 +205,12 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
206205
// and the obligation is monomorphic, otherwise passes such as
207206
// transmute checking and polymorphic MIR optimizations could
208207
// get a result which isn't correct for all monomorphizations.
209-
if param_env.reveal() == Reveal::All {
210-
let poly_trait_ref = self.resolve_vars_if_possible(goal_trait_ref);
211-
!poly_trait_ref.still_further_specializable()
212-
} else {
213-
trace!(?node_item.item.def_id, "not eligible due to default");
214-
false
208+
match self.typing_mode() {
209+
TypingMode::Coherence | TypingMode::Analysis { .. } => false,
210+
TypingMode::PostAnalysis => {
211+
let poly_trait_ref = self.resolve_vars_if_possible(goal_trait_ref);
212+
!poly_trait_ref.still_further_specializable()
213+
}
215214
}
216215
};
217216

0 commit comments

Comments
 (0)