Skip to content

Commit

Permalink
Auto merge of #114476 - Urgau:missing-dep-file-112898, r=oli-obk
Browse files Browse the repository at this point in the history
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 #112898
r? `@oli-obk`
  • Loading branch information
bors committed Aug 6, 2023
2 parents eb088b8 + 8229d8e commit 8236f63
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions tests/run-make/pretty-print-with-dep-file/Makefile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/run-make/pretty-print-with-dep-file/with-dep.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}

0 comments on commit 8236f63

Please sign in to comment.