about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorLukas Markeffsky <@>2024-09-19 15:56:24 +0200
committerLukas Markeffsky <@>2024-09-19 15:56:24 +0200
commit1999d065b7c113097701fecdf9643ba64db7ff3c (patch)
treeab27355bc2cb0345992c3f0ec90e86c4d2dc3bc2 /compiler/rustc_trait_selection/src
parentb0af276da341bcd3fbfe71871aeacc8650f344ed (diff)
downloadrust-1999d065b7c113097701fecdf9643ba64db7ff3c.tar.gz
rust-1999d065b7c113097701fecdf9643ba64db7ff3c.zip
skip normalizing param env if it is already normalized
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/mod.rs3
1 files changed, 3 insertions, 0 deletions
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 @@ pub fn normalize_param_env_or_error<'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