Don't normalize constants unless they need normalization

This commit is contained in:
Michael Goulet 2022-11-06 17:14:05 +00:00
parent 7eef946fc0
commit 152646f23f
2 changed files with 5 additions and 1 deletions

View file

@ -647,7 +647,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
#[instrument(skip(self), level = "debug")]
fn fold_const(&mut self, constant: ty::Const<'tcx>) -> ty::Const<'tcx> {
let tcx = self.selcx.tcx();
if tcx.lazy_normalization() {
if tcx.lazy_normalization() || !needs_normalization(&constant, self.param_env.reveal()) {
constant
} else {
let constant = constant.super_fold_with(self);