1
Fork 0

Rename some normalization-related items

This commit is contained in:
León Orell Valerian Liehr 2024-02-20 10:34:51 +01:00
parent 5af2130440
commit 05ce209d20
No known key found for this signature in database
GPG key ID: D17A07215F68E713
6 changed files with 51 additions and 40 deletions

View file

@ -5,7 +5,7 @@ use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
use rustc_trait_selection::infer::InferCtxtBuilderExt;
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt;
use rustc_trait_selection::traits::query::{
normalize::NormalizationResult, CanonicalProjectionGoal, NoSolution,
normalize::NormalizationResult, CanonicalAliasGoal, NoSolution,
};
use rustc_trait_selection::traits::{
self, FulfillmentErrorCode, ObligationCause, SelectionContext,
@ -13,18 +13,19 @@ use rustc_trait_selection::traits::{
pub(crate) fn provide(p: &mut Providers) {
*p = Providers {
normalize_projection_ty,
normalize_weak_ty,
normalize_inherent_projection_ty,
normalize_canonicalized_projection_ty,
normalize_canonicalized_weak_ty,
normalize_canonicalized_inherent_projection_ty,
..*p
};
}
fn normalize_projection_ty<'tcx>(
fn normalize_canonicalized_projection_ty<'tcx>(
tcx: TyCtxt<'tcx>,
goal: CanonicalProjectionGoal<'tcx>,
goal: CanonicalAliasGoal<'tcx>,
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> {
debug!("normalize_provider(goal={:#?})", goal);
debug!("normalize_canonicalized_projection_ty(goal={:#?})", goal);
tcx.infer_ctxt().enter_canonical_trait_query(
&goal,
|ocx, ParamEnvAnd { param_env, value: goal }| {
@ -61,19 +62,19 @@ fn normalize_projection_ty<'tcx>(
return Err(NoSolution);
}
// FIXME(associated_const_equality): All users of normalize_projection_ty expected
// a type, but there is the possibility it could've been a const now. Maybe change
// it to a Term later?
// FIXME(associated_const_equality): All users of normalize_canonicalized_projection_ty
// expected a type, but there is the possibility it could've been a const now.
// Maybe change it to a Term later?
Ok(NormalizationResult { normalized_ty: answer.ty().unwrap() })
},
)
}
fn normalize_weak_ty<'tcx>(
fn normalize_canonicalized_weak_ty<'tcx>(
tcx: TyCtxt<'tcx>,
goal: CanonicalProjectionGoal<'tcx>,
goal: CanonicalAliasGoal<'tcx>,
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> {
debug!("normalize_provider(goal={:#?})", goal);
debug!("normalize_canonicalized_weak_ty(goal={:#?})", goal);
tcx.infer_ctxt().enter_canonical_trait_query(
&goal,
@ -95,11 +96,11 @@ fn normalize_weak_ty<'tcx>(
)
}
fn normalize_inherent_projection_ty<'tcx>(
fn normalize_canonicalized_inherent_projection_ty<'tcx>(
tcx: TyCtxt<'tcx>,
goal: CanonicalProjectionGoal<'tcx>,
goal: CanonicalAliasGoal<'tcx>,
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> {
debug!("normalize_provider(goal={:#?})", goal);
debug!("normalize_canonicalized_inherent_projection_ty(goal={:#?})", goal);
tcx.infer_ctxt().enter_canonical_trait_query(
&goal,