about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-09-02 00:25:54 +0200
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-09-02 08:13:07 +0200
commitac54d4957268b684ef36dbda8ab9d17aa09e3333 (patch)
tree06c903d8232c3fdeac5c4f3b957baaad9ca6b3ba /compiler
parent6881eed8f686964e83d5b915fcc1445f23aa60ed (diff)
downloadrust-ac54d4957268b684ef36dbda8ab9d17aa09e3333.tar.gz
rust-ac54d4957268b684ef36dbda8ab9d17aa09e3333.zip
Freeze `Definitions` earlier
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_analysis/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs
index 4f95174f869..b0f333b79ca 100644
--- a/compiler/rustc_hir_analysis/src/lib.rs
+++ b/compiler/rustc_hir_analysis/src/lib.rs
@@ -237,6 +237,10 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
         tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
     });
 
+    // Freeze definitions as we don't add new ones at this point. This improves performance by
+    // allowing lock-free access to them.
+    tcx.untracked().definitions.freeze();
+
     // FIXME: Remove this when we implement creating `DefId`s
     // for anon constants during their parents' typeck.
     // Typeck all body owners in parallel will produce queries