TraitObligation -> PolyTraitObligation
This commit is contained in:
parent
c4c84df3b3
commit
36453456cb
7 changed files with 70 additions and 70 deletions
|
@ -62,7 +62,7 @@ impl<'tcx, P> From<Obligation<'tcx, P>> for solve::Goal<'tcx, P> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>;
|
pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>;
|
||||||
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
|
pub type PolyTraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
|
||||||
|
|
||||||
impl<'tcx> PredicateObligation<'tcx> {
|
impl<'tcx> PredicateObligation<'tcx> {
|
||||||
/// Flips the polarity of the inner predicate.
|
/// Flips the polarity of the inner predicate.
|
||||||
|
@ -86,7 +86,7 @@ impl<'tcx> PredicateObligation<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TraitObligation<'tcx> {
|
impl<'tcx> PolyTraitObligation<'tcx> {
|
||||||
/// Returns `true` if the trait predicate is considered `const` in its ParamEnv.
|
/// Returns `true` if the trait predicate is considered `const` in its ParamEnv.
|
||||||
pub fn is_const(&self) -> bool {
|
pub fn is_const(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
|
@ -193,7 +193,7 @@ impl<'tcx> FulfillmentError<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TraitObligation<'tcx> {
|
impl<'tcx> PolyTraitObligation<'tcx> {
|
||||||
pub fn polarity(&self) -> ty::ImplPolarity {
|
pub fn polarity(&self) -> ty::ImplPolarity {
|
||||||
self.predicate.skip_binder().polarity
|
self.predicate.skip_binder().polarity
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ use rustc_hir::def_id::DefId;
|
||||||
use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk};
|
use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk};
|
||||||
use rustc_infer::traits::util::supertraits;
|
use rustc_infer::traits::util::supertraits;
|
||||||
use rustc_infer::traits::{
|
use rustc_infer::traits::{
|
||||||
Obligation, PredicateObligation, Selection, SelectionResult, TraitObligation,
|
Obligation, PredicateObligation, Selection, SelectionResult, PolyTraitObligation,
|
||||||
};
|
};
|
||||||
use rustc_middle::traits::solve::{CanonicalInput, Certainty, Goal};
|
use rustc_middle::traits::solve::{CanonicalInput, Certainty, Goal};
|
||||||
use rustc_middle::traits::{
|
use rustc_middle::traits::{
|
||||||
|
@ -23,14 +23,14 @@ use crate::traits::vtable::{count_own_vtable_entries, prepare_vtable_segments, V
|
||||||
pub trait InferCtxtSelectExt<'tcx> {
|
pub trait InferCtxtSelectExt<'tcx> {
|
||||||
fn select_in_new_trait_solver(
|
fn select_in_new_trait_solver(
|
||||||
&self,
|
&self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> SelectionResult<'tcx, Selection<'tcx>>;
|
) -> SelectionResult<'tcx, Selection<'tcx>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> InferCtxtSelectExt<'tcx> for InferCtxt<'tcx> {
|
impl<'tcx> InferCtxtSelectExt<'tcx> for InferCtxt<'tcx> {
|
||||||
fn select_in_new_trait_solver(
|
fn select_in_new_trait_solver(
|
||||||
&self,
|
&self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> SelectionResult<'tcx, Selection<'tcx>> {
|
) -> SelectionResult<'tcx, Selection<'tcx>> {
|
||||||
assert!(self.next_trait_solver());
|
assert!(self.next_trait_solver());
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_infer::infer::{InferCtxt, LateBoundRegionConversionTime};
|
use rustc_infer::infer::{InferCtxt, LateBoundRegionConversionTime};
|
||||||
use rustc_infer::traits::util::elaborate;
|
use rustc_infer::traits::util::elaborate;
|
||||||
use rustc_infer::traits::{Obligation, ObligationCause, TraitObligation};
|
use rustc_infer::traits::{Obligation, ObligationCause, PolyTraitObligation};
|
||||||
use rustc_middle::ty;
|
use rustc_middle::ty;
|
||||||
use rustc_span::{Span, DUMMY_SP};
|
use rustc_span::{Span, DUMMY_SP};
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ pub enum Ambiguity {
|
||||||
|
|
||||||
pub fn recompute_applicable_impls<'tcx>(
|
pub fn recompute_applicable_impls<'tcx>(
|
||||||
infcx: &InferCtxt<'tcx>,
|
infcx: &InferCtxt<'tcx>,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Vec<Ambiguity> {
|
) -> Vec<Ambiguity> {
|
||||||
let tcx = infcx.tcx;
|
let tcx = infcx.tcx;
|
||||||
let param_env = obligation.param_env;
|
let param_env = obligation.param_env;
|
||||||
|
|
|
@ -4,7 +4,7 @@ use rustc_data_structures::obligation_forest::{Error, ForestObligation, Outcome}
|
||||||
use rustc_data_structures::obligation_forest::{ObligationForest, ObligationProcessor};
|
use rustc_data_structures::obligation_forest::{ObligationForest, ObligationProcessor};
|
||||||
use rustc_infer::infer::DefineOpaqueTypes;
|
use rustc_infer::infer::DefineOpaqueTypes;
|
||||||
use rustc_infer::traits::ProjectionCacheKey;
|
use rustc_infer::traits::ProjectionCacheKey;
|
||||||
use rustc_infer::traits::{SelectionError, TraitEngine, TraitObligation};
|
use rustc_infer::traits::{SelectionError, TraitEngine, PolyTraitObligation};
|
||||||
use rustc_middle::mir::interpret::ErrorHandled;
|
use rustc_middle::mir::interpret::ErrorHandled;
|
||||||
use rustc_middle::ty::abstract_const::NotConstEvaluatable;
|
use rustc_middle::ty::abstract_const::NotConstEvaluatable;
|
||||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||||
|
@ -667,7 +667,7 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
|
||||||
fn process_trait_obligation(
|
fn process_trait_obligation(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &PredicateObligation<'tcx>,
|
obligation: &PredicateObligation<'tcx>,
|
||||||
trait_obligation: TraitObligation<'tcx>,
|
trait_obligation: PolyTraitObligation<'tcx>,
|
||||||
stalled_on: &mut Vec<TyOrConstInferVar<'tcx>>,
|
stalled_on: &mut Vec<TyOrConstInferVar<'tcx>>,
|
||||||
) -> ProcessResult<PendingPredicateObligation<'tcx>, FulfillmentErrorCode<'tcx>> {
|
) -> ProcessResult<PendingPredicateObligation<'tcx>, FulfillmentErrorCode<'tcx>> {
|
||||||
let infcx = self.selcx.infcx;
|
let infcx = self.selcx.infcx;
|
||||||
|
|
|
@ -10,7 +10,7 @@ use hir::def_id::DefId;
|
||||||
use hir::LangItem;
|
use hir::LangItem;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_infer::traits::ObligationCause;
|
use rustc_infer::traits::ObligationCause;
|
||||||
use rustc_infer::traits::{Obligation, SelectionError, TraitObligation};
|
use rustc_infer::traits::{Obligation, SelectionError, PolyTraitObligation};
|
||||||
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
|
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
|
||||||
use rustc_middle::ty::{self, Ty, TypeVisitableExt};
|
use rustc_middle::ty::{self, Ty, TypeVisitableExt};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use crate::traits::util;
|
||||||
|
|
||||||
use super::BuiltinImplConditions;
|
use super::BuiltinImplConditions;
|
||||||
use super::SelectionCandidate::*;
|
use super::SelectionCandidate::*;
|
||||||
use super::{SelectionCandidateSet, SelectionContext, TraitObligationStack};
|
use super::{SelectionCandidateSet, SelectionContext, PolyTraitObligationStack};
|
||||||
|
|
||||||
impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(skip(self, stack), level = "debug")]
|
#[instrument(skip(self, stack), level = "debug")]
|
||||||
|
@ -137,7 +137,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self, candidates))]
|
#[instrument(level = "debug", skip(self, candidates))]
|
||||||
fn assemble_candidates_from_projected_tys(
|
fn assemble_candidates_from_projected_tys(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
// Before we go into the whole placeholder thing, just
|
// Before we go into the whole placeholder thing, just
|
||||||
|
@ -206,7 +206,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn assemble_generator_candidates(
|
fn assemble_generator_candidates(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
// Okay to skip binder because the substs on generator types never
|
// Okay to skip binder because the substs on generator types never
|
||||||
|
@ -231,7 +231,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn assemble_future_candidates(
|
fn assemble_future_candidates(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
let self_ty = obligation.self_ty().skip_binder();
|
let self_ty = obligation.self_ty().skip_binder();
|
||||||
|
@ -254,7 +254,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
/// unified during the confirmation step.
|
/// unified during the confirmation step.
|
||||||
fn assemble_closure_candidates(
|
fn assemble_closure_candidates(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
let Some(kind) = self.tcx().fn_trait_kind_from_def_id(obligation.predicate.def_id()) else {
|
let Some(kind) = self.tcx().fn_trait_kind_from_def_id(obligation.predicate.def_id()) else {
|
||||||
|
@ -292,7 +292,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
/// Implements one of the `Fn()` family for a fn pointer.
|
/// Implements one of the `Fn()` family for a fn pointer.
|
||||||
fn assemble_fn_pointer_candidates(
|
fn assemble_fn_pointer_candidates(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
// We provide impl of all fn traits for fn pointers.
|
// We provide impl of all fn traits for fn pointers.
|
||||||
|
@ -334,7 +334,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self, candidates))]
|
#[instrument(level = "debug", skip(self, candidates))]
|
||||||
fn assemble_candidates_from_impls(
|
fn assemble_candidates_from_impls(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
// Essentially any user-written impl will match with an error type,
|
// Essentially any user-written impl will match with an error type,
|
||||||
|
@ -390,7 +390,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
fn reject_fn_ptr_impls(
|
fn reject_fn_ptr_impls(
|
||||||
&mut self,
|
&mut self,
|
||||||
impl_def_id: DefId,
|
impl_def_id: DefId,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
impl_self_ty: Ty<'tcx>,
|
impl_self_ty: Ty<'tcx>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
// Let `impl<T: FnPtr> Trait for Vec<T>` go through the normal rejection path.
|
// Let `impl<T: FnPtr> Trait for Vec<T>` go through the normal rejection path.
|
||||||
|
@ -475,7 +475,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn assemble_candidates_from_auto_impls(
|
fn assemble_candidates_from_auto_impls(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
// Okay to skip binder here because the tests we do below do not involve bound regions.
|
// Okay to skip binder here because the tests we do below do not involve bound regions.
|
||||||
|
@ -544,7 +544,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
/// Searches for impls that might apply to `obligation`.
|
/// Searches for impls that might apply to `obligation`.
|
||||||
fn assemble_candidates_from_object_ty(
|
fn assemble_candidates_from_object_ty(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
debug!(
|
debug!(
|
||||||
|
@ -668,7 +668,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
/// Searches for unsizing that might apply to `obligation`.
|
/// Searches for unsizing that might apply to `obligation`.
|
||||||
fn assemble_candidates_for_unsizing(
|
fn assemble_candidates_for_unsizing(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
// We currently never consider higher-ranked obligations e.g.
|
// We currently never consider higher-ranked obligations e.g.
|
||||||
|
@ -782,7 +782,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self, obligation, candidates))]
|
#[instrument(level = "debug", skip(self, obligation, candidates))]
|
||||||
fn assemble_candidates_for_transmutability(
|
fn assemble_candidates_for_transmutability(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
if obligation.predicate.has_non_region_param() {
|
if obligation.predicate.has_non_region_param() {
|
||||||
|
@ -800,7 +800,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self, obligation, candidates))]
|
#[instrument(level = "debug", skip(self, obligation, candidates))]
|
||||||
fn assemble_candidates_for_trait_alias(
|
fn assemble_candidates_for_trait_alias(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
// Okay to skip binder here because the tests we do below do not involve bound regions.
|
// Okay to skip binder here because the tests we do below do not involve bound regions.
|
||||||
|
@ -837,7 +837,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn assemble_const_destruct_candidates(
|
fn assemble_const_destruct_candidates(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
// If the predicate is `~const Destruct` in a non-const environment, we don't actually need
|
// If the predicate is `~const Destruct` in a non-const environment, we don't actually need
|
||||||
|
@ -924,7 +924,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn assemble_candidate_for_tuple(
|
fn assemble_candidate_for_tuple(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder());
|
let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder());
|
||||||
|
@ -966,7 +966,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn assemble_candidate_for_pointer_like(
|
fn assemble_candidate_for_pointer_like(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
// The regions of a type don't affect the size of the type
|
// The regions of a type don't affect the size of the type
|
||||||
|
@ -991,7 +991,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn assemble_candidates_for_fn_ptr_trait(
|
fn assemble_candidates_for_fn_ptr_trait(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) {
|
) {
|
||||||
let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
|
let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
|
||||||
|
|
|
@ -28,7 +28,7 @@ use crate::traits::{
|
||||||
BuiltinDerivedObligation, ImplDerivedObligation, ImplDerivedObligationCause, ImplSource,
|
BuiltinDerivedObligation, ImplDerivedObligation, ImplDerivedObligationCause, ImplSource,
|
||||||
ImplSourceObjectData, ImplSourceTraitUpcastingData, ImplSourceUserDefinedData, Normalized,
|
ImplSourceObjectData, ImplSourceTraitUpcastingData, ImplSourceUserDefinedData, Normalized,
|
||||||
Obligation, ObligationCause, OutputTypeParameterMismatch, PredicateObligation, Selection,
|
Obligation, ObligationCause, OutputTypeParameterMismatch, PredicateObligation, Selection,
|
||||||
SelectionError, TraitNotObjectSafe, TraitObligation, Unimplemented,
|
SelectionError, TraitNotObjectSafe, PolyTraitObligation, Unimplemented,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::BuiltinImplConditions;
|
use super::BuiltinImplConditions;
|
||||||
|
@ -42,7 +42,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
pub(super) fn confirm_candidate(
|
pub(super) fn confirm_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
candidate: SelectionCandidate<'tcx>,
|
candidate: SelectionCandidate<'tcx>,
|
||||||
) -> Result<Selection<'tcx>, SelectionError<'tcx>> {
|
) -> Result<Selection<'tcx>, SelectionError<'tcx>> {
|
||||||
let mut impl_src = match candidate {
|
let mut impl_src = match candidate {
|
||||||
|
@ -148,7 +148,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_projection_candidate(
|
fn confirm_projection_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
idx: usize,
|
idx: usize,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
|
@ -215,7 +215,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_param_candidate(
|
fn confirm_param_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
param: ty::PolyTraitRef<'tcx>,
|
param: ty::PolyTraitRef<'tcx>,
|
||||||
) -> Vec<PredicateObligation<'tcx>> {
|
) -> Vec<PredicateObligation<'tcx>> {
|
||||||
debug!(?obligation, ?param, "confirm_param_candidate");
|
debug!(?obligation, ?param, "confirm_param_candidate");
|
||||||
|
@ -238,7 +238,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_builtin_candidate(
|
fn confirm_builtin_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
has_nested: bool,
|
has_nested: bool,
|
||||||
) -> Vec<PredicateObligation<'tcx>> {
|
) -> Vec<PredicateObligation<'tcx>> {
|
||||||
debug!(?obligation, ?has_nested, "confirm_builtin_candidate");
|
debug!(?obligation, ?has_nested, "confirm_builtin_candidate");
|
||||||
|
@ -279,13 +279,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
fn confirm_transmutability_candidate(
|
fn confirm_transmutability_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
use rustc_transmute::{Answer, Condition};
|
use rustc_transmute::{Answer, Condition};
|
||||||
#[instrument(level = "debug", skip(tcx, obligation, predicate))]
|
#[instrument(level = "debug", skip(tcx, obligation, predicate))]
|
||||||
fn flatten_answer_tree<'tcx>(
|
fn flatten_answer_tree<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
predicate: TraitPredicate<'tcx>,
|
predicate: TraitPredicate<'tcx>,
|
||||||
cond: Condition<rustc_transmute::layout::rustc::Ref<'tcx>>,
|
cond: Condition<rustc_transmute::layout::rustc::Ref<'tcx>>,
|
||||||
) -> Vec<PredicateObligation<'tcx>> {
|
) -> Vec<PredicateObligation<'tcx>> {
|
||||||
|
@ -375,7 +375,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
/// 2. For each where-clause `C` declared on `Foo`, `[Self => X] C` holds.
|
/// 2. For each where-clause `C` declared on `Foo`, `[Self => X] C` holds.
|
||||||
fn confirm_auto_impl_candidate(
|
fn confirm_auto_impl_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
debug!(?obligation, "confirm_auto_impl_candidate");
|
debug!(?obligation, "confirm_auto_impl_candidate");
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
/// See `confirm_auto_impl_candidate`.
|
/// See `confirm_auto_impl_candidate`.
|
||||||
fn vtable_auto_impl(
|
fn vtable_auto_impl(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
trait_def_id: DefId,
|
trait_def_id: DefId,
|
||||||
nested: ty::Binder<'tcx, Vec<Ty<'tcx>>>,
|
nested: ty::Binder<'tcx, Vec<Ty<'tcx>>>,
|
||||||
) -> Vec<PredicateObligation<'tcx>> {
|
) -> Vec<PredicateObligation<'tcx>> {
|
||||||
|
@ -426,7 +426,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_impl_candidate(
|
fn confirm_impl_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
impl_def_id: DefId,
|
impl_def_id: DefId,
|
||||||
) -> ImplSourceUserDefinedData<'tcx, PredicateObligation<'tcx>> {
|
) -> ImplSourceUserDefinedData<'tcx, PredicateObligation<'tcx>> {
|
||||||
debug!(?obligation, ?impl_def_id, "confirm_impl_candidate");
|
debug!(?obligation, ?impl_def_id, "confirm_impl_candidate");
|
||||||
|
@ -481,7 +481,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_object_candidate(
|
fn confirm_object_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
index: usize,
|
index: usize,
|
||||||
) -> Result<ImplSourceObjectData<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<ImplSourceObjectData<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
|
@ -655,7 +655,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_fn_pointer_candidate(
|
fn confirm_fn_pointer_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
is_const: bool,
|
is_const: bool,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
debug!(?obligation, "confirm_fn_pointer_candidate");
|
debug!(?obligation, "confirm_fn_pointer_candidate");
|
||||||
|
@ -714,7 +714,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_trait_alias_candidate(
|
fn confirm_trait_alias_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Vec<PredicateObligation<'tcx>> {
|
) -> Vec<PredicateObligation<'tcx>> {
|
||||||
debug!(?obligation, "confirm_trait_alias_candidate");
|
debug!(?obligation, "confirm_trait_alias_candidate");
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_generator_candidate(
|
fn confirm_generator_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
// Okay to skip binder because the substs on generator types never
|
// Okay to skip binder because the substs on generator types never
|
||||||
// touch bound regions, they just capture the in-scope
|
// touch bound regions, they just capture the in-scope
|
||||||
|
@ -778,7 +778,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_future_candidate(
|
fn confirm_future_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
// Okay to skip binder because the substs on generator types never
|
// Okay to skip binder because the substs on generator types never
|
||||||
// touch bound regions, they just capture the in-scope
|
// touch bound regions, they just capture the in-scope
|
||||||
|
@ -809,7 +809,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug")]
|
||||||
fn confirm_closure_candidate(
|
fn confirm_closure_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
let kind = self
|
let kind = self
|
||||||
.tcx()
|
.tcx()
|
||||||
|
@ -865,7 +865,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(skip(self), level = "trace")]
|
#[instrument(skip(self), level = "trace")]
|
||||||
fn confirm_poly_trait_refs(
|
fn confirm_poly_trait_refs(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
self_ty_trait_ref: ty::PolyTraitRef<'tcx>,
|
self_ty_trait_ref: ty::PolyTraitRef<'tcx>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
let obligation_trait_ref = obligation.predicate.to_poly_trait_ref();
|
let obligation_trait_ref = obligation.predicate.to_poly_trait_ref();
|
||||||
|
@ -900,7 +900,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_trait_upcasting_unsize_candidate(
|
fn confirm_trait_upcasting_unsize_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
idx: usize,
|
idx: usize,
|
||||||
) -> Result<ImplSourceTraitUpcastingData<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<ImplSourceTraitUpcastingData<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
|
@ -1004,7 +1004,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_builtin_unsize_candidate(
|
fn confirm_builtin_unsize_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
|
|
||||||
|
@ -1213,7 +1213,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn confirm_const_destruct_candidate(
|
fn confirm_const_destruct_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
impl_def_id: Option<DefId>,
|
impl_def_id: Option<DefId>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
|
||||||
// `~const Destruct` in a non-const environment is always trivially true, since our type is `Drop`
|
// `~const Destruct` in a non-const environment is always trivially true, since our type is `Drop`
|
||||||
|
|
|
@ -16,7 +16,7 @@ use super::wf;
|
||||||
use super::{
|
use super::{
|
||||||
ErrorReporting, ImplDerivedObligation, ImplDerivedObligationCause, Normalized, Obligation,
|
ErrorReporting, ImplDerivedObligation, ImplDerivedObligationCause, Normalized, Obligation,
|
||||||
ObligationCause, ObligationCauseCode, Overflow, PredicateObligation, Selection, SelectionError,
|
ObligationCause, ObligationCauseCode, Overflow, PredicateObligation, Selection, SelectionError,
|
||||||
SelectionResult, TraitObligation, TraitQueryMode,
|
SelectionResult, PolyTraitObligation, TraitQueryMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::infer::{InferCtxt, InferOk, TypeFreshener};
|
use crate::infer::{InferCtxt, InferOk, TypeFreshener};
|
||||||
|
@ -122,7 +122,7 @@ pub struct SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
// A stack that walks back up the stack frame.
|
// A stack that walks back up the stack frame.
|
||||||
struct TraitObligationStack<'prev, 'tcx> {
|
struct TraitObligationStack<'prev, 'tcx> {
|
||||||
obligation: &'prev TraitObligation<'tcx>,
|
obligation: &'prev PolyTraitObligation<'tcx>,
|
||||||
|
|
||||||
/// The trait predicate from `obligation` but "freshened" with the
|
/// The trait predicate from `obligation` but "freshened" with the
|
||||||
/// selection-context's freshener. Used to check for recursion.
|
/// selection-context's freshener. Used to check for recursion.
|
||||||
|
@ -261,7 +261,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self), ret)]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
pub fn select(
|
pub fn select(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> SelectionResult<'tcx, Selection<'tcx>> {
|
) -> SelectionResult<'tcx, Selection<'tcx>> {
|
||||||
if self.infcx.next_trait_solver() {
|
if self.infcx.next_trait_solver() {
|
||||||
return self.infcx.select_in_new_trait_solver(obligation);
|
return self.infcx.select_in_new_trait_solver(obligation);
|
||||||
|
@ -295,7 +295,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
fn select_from_obligation(
|
fn select_from_obligation(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> SelectionResult<'tcx, SelectionCandidate<'tcx>> {
|
) -> SelectionResult<'tcx, SelectionCandidate<'tcx>> {
|
||||||
debug_assert!(!obligation.predicate.has_escaping_bound_vars());
|
debug_assert!(!obligation.predicate.has_escaping_bound_vars());
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
obligation: PredicateObligation<'tcx>,
|
obligation: PredicateObligation<'tcx>,
|
||||||
) -> Result<EvaluationResult, OverflowError> {
|
) -> Result<EvaluationResult, OverflowError> {
|
||||||
debug_assert!(!self.infcx.next_trait_solver());
|
debug_assert!(!self.infcx.next_trait_solver());
|
||||||
// `previous_stack` stores a `TraitObligation`, while `obligation` is
|
// `previous_stack` stores a `PolyTraitObligation`, while `obligation` is
|
||||||
// a `PredicateObligation`. These are distinct types, so we can't
|
// a `PredicateObligation`. These are distinct types, so we can't
|
||||||
// use any `Option` combinator method that would force them to be
|
// use any `Option` combinator method that would force them to be
|
||||||
// the same.
|
// the same.
|
||||||
|
@ -973,7 +973,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
fn evaluate_trait_predicate_recursively<'o>(
|
fn evaluate_trait_predicate_recursively<'o>(
|
||||||
&mut self,
|
&mut self,
|
||||||
previous_stack: TraitObligationStackList<'o, 'tcx>,
|
previous_stack: TraitObligationStackList<'o, 'tcx>,
|
||||||
mut obligation: TraitObligation<'tcx>,
|
mut obligation: PolyTraitObligation<'tcx>,
|
||||||
) -> Result<EvaluationResult, OverflowError> {
|
) -> Result<EvaluationResult, OverflowError> {
|
||||||
if !self.is_intercrate()
|
if !self.is_intercrate()
|
||||||
&& obligation.is_global()
|
&& obligation.is_global()
|
||||||
|
@ -1379,7 +1379,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
fn filter_impls(
|
fn filter_impls(
|
||||||
&mut self,
|
&mut self,
|
||||||
candidates: Vec<SelectionCandidate<'tcx>>,
|
candidates: Vec<SelectionCandidate<'tcx>>,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Vec<SelectionCandidate<'tcx>> {
|
) -> Vec<SelectionCandidate<'tcx>> {
|
||||||
trace!("{candidates:#?}");
|
trace!("{candidates:#?}");
|
||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
|
@ -1442,7 +1442,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
fn filter_reservation_impls(
|
fn filter_reservation_impls(
|
||||||
&mut self,
|
&mut self,
|
||||||
candidate: SelectionCandidate<'tcx>,
|
candidate: SelectionCandidate<'tcx>,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> SelectionResult<'tcx, SelectionCandidate<'tcx>> {
|
) -> SelectionResult<'tcx, SelectionCandidate<'tcx>> {
|
||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
// Treat reservation impls as ambiguity.
|
// Treat reservation impls as ambiguity.
|
||||||
|
@ -1471,7 +1471,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
Ok(Some(candidate))
|
Ok(Some(candidate))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_knowable<'o>(&mut self, stack: &TraitObligationStack<'o, 'tcx>) -> Result<(), Conflict> {
|
fn is_knowable<'o>(&mut self, stack: &PolyTraitObligationStack<'o, 'tcx>) -> Result<(), Conflict> {
|
||||||
debug!("is_knowable(intercrate={:?})", self.is_intercrate());
|
debug!("is_knowable(intercrate={:?})", self.is_intercrate());
|
||||||
|
|
||||||
if !self.is_intercrate() || stack.obligation.polarity() == ty::ImplPolarity::Negative {
|
if !self.is_intercrate() || stack.obligation.polarity() == ty::ImplPolarity::Negative {
|
||||||
|
@ -1614,7 +1614,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self), ret)]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
fn match_projection_obligation_against_definition_bounds(
|
fn match_projection_obligation_against_definition_bounds(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> smallvec::SmallVec<[(usize, ty::BoundConstness); 2]> {
|
) -> smallvec::SmallVec<[(usize, ty::BoundConstness); 2]> {
|
||||||
let poly_trait_predicate = self.infcx.resolve_vars_if_possible(obligation.predicate);
|
let poly_trait_predicate = self.infcx.resolve_vars_if_possible(obligation.predicate);
|
||||||
let placeholder_trait_predicate =
|
let placeholder_trait_predicate =
|
||||||
|
@ -1677,7 +1677,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
/// variables or placeholders, the normalized bound is returned.
|
/// variables or placeholders, the normalized bound is returned.
|
||||||
fn match_normalize_trait_ref(
|
fn match_normalize_trait_ref(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
trait_bound: ty::PolyTraitRef<'tcx>,
|
trait_bound: ty::PolyTraitRef<'tcx>,
|
||||||
placeholder_trait_ref: ty::TraitRef<'tcx>,
|
placeholder_trait_ref: ty::TraitRef<'tcx>,
|
||||||
) -> Result<Option<ty::PolyTraitRef<'tcx>>, ()> {
|
) -> Result<Option<ty::PolyTraitRef<'tcx>>, ()> {
|
||||||
|
@ -2078,7 +2078,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
impl<'tcx> SelectionContext<'_, 'tcx> {
|
impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
fn sized_conditions(
|
fn sized_conditions(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> BuiltinImplConditions<'tcx> {
|
) -> BuiltinImplConditions<'tcx> {
|
||||||
use self::BuiltinImplConditions::{Ambiguous, None, Where};
|
use self::BuiltinImplConditions::{Ambiguous, None, Where};
|
||||||
|
|
||||||
|
@ -2138,7 +2138,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
|
|
||||||
fn copy_clone_conditions(
|
fn copy_clone_conditions(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> BuiltinImplConditions<'tcx> {
|
) -> BuiltinImplConditions<'tcx> {
|
||||||
// NOTE: binder moved to (*)
|
// NOTE: binder moved to (*)
|
||||||
let self_ty = self.infcx.shallow_resolve(obligation.predicate.skip_binder().self_ty());
|
let self_ty = self.infcx.shallow_resolve(obligation.predicate.skip_binder().self_ty());
|
||||||
|
@ -2414,7 +2414,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
fn rematch_impl(
|
fn rematch_impl(
|
||||||
&mut self,
|
&mut self,
|
||||||
impl_def_id: DefId,
|
impl_def_id: DefId,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Normalized<'tcx, SubstsRef<'tcx>> {
|
) -> Normalized<'tcx, SubstsRef<'tcx>> {
|
||||||
let impl_trait_ref = self.tcx().impl_trait_ref(impl_def_id).unwrap();
|
let impl_trait_ref = self.tcx().impl_trait_ref(impl_def_id).unwrap();
|
||||||
match self.match_impl(impl_def_id, impl_trait_ref, obligation) {
|
match self.match_impl(impl_def_id, impl_trait_ref, obligation) {
|
||||||
|
@ -2452,7 +2452,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
&mut self,
|
&mut self,
|
||||||
impl_def_id: DefId,
|
impl_def_id: DefId,
|
||||||
impl_trait_ref: EarlyBinder<ty::TraitRef<'tcx>>,
|
impl_trait_ref: EarlyBinder<ty::TraitRef<'tcx>>,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
) -> Result<Normalized<'tcx, SubstsRef<'tcx>>, ()> {
|
) -> Result<Normalized<'tcx, SubstsRef<'tcx>>, ()> {
|
||||||
let placeholder_obligation =
|
let placeholder_obligation =
|
||||||
self.infcx.instantiate_binder_with_placeholders(obligation.predicate);
|
self.infcx.instantiate_binder_with_placeholders(obligation.predicate);
|
||||||
|
@ -2510,7 +2510,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
/// result from the normalization.
|
/// result from the normalization.
|
||||||
fn match_where_clause_trait_ref(
|
fn match_where_clause_trait_ref(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
where_clause_trait_ref: ty::PolyTraitRef<'tcx>,
|
where_clause_trait_ref: ty::PolyTraitRef<'tcx>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, ()> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, ()> {
|
||||||
self.match_poly_trait_ref(obligation, where_clause_trait_ref)
|
self.match_poly_trait_ref(obligation, where_clause_trait_ref)
|
||||||
|
@ -2521,7 +2521,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug")]
|
||||||
fn match_poly_trait_ref(
|
fn match_poly_trait_ref(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
poly_trait_ref: ty::PolyTraitRef<'tcx>,
|
poly_trait_ref: ty::PolyTraitRef<'tcx>,
|
||||||
) -> Result<Vec<PredicateObligation<'tcx>>, ()> {
|
) -> Result<Vec<PredicateObligation<'tcx>>, ()> {
|
||||||
self.infcx
|
self.infcx
|
||||||
|
@ -2547,7 +2547,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
fn push_stack<'o>(
|
fn push_stack<'o>(
|
||||||
&mut self,
|
&mut self,
|
||||||
previous_stack: TraitObligationStackList<'o, 'tcx>,
|
previous_stack: TraitObligationStackList<'o, 'tcx>,
|
||||||
obligation: &'o TraitObligation<'tcx>,
|
obligation: &'o PolyTraitObligation<'tcx>,
|
||||||
) -> TraitObligationStack<'o, 'tcx> {
|
) -> TraitObligationStack<'o, 'tcx> {
|
||||||
let fresh_trait_pred = obligation.predicate.fold_with(&mut self.freshener);
|
let fresh_trait_pred = obligation.predicate.fold_with(&mut self.freshener);
|
||||||
|
|
||||||
|
@ -2566,7 +2566,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug")]
|
||||||
fn closure_trait_ref_unnormalized(
|
fn closure_trait_ref_unnormalized(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &PolyTraitObligation<'tcx>,
|
||||||
substs: SubstsRef<'tcx>,
|
substs: SubstsRef<'tcx>,
|
||||||
) -> ty::PolyTraitRef<'tcx> {
|
) -> ty::PolyTraitRef<'tcx> {
|
||||||
let closure_sig = substs.as_closure().sig();
|
let closure_sig = substs.as_closure().sig();
|
||||||
|
@ -2929,9 +2929,9 @@ struct TraitObligationStackList<'o, 'tcx> {
|
||||||
head: Option<&'o TraitObligationStack<'o, 'tcx>>,
|
head: Option<&'o TraitObligationStack<'o, 'tcx>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'o, 'tcx> TraitObligationStackList<'o, 'tcx> {
|
impl<'o, 'tcx> PolyTraitObligationStackList<'o, 'tcx> {
|
||||||
fn empty(cache: &'o ProvisionalEvaluationCache<'tcx>) -> TraitObligationStackList<'o, 'tcx> {
|
fn empty(cache: &'o ProvisionalEvaluationCache<'tcx>) -> PolyTraitObligationStackList<'o, 'tcx> {
|
||||||
TraitObligationStackList { cache, head: None }
|
PolyTraitObligationStackList { cache, head: None }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with(r: &'o TraitObligationStack<'o, 'tcx>) -> TraitObligationStackList<'o, 'tcx> {
|
fn with(r: &'o TraitObligationStack<'o, 'tcx>) -> TraitObligationStackList<'o, 'tcx> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue