fix "still mutable" ice while metrics are enabled

This commit is contained in:
Jane Losare-Lusby
2025-04-07 14:26:14 -07:00
parent e643f59f6d
commit 6f55015835
5 changed files with 120 additions and 5 deletions

View File

@@ -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" }