about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-09-18 15:17:52 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-09-18 15:17:52 +0000
commitee59531dfcd3185335322f29aa806aefe2aaa7ac (patch)
tree2a24a97baa4ea7ec4b120c6896c85276b51e4114
parentde68911f4adaed19ac662880cf1a5ded9e44d685 (diff)
downloadrust-ee59531dfcd3185335322f29aa806aefe2aaa7ac.tar.gz
rust-ee59531dfcd3185335322f29aa806aefe2aaa7ac.zip
Explain `with_reveal_all_normalized` usage
-rw-r--r--compiler/rustc_ty_utils/src/layout.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs
index 904f1b38740..a03b82305f0 100644
--- a/compiler/rustc_ty_utils/src/layout.rs
+++ b/compiler/rustc_ty_utils/src/layout.rs
@@ -36,6 +36,9 @@ fn layout_of<'tcx>(
     let (param_env, ty) = query.into_parts();
     debug!(?ty);
 
+    // Optimization: We convert to RevealAll and convert opaque types in the where bounds
+    // to their hidden types. This reduces overall uncached invocations of `layout_of` and
+    // is thus a small performance improvement.
     let param_env = param_env.with_reveal_all_normalized(tcx);
     let unnormalized_ty = ty;