about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-26 10:39:45 -0400
committerOneirical <manchot@videotron.ca>2024-06-26 10:39:45 -0400
commit2ffff791ce0d5d29a0e47d9c5519fcccdb696e9f (patch)
tree7db6e502fc1b8d51d608b87b50303f477e8a0871
parentbae813a265014c22c37457ccf0d29fc6822b88da (diff)
downloadrust-2ffff791ce0d5d29a0e47d9c5519fcccdb696e9f.tar.gz
rust-2ffff791ce0d5d29a0e47d9c5519fcccdb696e9f.zip
rewrite pretty-print-with-dep-file to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/pretty-print-with-dep-file/Makefile9
-rw-r--r--tests/run-make/pretty-print-with-dep-file/rmake.rs17
3 files changed, 17 insertions, 10 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index cb68589d8a4..2f64b6004fd 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -134,7 +134,6 @@ run-make/pgo-indirect-call-promotion/Makefile
 run-make/pgo-use/Makefile
 run-make/pointer-auth-link-with-c/Makefile
 run-make/pretty-print-to-file/Makefile
-run-make/pretty-print-with-dep-file/Makefile
 run-make/print-calling-conventions/Makefile
 run-make/print-target-list/Makefile
 run-make/profile/Makefile
diff --git a/tests/run-make/pretty-print-with-dep-file/Makefile b/tests/run-make/pretty-print-with-dep-file/Makefile
deleted file mode 100644
index fa8089eb6a5..00000000000
--- a/tests/run-make/pretty-print-with-dep-file/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-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
diff --git a/tests/run-make/pretty-print-with-dep-file/rmake.rs b/tests/run-make/pretty-print-with-dep-file/rmake.rs
new file mode 100644
index 00000000000..859a9781bb6
--- /dev/null
+++ b/tests/run-make/pretty-print-with-dep-file/rmake.rs
@@ -0,0 +1,17 @@
+// Passing --emit=dep-info to the Rust compiler should create a .d file...
+// but it failed to do so in Rust 1.69.0 when combined with -Z unpretty=expanded
+// due to a bug. This test checks that -Z unpretty=expanded does not prevent the
+// generation of the dep-info file, and that its -Z unpretty=normal counterpart
+// does not get an unexpected dep-info file.
+// See https://github.com/rust-lang/rust/issues/112898
+
+use run_make_support::{fs_wrapper, invalid_utf8_contains, rustc};
+use std::path::Path;
+
+fn main() {
+    rustc().emit("dep-info").arg("-Zunpretty=expanded").input("with-dep.rs").run();
+    invalid_utf8_contains("with-dep.d", "with-dep.rs");
+    fs_wrapper::remove_file("with-dep.d");
+    rustc().emit("dep-info").arg("-Zunpretty=normal").input("with-dep.rs").run();
+    assert!(!Path::new("with-dep.d").exists());
+}