partially_normalize_... -> At::normalize

This commit is contained in:
Michael Goulet 2022-11-25 17:11:15 +00:00
parent f12e772b83
commit fc710832ea
18 changed files with 58 additions and 93 deletions

View file

@ -291,9 +291,9 @@ where
// FIXME(lqd): Unify and de-duplicate the following with the actual // FIXME(lqd): Unify and de-duplicate the following with the actual
// `rustc_traits::type_op::type_op_normalize` query to allow the span we need in the // `rustc_traits::type_op::type_op_normalize` query to allow the span we need in the
// `ObligationCause`. The normalization results are currently different between // `ObligationCause`. The normalization results are currently different between
// `AtExt::normalize` used in the query and `normalize` called below: the former fails // `QueryNormalizeExt::query_normalize` used in the query and `normalize` called below:
// to normalize the `nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs` test. Check // the former fails to normalize the `nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs` test.
// after #85499 lands to see if its fixes have erased this difference. // Check after #85499 lands to see if its fixes have erased this difference.
let (param_env, value) = key.into_parts(); let (param_env, value) = key.into_parts();
let _ = ocx.normalize(cause, param_env, value.value); let _ = ocx.normalize(cause, param_env, value.value);

View file

@ -30,9 +30,10 @@ use rustc_span::def_id::LocalDefId;
use rustc_span::hygiene::DesugaringKind; use rustc_span::hygiene::DesugaringKind;
use rustc_span::symbol::{kw, sym, Ident}; use rustc_span::symbol::{kw, sym, Ident};
use rustc_span::{Span, DUMMY_SP}; use rustc_span::{Span, DUMMY_SP};
use rustc_trait_selection::infer::InferCtxtExt as _;
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _; use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
use rustc_trait_selection::traits::{self, ObligationCause, ObligationCauseCode, ObligationCtxt}; use rustc_trait_selection::traits::{
self, NormalizeExt, ObligationCause, ObligationCauseCode, ObligationCtxt,
};
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use std::slice; use std::slice;
@ -382,11 +383,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
where where
T: TypeFoldable<'tcx>, T: TypeFoldable<'tcx>,
{ {
self.inh.partially_normalize_associated_types_in( self.at(&ObligationCause::misc(span, self.body_id), self.param_env).normalize(value)
ObligationCause::misc(span, self.body_id),
self.param_env,
value,
)
} }
pub(in super::super) fn normalize_op_associated_types_in_as_infer_ok<T>( pub(in super::super) fn normalize_op_associated_types_in_as_infer_ok<T>(
@ -398,8 +395,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
where where
T: TypeFoldable<'tcx>, T: TypeFoldable<'tcx>,
{ {
self.inh.partially_normalize_associated_types_in( self.at(
ObligationCause::new( &ObligationCause::new(
span, span,
self.body_id, self.body_id,
traits::BinOp { traits::BinOp {
@ -410,8 +407,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}, },
), ),
self.param_env, self.param_env,
value,
) )
.normalize(value)
} }
pub fn require_type_meets( pub fn require_type_meets(

View file

@ -12,9 +12,8 @@ use rustc_middle::ty::visit::TypeVisitable;
use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::def_id::LocalDefIdMap; use rustc_span::def_id::LocalDefIdMap;
use rustc_span::{self, Span}; use rustc_span::{self, Span};
use rustc_trait_selection::infer::InferCtxtExt as _;
use rustc_trait_selection::traits::{ use rustc_trait_selection::traits::{
self, ObligationCause, ObligationCtxt, TraitEngine, TraitEngineExt as _, self, NormalizeExt, ObligationCause, ObligationCtxt, TraitEngine, TraitEngineExt as _,
}; };
use std::cell::RefCell; use std::cell::RefCell;
@ -206,7 +205,7 @@ impl<'tcx> Inherited<'tcx> {
where where
T: TypeFoldable<'tcx>, T: TypeFoldable<'tcx>,
{ {
let ok = self.partially_normalize_associated_types_in(cause, param_env, value); let ok = self.at(&cause, param_env).normalize(value);
debug!(?ok); debug!(?ok);
self.register_infer_ok_obligations(ok) self.register_infer_ok_obligations(ok)
} }

View file

@ -31,13 +31,13 @@ use rustc_span::lev_distance::{
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use rustc_span::{symbol::Ident, Span, Symbol, DUMMY_SP}; use rustc_span::{symbol::Ident, Span, Symbol, DUMMY_SP};
use rustc_trait_selection::autoderef::{self, Autoderef}; use rustc_trait_selection::autoderef::{self, Autoderef};
use rustc_trait_selection::infer::InferCtxtExt as _;
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt; use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
use rustc_trait_selection::traits::query::method_autoderef::MethodAutoderefBadTy; use rustc_trait_selection::traits::query::method_autoderef::MethodAutoderefBadTy;
use rustc_trait_selection::traits::query::method_autoderef::{ use rustc_trait_selection::traits::query::method_autoderef::{
CandidateStep, MethodAutoderefStepsResult, CandidateStep, MethodAutoderefStepsResult,
}; };
use rustc_trait_selection::traits::query::CanonicalTyGoal; use rustc_trait_selection::traits::query::CanonicalTyGoal;
use rustc_trait_selection::traits::NormalizeExt;
use rustc_trait_selection::traits::{self, ObligationCause}; use rustc_trait_selection::traits::{self, ObligationCause};
use std::cmp::max; use std::cmp::max;
use std::iter; use std::iter;
@ -716,9 +716,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
// maybe shouldn't include `Param`s, but rather fresh variables or be canonicalized, // maybe shouldn't include `Param`s, but rather fresh variables or be canonicalized,
// see issue #89650 // see issue #89650
let cause = traits::ObligationCause::misc(self.span, self.body_id); let cause = traits::ObligationCause::misc(self.span, self.body_id);
let InferOk { value: xform_self_ty, obligations } = self let InferOk { value: xform_self_ty, obligations } =
.fcx self.fcx.at(&cause, self.param_env).normalize(xform_self_ty);
.partially_normalize_associated_types_in(cause, self.param_env, xform_self_ty);
debug!( debug!(
"assemble_inherent_impl_probe after normalization: xform_self_ty = {:?}/{:?}", "assemble_inherent_impl_probe after normalization: xform_self_ty = {:?}/{:?}",
@ -1507,11 +1506,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
let InferOk { let InferOk {
value: normalized_xform_ret_ty, value: normalized_xform_ret_ty,
obligations: normalization_obligations, obligations: normalization_obligations,
} = self.fcx.partially_normalize_associated_types_in( } = self.fcx.at(&cause, self.param_env).normalize(probe.xform_ret_ty);
cause.clone(),
self.param_env,
probe.xform_ret_ty,
);
xform_ret_ty = normalized_xform_ret_ty; xform_ret_ty = normalized_xform_ret_ty;
debug!("xform_ret_ty after normalization: {:?}", xform_ret_ty); debug!("xform_ret_ty after normalization: {:?}", xform_ret_ty);
@ -1521,11 +1516,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
let impl_bounds = impl_bounds.instantiate(self.tcx, substs); let impl_bounds = impl_bounds.instantiate(self.tcx, substs);
let InferOk { value: impl_bounds, obligations: norm_obligations } = let InferOk { value: impl_bounds, obligations: norm_obligations } =
self.fcx.partially_normalize_associated_types_in( self.fcx.at(&cause, self.param_env).normalize(impl_bounds);
cause.clone(),
self.param_env,
impl_bounds,
);
// Convert the bounds into obligations. // Convert the bounds into obligations.
let impl_obligations = traits::predicates_for_generics( let impl_obligations = traits::predicates_for_generics(

View file

@ -1,6 +1,6 @@
use crate::errors::AutoDerefReachedRecursionLimit; use crate::errors::AutoDerefReachedRecursionLimit;
use crate::infer::InferCtxtExt as _;
use crate::traits::query::evaluate_obligation::InferCtxtExt; use crate::traits::query::evaluate_obligation::InferCtxtExt;
use crate::traits::NormalizeExt;
use crate::traits::{self, TraitEngine, TraitEngineExt}; use crate::traits::{self, TraitEngine, TraitEngineExt};
use rustc_hir as hir; use rustc_hir as hir;
use rustc_infer::infer::InferCtxt; use rustc_infer::infer::InferCtxt;
@ -138,11 +138,10 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
return None; return None;
} }
let normalized_ty = self.infcx.partially_normalize_associated_types_in( let normalized_ty = self
cause, .infcx
self.param_env, .at(&cause, self.param_env)
tcx.mk_projection(tcx.lang_items().deref_target()?, trait_ref.substs), .normalize(tcx.mk_projection(tcx.lang_items().deref_target()?, trait_ref.substs));
);
let mut fulfillcx = <dyn TraitEngine<'tcx>>::new_in_snapshot(tcx); let mut fulfillcx = <dyn TraitEngine<'tcx>>::new_in_snapshot(tcx);
let normalized_ty = let normalized_ty =
normalized_ty.into_value_registering_obligations(self.infcx, &mut *fulfillcx); normalized_ty.into_value_registering_obligations(self.infcx, &mut *fulfillcx);

View file

@ -3,7 +3,6 @@ use crate::traits::{self, ObligationCtxt};
use rustc_hir::def_id::DefId; use rustc_hir::def_id::DefId;
use rustc_hir::lang_items::LangItem; use rustc_hir::lang_items::LangItem;
use rustc_infer::traits::ObligationCause;
use rustc_middle::arena::ArenaAllocatable; use rustc_middle::arena::ArenaAllocatable;
use rustc_middle::infer::canonical::{Canonical, CanonicalizedQueryResponse, QueryResponse}; use rustc_middle::infer::canonical::{Canonical, CanonicalizedQueryResponse, QueryResponse};
use rustc_middle::traits::query::Fallible; use rustc_middle::traits::query::Fallible;
@ -30,15 +29,6 @@ pub trait InferCtxtExt<'tcx> {
span: Span, span: Span,
) -> bool; ) -> bool;
fn partially_normalize_associated_types_in<T>(
&self,
cause: ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>,
value: T,
) -> InferOk<'tcx, T>
where
T: TypeFoldable<'tcx>;
/// Check whether a `ty` implements given trait(trait_def_id). /// Check whether a `ty` implements given trait(trait_def_id).
/// The inputs are: /// The inputs are:
/// ///
@ -88,24 +78,6 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, lang_item, span) traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, lang_item, span)
} }
/// Normalizes associated types in `value`, potentially returning
/// new obligations that must further be processed.
#[instrument(level = "debug", skip(self, cause, param_env), ret)]
fn partially_normalize_associated_types_in<T>(
&self,
cause: ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>,
value: T,
) -> InferOk<'tcx, T>
where
T: TypeFoldable<'tcx>,
{
let mut selcx = traits::SelectionContext::new(self);
let traits::Normalized { value, obligations } =
traits::normalize(&mut selcx, param_env, cause, value);
InferOk { value, obligations }
}
#[instrument(level = "debug", skip(self, params), ret)] #[instrument(level = "debug", skip(self, params), ret)]
fn type_implements_trait( fn type_implements_trait(
&self, &self,

View file

@ -3,7 +3,7 @@ use std::fmt::Debug;
use super::TraitEngine; use super::TraitEngine;
use super::{ChalkFulfillmentContext, FulfillmentContext}; use super::{ChalkFulfillmentContext, FulfillmentContext};
use crate::infer::InferCtxtExt; use crate::traits::NormalizeExt;
use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::fx::FxIndexSet;
use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_infer::infer::at::ToTrace; use rustc_infer::infer::at::ToTrace;
@ -104,11 +104,12 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
pub fn normalize<T: TypeFoldable<'tcx>>( pub fn normalize<T: TypeFoldable<'tcx>>(
&self, &self,
// FIXME(compiler-errors): Make this borrow
cause: ObligationCause<'tcx>, cause: ObligationCause<'tcx>,
param_env: ty::ParamEnv<'tcx>, param_env: ty::ParamEnv<'tcx>,
value: T, value: T,
) -> T { ) -> T {
let infer_ok = self.infcx.partially_normalize_associated_types_in(cause, param_env, value); let infer_ok = self.infcx.at(&cause, param_env).normalize(value);
self.register_infer_ok_obligations(infer_ok) self.register_infer_ok_obligations(infer_ok)
} }

View file

@ -9,11 +9,11 @@ use super::{
}; };
use crate::infer::error_reporting::{TyCategory, TypeAnnotationNeeded as ErrorCode}; use crate::infer::error_reporting::{TyCategory, TypeAnnotationNeeded as ErrorCode};
use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use crate::infer::InferCtxtExt as _;
use crate::infer::{self, InferCtxt, TyCtxtInferExt}; use crate::infer::{self, InferCtxt, TyCtxtInferExt};
use crate::traits::query::evaluate_obligation::InferCtxtExt as _; use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
use crate::traits::query::normalize::AtExt as _; use crate::traits::query::normalize::QueryNormalizeExt as _;
use crate::traits::specialize::to_pretty_impl_header; use crate::traits::specialize::to_pretty_impl_header;
use crate::traits::NormalizeExt;
use on_unimplemented::OnUnimplementedNote; use on_unimplemented::OnUnimplementedNote;
use on_unimplemented::TypeErrCtxtExt as _; use on_unimplemented::TypeErrCtxtExt as _;
use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
@ -2535,11 +2535,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
pred.fold_with(&mut ParamToVarFolder { infcx: self, var_map: Default::default() }); pred.fold_with(&mut ParamToVarFolder { infcx: self, var_map: Default::default() });
let InferOk { value: cleaned_pred, .. } = let InferOk { value: cleaned_pred, .. } =
self.infcx.partially_normalize_associated_types_in( self.infcx.at(&ObligationCause::dummy(), param_env).normalize(cleaned_pred);
ObligationCause::dummy(),
param_env,
cleaned_pred,
);
let obligation = let obligation =
Obligation::new(self.tcx, ObligationCause::dummy(), param_env, cleaned_pred); Obligation::new(self.tcx, ObligationCause::dummy(), param_env, cleaned_pred);

View file

@ -2,6 +2,7 @@ use super::{DefIdOrName, Obligation, ObligationCause, ObligationCauseCode, Predi
use crate::autoderef::Autoderef; use crate::autoderef::Autoderef;
use crate::infer::InferCtxt; use crate::infer::InferCtxt;
use crate::traits::NormalizeExt;
use hir::def::CtorOf; use hir::def::CtorOf;
use hir::HirId; use hir::HirId;
@ -2972,12 +2973,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
self.tcx.mk_substs_trait(trait_pred.self_ty(), []), self.tcx.mk_substs_trait(trait_pred.self_ty(), []),
) )
}); });
let InferOk { value: projection_ty, .. } = self let InferOk { value: projection_ty, .. } =
.partially_normalize_associated_types_in( self.at(&obligation.cause, obligation.param_env).normalize(projection_ty);
obligation.cause.clone(),
obligation.param_env,
projection_ty,
);
debug!( debug!(
normalized_projection_type = ?self.resolve_vars_if_possible(projection_ty) normalized_projection_type = ?self.resolve_vars_if_possible(projection_ty)

View file

@ -56,7 +56,7 @@ pub use self::object_safety::astconv_object_safety_violations;
pub use self::object_safety::is_vtable_safe_method; pub use self::object_safety::is_vtable_safe_method;
pub use self::object_safety::MethodViolationCode; pub use self::object_safety::MethodViolationCode;
pub use self::object_safety::ObjectSafetyViolation; pub use self::object_safety::ObjectSafetyViolation;
pub use self::project::{normalize, normalize_projection_type, normalize_to}; pub use self::project::{normalize, normalize_projection_type, normalize_to, NormalizeExt};
pub use self::select::{EvaluationCache, SelectionCache, SelectionContext}; pub use self::select::{EvaluationCache, SelectionCache, SelectionContext};
pub use self::select::{EvaluationResult, IntercrateAmbiguityCause, OverflowError}; pub use self::select::{EvaluationResult, IntercrateAmbiguityCause, OverflowError};
pub use self::specialize::specialization_graph::FutureCompatOverlapError; pub use self::specialize::specialization_graph::FutureCompatOverlapError;

View file

@ -27,6 +27,7 @@ use rustc_errors::ErrorGuaranteed;
use rustc_hir::def::DefKind; use rustc_hir::def::DefKind;
use rustc_hir::def_id::DefId; use rustc_hir::def_id::DefId;
use rustc_hir::lang_items::LangItem; use rustc_hir::lang_items::LangItem;
use rustc_infer::infer::at::At;
use rustc_infer::infer::resolve::OpportunisticRegionResolver; use rustc_infer::infer::resolve::OpportunisticRegionResolver;
use rustc_infer::traits::ImplSourceBuiltinData; use rustc_infer::traits::ImplSourceBuiltinData;
use rustc_middle::traits::select::OverflowError; use rustc_middle::traits::select::OverflowError;
@ -48,6 +49,19 @@ pub type ProjectionTyObligation<'tcx> = Obligation<'tcx, ty::ProjectionTy<'tcx>>
pub(super) struct InProgress; pub(super) struct InProgress;
pub trait NormalizeExt<'tcx> {
fn normalize<T: TypeFoldable<'tcx>>(&self, t: T) -> InferOk<'tcx, T>;
}
impl<'tcx> NormalizeExt<'tcx> for At<'_, 'tcx> {
fn normalize<T: TypeFoldable<'tcx>>(&self, value: T) -> InferOk<'tcx, T> {
let mut selcx = SelectionContext::new(self.infcx);
let Normalized { value, obligations } =
normalize(&mut selcx, self.param_env, self.cause.clone(), value);
InferOk { value, obligations }
}
}
/// When attempting to resolve `<T as TraitRef>::Name` ... /// When attempting to resolve `<T as TraitRef>::Name` ...
#[derive(Debug)] #[derive(Debug)]
pub enum ProjectionError<'tcx> { pub enum ProjectionError<'tcx> {

View file

@ -22,13 +22,13 @@ use super::NoSolution;
pub use rustc_middle::traits::query::NormalizationResult; pub use rustc_middle::traits::query::NormalizationResult;
pub trait AtExt<'tcx> { pub trait QueryNormalizeExt<'tcx> {
fn query_normalize<T>(&self, value: T) -> Result<Normalized<'tcx, T>, NoSolution> fn query_normalize<T>(&self, value: T) -> Result<Normalized<'tcx, T>, NoSolution>
where where
T: TypeFoldable<'tcx>; T: TypeFoldable<'tcx>;
} }
impl<'cx, 'tcx> AtExt<'tcx> for At<'cx, 'tcx> { impl<'cx, 'tcx> QueryNormalizeExt<'tcx> for At<'cx, 'tcx> {
/// Normalize `value` in the context of the inference context, /// Normalize `value` in the context of the inference context,
/// yielding a resulting type, or an error if `value` cannot be /// yielding a resulting type, or an error if `value` cannot be
/// normalized. If you don't care about regions, you should prefer /// normalized. If you don't care about regions, you should prefer

View file

@ -8,8 +8,8 @@ use rustc_hir::def_id::DefId;
use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitable}; use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitable};
use rustc_middle::ty::{GenericArg, SubstsRef}; use rustc_middle::ty::{GenericArg, SubstsRef};
use super::NormalizeExt;
use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext}; use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext};
use crate::infer::InferCtxtExt;
use rustc_infer::infer::InferOk; use rustc_infer::infer::InferOk;
pub use rustc_infer::traits::{self, util::*}; pub use rustc_infer::traits::{self, util::*};
@ -202,15 +202,13 @@ pub fn impl_subject_and_oblig<'a, 'tcx>(
) -> (ImplSubject<'tcx>, impl Iterator<Item = PredicateObligation<'tcx>>) { ) -> (ImplSubject<'tcx>, impl Iterator<Item = PredicateObligation<'tcx>>) {
let subject = selcx.tcx().bound_impl_subject(impl_def_id); let subject = selcx.tcx().bound_impl_subject(impl_def_id);
let subject = subject.subst(selcx.tcx(), impl_substs); let subject = subject.subst(selcx.tcx(), impl_substs);
let InferOk { value: subject, obligations: normalization_obligations1 } = selcx let InferOk { value: subject, obligations: normalization_obligations1 } =
.infcx selcx.infcx.at(&ObligationCause::dummy(), param_env).normalize(subject);
.partially_normalize_associated_types_in(ObligationCause::dummy(), param_env, subject);
let predicates = selcx.tcx().predicates_of(impl_def_id); let predicates = selcx.tcx().predicates_of(impl_def_id);
let predicates = predicates.instantiate(selcx.tcx(), impl_substs); let predicates = predicates.instantiate(selcx.tcx(), impl_substs);
let InferOk { value: predicates, obligations: normalization_obligations2 } = selcx let InferOk { value: predicates, obligations: normalization_obligations2 } =
.infcx selcx.infcx.at(&ObligationCause::dummy(), param_env).normalize(predicates);
.partially_normalize_associated_types_in(ObligationCause::dummy(), param_env, predicates);
let impl_obligations = let impl_obligations =
super::predicates_for_generics(|_, _| ObligationCause::dummy(), param_env, predicates); super::predicates_for_generics(|_, _| ObligationCause::dummy(), param_env, predicates);

View file

@ -11,7 +11,7 @@ use rustc_trait_selection::traits::query::dropck_outlives::trivial_dropck_outliv
use rustc_trait_selection::traits::query::dropck_outlives::{ use rustc_trait_selection::traits::query::dropck_outlives::{
DropckConstraint, DropckOutlivesResult, DropckConstraint, DropckOutlivesResult,
}; };
use rustc_trait_selection::traits::query::normalize::AtExt; use rustc_trait_selection::traits::query::normalize::QueryNormalizeExt;
use rustc_trait_selection::traits::query::{CanonicalTyGoal, NoSolution}; use rustc_trait_selection::traits::query::{CanonicalTyGoal, NoSolution};
use rustc_trait_selection::traits::{Normalized, ObligationCause}; use rustc_trait_selection::traits::{Normalized, ObligationCause};

View file

@ -2,7 +2,7 @@ use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::traits::query::NoSolution; use rustc_middle::traits::query::NoSolution;
use rustc_middle::ty::query::Providers; use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt, TypeFoldable}; use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt, TypeFoldable};
use rustc_trait_selection::traits::query::normalize::AtExt; use rustc_trait_selection::traits::query::normalize::QueryNormalizeExt;
use rustc_trait_selection::traits::{Normalized, ObligationCause}; use rustc_trait_selection::traits::{Normalized, ObligationCause};
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;

