Skip to content

Commit 5793a9e

Browse files
committed
Auto merge of #130561 - lukas-code:perf-normalize-env, r=compiler-errors
[perf] skip normalizing param env if it is already normalized If the param env is already normalized after elaboration, then we can skip a bunch of expensive operations. > [!note] > This makes it so that outlives predicates are no longer sorted after non-outlives predicates. Surely this won't make a semantic difference. r? ghost
2 parents 506f22b + 1999d06 commit 5793a9e

File tree

1 file changed

+3
-0
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+3
-0
lines changed

compiler/rustc_trait_selection/src/traits/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ pub fn normalize_param_env_or_error<'tcx>(
409409
debug!("normalize_param_env_or_error: elaborated-predicates={:?}", predicates);
410410

411411
let elaborated_env = ty::ParamEnv::new(tcx.mk_clauses(&predicates), unnormalized_env.reveal());
412+
if !normalize::needs_normalization(&elaborated_env, unnormalized_env.reveal()) {
413+
return elaborated_env;
414+
}
412415

413416
// HACK: we are trying to normalize the param-env inside *itself*. The problem is that
414417
// normalization expects its param-env to be already normalized, which means we have

0 commit comments

Comments
 (0)