Rename structurally_normalize
to structurally_normalize_ty
This commit is contained in:
parent
513bfaa8bc
commit
b99f59bbd6
8 changed files with 13 additions and 13 deletions
|
@ -185,7 +185,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
CustomTypeOp::new(
|
CustomTypeOp::new(
|
||||||
|ocx| {
|
|ocx| {
|
||||||
let structurally_normalize = |ty| {
|
let structurally_normalize = |ty| {
|
||||||
ocx.structurally_normalize(
|
ocx.structurally_normalize_ty(
|
||||||
&ObligationCause::misc(
|
&ObligationCause::misc(
|
||||||
location.to_locations().span(body),
|
location.to_locations().span(body),
|
||||||
body.source.def_id().expect_local(),
|
body.source.def_id().expect_local(),
|
||||||
|
@ -230,7 +230,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
ConstraintCategory::Boring,
|
ConstraintCategory::Boring,
|
||||||
CustomTypeOp::new(
|
CustomTypeOp::new(
|
||||||
|ocx| {
|
|ocx| {
|
||||||
ocx.structurally_normalize(
|
ocx.structurally_normalize_ty(
|
||||||
&ObligationCause::misc(
|
&ObligationCause::misc(
|
||||||
location.to_locations().span(body),
|
location.to_locations().span(body),
|
||||||
body.source.def_id().expect_local(),
|
body.source.def_id().expect_local(),
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
|
||||||
if self.infcx.next_trait_solver()
|
if self.infcx.next_trait_solver()
|
||||||
&& let ty::Alias(..) = ty.kind()
|
&& let ty::Alias(..) = ty.kind()
|
||||||
{
|
{
|
||||||
let (normalized_ty, obligations) = self.structurally_normalize(ty)?;
|
let (normalized_ty, obligations) = self.structurally_normalize_ty(ty)?;
|
||||||
self.state.obligations.extend(obligations);
|
self.state.obligations.extend(obligations);
|
||||||
(AutoderefKind::Builtin, normalized_ty)
|
(AutoderefKind::Builtin, normalized_ty)
|
||||||
} else {
|
} else {
|
||||||
|
@ -166,7 +166,7 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let (normalized_ty, obligations) =
|
let (normalized_ty, obligations) =
|
||||||
self.structurally_normalize(Ty::new_projection(tcx, trait_target_def_id, [ty]))?;
|
self.structurally_normalize_ty(Ty::new_projection(tcx, trait_target_def_id, [ty]))?;
|
||||||
debug!("overloaded_deref_ty({:?}) = ({:?}, {:?})", ty, normalized_ty, obligations);
|
debug!("overloaded_deref_ty({:?}) = ({:?}, {:?})", ty, normalized_ty, obligations);
|
||||||
self.state.obligations.extend(obligations);
|
self.state.obligations.extend(obligations);
|
||||||
|
|
||||||
|
@ -174,12 +174,12 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(self), ret)]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
pub fn structurally_normalize(
|
pub fn structurally_normalize_ty(
|
||||||
&self,
|
&self,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
) -> Option<(Ty<'tcx>, PredicateObligations<'tcx>)> {
|
) -> Option<(Ty<'tcx>, PredicateObligations<'tcx>)> {
|
||||||
let ocx = ObligationCtxt::new(self.infcx);
|
let ocx = ObligationCtxt::new(self.infcx);
|
||||||
let Ok(normalized_ty) = ocx.structurally_normalize(
|
let Ok(normalized_ty) = ocx.structurally_normalize_ty(
|
||||||
&traits::ObligationCause::misc(self.span, self.body_id),
|
&traits::ObligationCause::misc(self.span, self.body_id),
|
||||||
self.param_env,
|
self.param_env,
|
||||||
ty,
|
ty,
|
||||||
|
|
|
@ -320,7 +320,7 @@ fn orphan_check<'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
let ty = if infcx.next_trait_solver() {
|
let ty = if infcx.next_trait_solver() {
|
||||||
ocx.structurally_normalize(
|
ocx.structurally_normalize_ty(
|
||||||
&cause,
|
&cause,
|
||||||
ty::ParamEnv::empty(),
|
ty::ParamEnv::empty(),
|
||||||
infcx.resolve_vars_if_possible(ty),
|
infcx.resolve_vars_if_possible(ty),
|
||||||
|
|
|
@ -1124,7 +1124,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
if self.next_trait_solver()
|
if self.next_trait_solver()
|
||||||
&& let ty::Alias(..) = ty.kind()
|
&& let ty::Alias(..) = ty.kind()
|
||||||
{
|
{
|
||||||
ocx.structurally_normalize(&cause, self.param_env, ty)
|
ocx.structurally_normalize_ty(&cause, self.param_env, ty)
|
||||||
} else {
|
} else {
|
||||||
Ok(ty)
|
Ok(ty)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1433,7 +1433,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// in a reentrant borrow, causing an ICE.
|
// in a reentrant borrow, causing an ICE.
|
||||||
let result = self
|
let result = self
|
||||||
.at(&self.misc(sp), self.param_env)
|
.at(&self.misc(sp), self.param_env)
|
||||||
.structurally_normalize(ty, &mut **self.fulfillment_cx.borrow_mut());
|
.structurally_normalize_ty(ty, &mut **self.fulfillment_cx.borrow_mut());
|
||||||
match result {
|
match result {
|
||||||
Ok(normalized_ty) => normalized_ty,
|
Ok(normalized_ty) => normalized_ty,
|
||||||
Err(errors) => {
|
Err(errors) => {
|
||||||
|
|
|
@ -709,7 +709,7 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a, 'tcx> {
|
||||||
if matches!(ty.kind(), ty::Alias(..)) {
|
if matches!(ty.kind(), ty::Alias(..)) {
|
||||||
let ocx = ObligationCtxt::new(infcx);
|
let ocx = ObligationCtxt::new(infcx);
|
||||||
ty = ocx
|
ty = ocx
|
||||||
.structurally_normalize(&ObligationCause::dummy(), param_env, ty)
|
.structurally_normalize_ty(&ObligationCause::dummy(), param_env, ty)
|
||||||
.map_err(|_| ())?;
|
.map_err(|_| ())?;
|
||||||
if !ocx.select_where_possible().is_empty() {
|
if !ocx.select_where_possible().is_empty() {
|
||||||
return Err(());
|
return Err(());
|
||||||
|
|
|
@ -319,7 +319,7 @@ where
|
||||||
self.infcx.at(cause, param_env).deeply_normalize(value, &mut **self.engine.borrow_mut())
|
self.infcx.at(cause, param_env).deeply_normalize(value, &mut **self.engine.borrow_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn structurally_normalize(
|
pub fn structurally_normalize_ty(
|
||||||
&self,
|
&self,
|
||||||
cause: &ObligationCause<'tcx>,
|
cause: &ObligationCause<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
|
@ -327,7 +327,7 @@ where
|
||||||
) -> Result<Ty<'tcx>, Vec<E>> {
|
) -> Result<Ty<'tcx>, Vec<E>> {
|
||||||
self.infcx
|
self.infcx
|
||||||
.at(cause, param_env)
|
.at(cause, param_env)
|
||||||
.structurally_normalize(value, &mut **self.engine.borrow_mut())
|
.structurally_normalize_ty(value, &mut **self.engine.borrow_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn structurally_normalize_const(
|
pub fn structurally_normalize_const(
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::traits::{NormalizeExt, Obligation};
|
||||||
|
|
||||||
#[extension(pub trait StructurallyNormalizeExt<'tcx>)]
|
#[extension(pub trait StructurallyNormalizeExt<'tcx>)]
|
||||||
impl<'tcx> At<'_, 'tcx> {
|
impl<'tcx> At<'_, 'tcx> {
|
||||||
fn structurally_normalize<E: 'tcx>(
|
fn structurally_normalize_ty<E: 'tcx>(
|
||||||
&self,
|
&self,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
fulfill_cx: &mut dyn TraitEngine<'tcx, E>,
|
fulfill_cx: &mut dyn TraitEngine<'tcx, E>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue