Skip to content

Commit 2aa5e3c

Browse files
committed
Turn write_dep_info into a regular function
It has side-effects and as such can't be cached.
1 parent 39def83 commit 2aa5e3c

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

compiler/rustc_driver_impl/src/lib.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,7 @@ fn run_compiler(
417417
Ok(())
418418
})?;
419419

420-
// Make sure the `write_dep_info` query is run for its side
421-
// effects of writing the dep-info and reporting errors.
422-
queries.global_ctxt()?.enter(|tcx| tcx.write_dep_info(()));
420+
queries.write_dep_info()?;
423421
} else {
424422
let krate = queries.parse()?.steal();
425423
pretty::print(sess, *ppm, pretty::PrintExtra::AfterParsing { krate });
@@ -450,9 +448,7 @@ fn run_compiler(
450448
return early_exit();
451449
}
452450

453-
// Make sure the `write_dep_info` query is run for its side
454-
// effects of writing the dep-info and reporting errors.
455-
queries.global_ctxt()?.enter(|tcx| tcx.write_dep_info(()));
451+
queries.write_dep_info()?;
456452

457453
if sess.opts.output_types.contains_key(&OutputType::DepInfo)
458454
&& sess.opts.output_types.len() == 1

compiler/rustc_interface/src/passes.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ fn resolver_for_lowering<'tcx>(
564564
tcx.arena.alloc(Steal::new((untracked_resolver_for_lowering, Lrc::new(krate))))
565565
}
566566

567-
fn write_dep_info(tcx: TyCtxt<'_>, (): ()) {
567+
pub(crate) fn write_dep_info(tcx: TyCtxt<'_>) {
568568
// Make sure name resolution and macro expansion is run for
569569
// the side-effect of providing a complete set of all
570570
// accessed files and env vars.
@@ -617,7 +617,6 @@ pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
617617
let providers = &mut Providers::default();
618618
providers.analysis = analysis;
619619
providers.hir_crate = rustc_ast_lowering::lower_to_hir;
620-
providers.write_dep_info = write_dep_info;
621620
providers.resolver_for_lowering = resolver_for_lowering;
622621
providers.early_lint_checks = early_lint_checks;
623622
proc_macro_decls::provide(providers);

compiler/rustc_interface/src/queries.rs

+7
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ impl<'tcx> Queries<'tcx> {
179179
})
180180
}
181181

182+
pub fn write_dep_info(&'tcx self) -> Result<()> {
183+
self.global_ctxt()?.enter(|tcx| {
184+
passes::write_dep_info(tcx);
185+
});
186+
Ok(())
187+
}
188+
182189
pub fn ongoing_codegen(&'tcx self) -> Result<Box<dyn Any>> {
183190
self.global_ctxt()?.enter(|tcx| {
184191
// Don't do code generation if there were any errors

compiler/rustc_middle/src/query/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1910,11 +1910,6 @@ rustc_queries! {
19101910
arena_cache
19111911
}
19121912

1913-
/// Write the dep-info file.
1914-
query write_dep_info(_: ()) -> () {
1915-
desc { "writing the dep-info file" }
1916-
}
1917-
19181913
/// Do not call this query directly: invoke `normalize` instead.
19191914
query normalize_projection_ty(
19201915
goal: CanonicalProjectionGoal<'tcx>

0 commit comments

Comments
 (0)