Skip to content

Commit 4b809b6

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

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
@@ -403,9 +403,7 @@ fn run_compiler(
403403
Ok(())
404404
})?;
405405

406-
// Make sure the `write_dep_info` query is run for its side
407-
// effects of writing the dep-info and reporting errors.
408-
queries.global_ctxt()?.enter(|tcx| tcx.write_dep_info(()));
406+
queries.write_dep_info()?;
409407
} else {
410408
let krate = queries.parse()?;
411409
pretty::print(
@@ -433,9 +431,7 @@ fn run_compiler(
433431
return early_exit();
434432
}
435433

436-
// Make sure the `write_dep_info` query is run for its side
437-
// effects of writing the dep-info and reporting errors.
438-
queries.global_ctxt()?.enter(|tcx| tcx.write_dep_info(()));
434+
queries.write_dep_info()?;
439435

440436
if sess.opts.output_types.contains_key(&OutputType::DepInfo)
441437
&& 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
@@ -171,6 +171,13 @@ impl<'tcx> Queries<'tcx> {
171171
})
172172
}
173173

174+
pub fn write_dep_info(&'tcx self) -> Result<()> {
175+
self.global_ctxt()?.enter(|tcx| {
176+
passes::write_dep_info(tcx);
177+
});
178+
Ok(())
179+
}
180+
174181
/// Check for the `#[rustc_error]` annotation, which forces an error in codegen. This is used
175182
/// to write UI tests that actually test that compilation succeeds without reporting
176183
/// an error.

compiler/rustc_middle/src/query/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1917,11 +1917,6 @@ rustc_queries! {
19171917
arena_cache
19181918
}
19191919

1920-
/// Write the dep-info file.
1921-
query write_dep_info(_: ()) -> () {
1922-
desc { "writing the dep-info file" }
1923-
}
1924-
19251920
/// Do not call this query directly: invoke `normalize` instead.
19261921
query normalize_projection_ty(
19271922
goal: CanonicalProjectionGoal<'tcx>

0 commit comments

Comments
 (0)