Skip to content

Commit bea98b1

Browse files
committed
Turn write_dep_info into a regular function
It has side-effects and as such can't be cached.
1 parent 5091b8c commit bea98b1

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
@@ -408,9 +408,7 @@ fn run_compiler(
408408
Ok(())
409409
})?;
410410

411-
// Make sure the `write_dep_info` query is run for its side
412-
// effects of writing the dep-info and reporting errors.
413-
queries.global_ctxt()?.enter(|tcx| tcx.write_dep_info(()));
411+
queries.write_dep_info()?;
414412
} else {
415413
let krate = queries.parse()?;
416414
pretty::print(
@@ -443,9 +441,7 @@ fn run_compiler(
443441
return early_exit();
444442
}
445443

446-
// Make sure the `write_dep_info` query is run for its side
447-
// effects of writing the dep-info and reporting errors.
448-
queries.global_ctxt()?.enter(|tcx| tcx.write_dep_info(()));
444+
queries.write_dep_info()?;
449445

450446
if sess.opts.output_types.contains_key(&OutputType::DepInfo)
451447
&& sess.opts.output_types.len() == 1

compiler/rustc_interface/src/passes.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ fn resolver_for_lowering<'tcx>(
553553
tcx.arena.alloc(Steal::new((untracked_resolver_for_lowering, Lrc::new(krate))))
554554
}
555555

556-
fn write_dep_info(tcx: TyCtxt<'_>, (): ()) {
556+
pub(crate) fn write_dep_info(tcx: TyCtxt<'_>) {
557557
// Make sure name resolution and macro expansion is run for
558558
// the side-effect of providing a complete set of all
559559
// accessed files and env vars.
@@ -606,7 +606,6 @@ pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
606606
let providers = &mut Providers::default();
607607
providers.analysis = analysis;
608608
providers.hir_crate = rustc_ast_lowering::lower_to_hir;
609-
providers.write_dep_info = write_dep_info;
610609
providers.resolver_for_lowering = resolver_for_lowering;
611610
providers.early_lint_checks = early_lint_checks;
612611
proc_macro_decls::provide(providers);

compiler/rustc_interface/src/queries.rs

+7
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ impl<'tcx> Queries<'tcx> {
177177
})
178178
}
179179

180+
pub fn write_dep_info(&'tcx self) -> Result<()> {
181+
self.global_ctxt()?.enter(|tcx| {
182+
passes::write_dep_info(tcx);
183+
});
184+
Ok(())
185+
}
186+
180187
pub fn ongoing_codegen(&'tcx self) -> Result<Box<dyn Any>> {
181188
self.global_ctxt()?.enter(|tcx| {
182189
// 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)