Auto merge of #114476 - Urgau:missing-dep-file-112898, r=oli-obk

Fix missing dependency file with `-Zunpretty`

This PR force the `output_filenames` to be run ~~in every early exits like~~ when using `-Zunpretty`, so to respect the `dep-info` flag.

Fixes https://github.com/rust-lang/rust/issues/112898
r? `@oli-obk`
This commit is contained in:
bors 2023-08-06 00:04:52 +00:00
commit 8236f63aba
3 changed files with 14 additions and 0 deletions

View File

@ -391,6 +391,10 @@ fn run_compiler(
pretty::print_after_hir_lowering(tcx, *ppm);
Ok(())
})?;
// Make sure the `output_filenames` query is run for its side
// effects of writing the dep-info and reporting errors.
queries.global_ctxt()?.enter(|tcx| tcx.output_filenames(()));
} else {
let krate = queries.parse()?.steal();
pretty::print_after_parsing(sess, &krate, *ppm);

View File

@ -0,0 +1,9 @@
include ../tools.mk
all:
$(RUSTC) --emit=dep-info -Zunpretty=expanded with-dep.rs
$(CGREP) "with-dep.rs" < $(TMPDIR)/with-dep.d
-rm $(TMPDIR)/with-dep.d
$(RUSTC) --emit=dep-info -Zunpretty=normal with-dep.rs
! test -f $(TMPDIR)/with-dep.d

View File

@ -0,0 +1 @@
fn main() {}