Skip to content

Commit 2b849e6

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

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

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

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

451447
if sess.opts.output_types.contains_key(&OutputType::DepInfo)
452448
&& 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
@@ -176,6 +176,13 @@ impl<'tcx> Queries<'tcx> {
176176
})
177177
}
178178

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