fix "still mutable" ice while metrics are enabled
This commit is contained in:
parent
e643f59f6d
commit
6f55015835
5 changed files with 120 additions and 5 deletions
|
@ -88,7 +88,7 @@ impl<T> FreezeLock<T> {
|
|||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn write(&self) -> FreezeWriteGuard<'_, T> {
|
||||
self.try_write().expect("still mutable")
|
||||
self.try_write().expect("data should not be frozen if we're still attempting to mutate it")
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -348,10 +348,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
|
|||
// Make sure name resolution and macro expansion is run.
|
||||
let _ = tcx.resolver_for_lowering();
|
||||
|
||||
if let Some(metrics_dir) = &sess.opts.unstable_opts.metrics_dir {
|
||||
dump_feature_usage_metrics(tcx, metrics_dir);
|
||||
}
|
||||
|
||||
if callbacks.after_expansion(compiler, tcx) == Compilation::Stop {
|
||||
return early_exit();
|
||||
}
|
||||
|
@ -370,6 +366,10 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
|
|||
|
||||
tcx.ensure_ok().analysis(());
|
||||
|
||||
if let Some(metrics_dir) = &sess.opts.unstable_opts.metrics_dir {
|
||||
dump_feature_usage_metrics(tcx, metrics_dir);
|
||||
}
|
||||
|
||||
if callbacks.after_analysis(compiler, tcx) == Compilation::Stop {
|
||||
return early_exit();
|
||||
}
|
||||
|
|
|
@ -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" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue