diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index c82eaa5143d..538e23f4449 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -409,6 +409,9 @@ fn fold_const(&mut self, c: ty::Const<'tcx>) -> ty::Const<'tcx> { debug!("normalize_param_env_or_error: elaborated-predicates={:?}", predicates); let elaborated_env = ty::ParamEnv::new(tcx.mk_clauses(&predicates), unnormalized_env.reveal()); + if !normalize::needs_normalization(&elaborated_env, unnormalized_env.reveal()) { + return elaborated_env; + } // HACK: we are trying to normalize the param-env inside *itself*. The problem is that // normalization expects its param-env to be already normalized, which means we have