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
This commit is contained in:
commit
5793a9e902
1 changed files with 3 additions and 0 deletions
|
@ -409,6 +409,9 @@ pub fn normalize_param_env_or_error<'tcx>(
|
||||||
debug!("normalize_param_env_or_error: elaborated-predicates={:?}", predicates);
|
debug!("normalize_param_env_or_error: elaborated-predicates={:?}", predicates);
|
||||||
|
|
||||||
let elaborated_env = ty::ParamEnv::new(tcx.mk_clauses(&predicates), unnormalized_env.reveal());
|
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
|
// 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
|
// normalization expects its param-env to be already normalized, which means we have
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue