diff options
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve/trait_goals.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/trait_goals.rs | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs index bcb2ea18f78..0aace43f333 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs @@ -2,11 +2,11 @@ use super::assembly::structural_traits::AsyncCallableRelevantTypes; use super::assembly::{self, structural_traits, Candidate}; +use super::infcx::SolverDelegate; use super::{EvalCtxt, GoalSource, SolverMode}; use rustc_data_structures::fx::FxIndexSet; use rustc_hir::def_id::DefId; use rustc_hir::{LangItem, Movability}; -use rustc_infer::infer::InferCtxt; use rustc_infer::traits::query::NoSolution; use rustc_infer::traits::solve::MaybeCause; use rustc_infer::traits::util::supertraits; @@ -37,7 +37,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_impl_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, TraitPredicate<'tcx>>, impl_def_id: DefId, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { @@ -93,7 +93,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_error_guaranteed_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, _guar: ErrorGuaranteed, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { // FIXME: don't need to enter a probe here. @@ -102,11 +102,11 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn probe_and_match_goal_against_assumption( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, source: CandidateSource<'tcx>, goal: Goal<'tcx, Self>, assumption: ty::Clause<'tcx>, - then: impl FnOnce(&mut EvalCtxt<'_, InferCtxt<'tcx>>) -> QueryResult<'tcx>, + then: impl FnOnce(&mut EvalCtxt<'_, SolverDelegate<'tcx>>) -> QueryResult<'tcx>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if let Some(trait_clause) = assumption.as_trait_clause() { if trait_clause.def_id() == goal.predicate.def_id() @@ -130,7 +130,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_auto_trait_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -173,7 +173,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_trait_alias_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -196,7 +196,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_sized_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -211,7 +211,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_copy_clone_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -226,7 +226,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_pointer_like_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -256,7 +256,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_fn_ptr_trait_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { let self_ty = goal.predicate.self_ty(); @@ -287,7 +287,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_fn_trait_candidates( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, goal_kind: ty::ClosureKind, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { @@ -328,7 +328,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_async_fn_trait_candidates( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, goal_kind: ty::ClosureKind, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { @@ -379,7 +379,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_async_fn_kind_helper_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { let [closure_fn_kind_ty, goal_kind_ty] = **goal.predicate.trait_ref.args else { @@ -406,7 +406,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { /// impl Tuple for (T1, .., Tn) {} /// ``` fn consider_builtin_tuple_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -422,7 +422,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_pointee_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -434,7 +434,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_future_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -460,7 +460,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_iterator_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -486,7 +486,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_fused_iterator_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -510,7 +510,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_async_iterator_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -536,7 +536,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_coroutine_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -568,7 +568,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_discriminant_kind_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -581,7 +581,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_async_destruct_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -594,7 +594,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_destruct_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -610,7 +610,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } fn consider_builtin_transmute_candidate( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -651,7 +651,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { /// impl<'a, T: Trait + 'a> Unsize<dyn Trait + 'a> for T {} /// ``` fn consider_structural_builtin_unsize_candidates( - ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, goal: Goal<'tcx, Self>, ) -> Vec<Candidate<TyCtxt<'tcx>>> { if goal.predicate.polarity != ty::PredicatePolarity::Positive { @@ -722,7 +722,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { } } -impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> { +impl<'tcx> EvalCtxt<'_, SolverDelegate<'tcx>> { /// Trait upcasting allows for coercions between trait objects: /// ```ignore (builtin impl example) /// trait Super {} @@ -841,7 +841,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> { // having any inference side-effects. We process obligations because // unification may initially succeed due to deferred projection equality. let projection_may_match = - |ecx: &mut EvalCtxt<'_, InferCtxt<'tcx>>, + |ecx: &mut EvalCtxt<'_, SolverDelegate<'tcx>>, source_projection: ty::PolyExistentialProjection<'tcx>, target_projection: ty::PolyExistentialProjection<'tcx>| { source_projection.item_def_id() == target_projection.item_def_id() @@ -1147,7 +1147,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> { source: CandidateSource<'tcx>, goal: Goal<'tcx, TraitPredicate<'tcx>>, constituent_tys: impl Fn( - &EvalCtxt<'_, InferCtxt<'tcx>>, + &EvalCtxt<'_, SolverDelegate<'tcx>>, Ty<'tcx>, ) -> Result<Vec<ty::Binder<'tcx, Ty<'tcx>>>, NoSolution>, ) -> Result<Candidate<TyCtxt<'tcx>>, NoSolution> { |
