Rename normalize to normalize_internal, remove unnecessary usages

This commit is contained in:
Michael Goulet 2024-09-27 13:50:28 -04:00
parent e83e4e8112
commit 38bbcc001e
7 changed files with 6 additions and 7 deletions

View File

@ -1487,7 +1487,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
} else if self.tcx.features().generic_const_exprs {
ct.normalize(self.tcx, self.param_env)
ct.normalize_internal(self.tcx, self.param_env)
} else {
ct
}

View File

@ -1,12 +1,12 @@
use std::fmt::{self, Debug, Display, Formatter};
use either::Either;
use rustc_hir::def_id::DefId;
use rustc_macros::{HashStable, Lift, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
use rustc_session::RemapFileNameExt;
use rustc_session::config::RemapPathScopeComponents;
use rustc_span::{DUMMY_SP, Span};
use rustc_target::abi::{HasDataLayout, Size};
use either::Either;
use crate::mir::interpret::{AllocId, ConstAllocation, ErrorHandled, Scalar, alloc_range};
use crate::mir::{Promoted, pretty_print_const_value};

View File

@ -400,7 +400,7 @@ impl<'tcx> Const<'tcx> {
/// Normalizes the constant to a value or an error if possible.
#[inline]
pub fn normalize(self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>) -> Self {
pub fn normalize_internal(self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>) -> Self {
match self.eval_valtree(tcx, param_env, DUMMY_SP) {
Ok((ty, val)) => Self::new_value(tcx, val, ty),
Err(Either::Left(_bad_ty)) => {

View File

@ -555,7 +555,6 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
fn print_const(&mut self, ct: ty::Const<'tcx>) -> Result<(), PrintError> {
// We only mangle a typed value if the const can be evaluated.
let ct = ct.normalize(self.tcx, ty::ParamEnv::reveal_all());
let (ct_ty, valtree) = match ct.kind() {
ty::ConstKind::Value(ty, val) => (ty, val),

View File

@ -368,7 +368,7 @@ pub fn normalize_param_env_or_error<'tcx>(
// should actually be okay since without `feature(generic_const_exprs)` the only
// const arguments that have a non-empty param env are array repeat counts. These
// do not appear in the type system though.
c.normalize(self.0, ty::ParamEnv::empty())
c.normalize_internal(self.0, ty::ParamEnv::empty())
}
}

View File

@ -413,7 +413,7 @@ impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx
self.selcx.infcx,
&mut self.universes,
constant,
|constant| constant.normalize(tcx, self.param_env),
|constant| constant.normalize_internal(tcx, self.param_env),
)
}
}

View File

@ -340,7 +340,7 @@ impl<'a, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'a, 'tcx> {
self.infcx,
&mut self.universes,
constant,
|constant| constant.normalize(self.infcx.tcx, self.param_env),
|constant| constant.normalize_internal(self.infcx.tcx, self.param_env),
);
debug!(?constant, ?self.param_env);
constant.try_super_fold_with(self)