View file

@ -8,7 +8,7 @@ use rustc_middle::ty::{ParamEnvAnd, Predicate, ToPredicate};
use rustc_middle::ty::{UserSelfTy, UserSubsts}; use rustc_middle::ty::{UserSelfTy, UserSubsts};
use rustc_span::{Span, DUMMY_SP}; use rustc_span::{Span, DUMMY_SP};
use rustc_trait_selection::infer::InferCtxtBuilderExt; use rustc_trait_selection::infer::InferCtxtBuilderExt;
use rustc_trait_selection::traits::query::normalize::AtExt; use rustc_trait_selection::traits::query::normalize::QueryNormalizeExt;
use rustc_trait_selection::traits::query::type_op::ascribe_user_type::AscribeUserType; use rustc_trait_selection::traits::query::type_op::ascribe_user_type::AscribeUserType;
use rustc_trait_selection::traits::query::type_op::eq::Eq; use rustc_trait_selection::traits::query::type_op::eq::Eq;
use rustc_trait_selection::traits::query::type_op::normalize::Normalize; use rustc_trait_selection::traits::query::type_op::normalize::Normalize;

View file

@ -1581,7 +1581,7 @@ fn normalize<'tcx>(cx: &mut DocContext<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'tcx>>
} }
use crate::rustc_trait_selection::infer::TyCtxtInferExt; use crate::rustc_trait_selection::infer::TyCtxtInferExt;
use crate::rustc_trait_selection::traits::query::normalize::AtExt; use crate::rustc_trait_selection::traits::query::normalize::QueryNormalizeExt;
use rustc_middle::traits::ObligationCause; use rustc_middle::traits::ObligationCause;
// Try to normalize `<X as Y>::T` to a type // Try to normalize `<X as Y>::T` to a type

View file

@ -22,6 +22,7 @@ use rustc_span::symbol::Ident;
use rustc_span::{sym, Span, Symbol, DUMMY_SP}; use rustc_span::{sym, Span, Symbol, DUMMY_SP};
use rustc_target::abi::{Size, VariantIdx}; use rustc_target::abi::{Size, VariantIdx};
use rustc_trait_selection::infer::InferCtxtExt; use rustc_trait_selection::infer::InferCtxtExt;
use rustc_trait_selection::traits::NormalizeExt;
use rustc_trait_selection::traits::query::normalize::AtExt; use rustc_trait_selection::traits::query::normalize::AtExt;
use std::iter; use std::iter;