about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query/mod.rs
diff options
context:
space:
mode:
authorJane Losare-Lusby <jlusby@yaah.dev>2025-04-07 14:26:14 -0700
committerJane Losare-Lusby <jlusby@yaah.dev>2025-04-08 15:00:37 -0700
commit6f5501583557d2d918cd42fab3f99ad153152afd (patch)
treebd57a566c4c84e2d4632a34e5588d40dff7c5dbf /compiler/rustc_middle/src/query/mod.rs
parente643f59f6da3a84f43e75dea99afaa5b041ea6bf (diff)
downloadrust-6f5501583557d2d918cd42fab3f99ad153152afd.tar.gz
rust-6f5501583557d2d918cd42fab3f99ad153152afd.zip
fix "still mutable" ice while metrics are enabled
Diffstat (limited to 'compiler/rustc_middle/src/query/mod.rs')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 0d5fba3cc69..dfd877c0b86 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -1894,6 +1894,11 @@ rustc_queries! {
 
     // The macro which defines `rustc_metadata::provide_extern` depends on this query's name.
     // Changing the name should cause a compiler error, but in case that changes, be aware.
+    //
+    // The hash should not be calculated before the `analysis` pass is complete, specifically
+    // until `tcx.untracked().definitions.freeze()` has been called, otherwise if incremental
+    // compilation is enabled calculating this hash can freeze this structure too early in
+    // compilation and cause subsequent crashes when attempting to write to `definitions`
     query crate_hash(_: CrateNum) -> Svh {
         eval_always
         desc { "looking up the hash a crate" }