about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-26 13:11:46 -0400
committerOneirical <manchot@videotron.ca>2024-06-26 13:11:46 -0400
commita6bb92ada7864cbd3bdc3c2a2cb998c0ba512bca (patch)
tree2deb37db19e2b4976d7664e37c5dbc54cf702b3c
parentbfc8dc8e5fb937ccc1e163e5f23d2561f0bd66c9 (diff)
downloadrust-a6bb92ada7864cbd3bdc3c2a2cb998c0ba512bca.tar.gz
rust-a6bb92ada7864cbd3bdc3c2a2cb998c0ba512bca.zip
rewrite overwrite-input to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/overwrite-input/Makefile7
-rw-r--r--tests/run-make/overwrite-input/file.stderr4
-rw-r--r--tests/run-make/overwrite-input/folder.stderr4
-rw-r--r--tests/run-make/overwrite-input/main.stderr6
-rw-r--r--tests/run-make/overwrite-input/rmake.rs13
6 files changed, 15 insertions, 20 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 199d9fd53f3..9d3c08ec832 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -119,7 +119,6 @@ run-make/optimization-remarks-dir-pgo/Makefile
 run-make/optimization-remarks-dir/Makefile
 run-make/output-type-permutations/Makefile
 run-make/override-aliased-flags/Makefile
-run-make/overwrite-input/Makefile
 run-make/panic-abort-eh_frame/Makefile
 run-make/pass-linker-flags-flavor/Makefile
 run-make/pass-linker-flags-from-dep/Makefile
diff --git a/tests/run-make/overwrite-input/Makefile b/tests/run-make/overwrite-input/Makefile
deleted file mode 100644
index 721bf62b26b..00000000000
--- a/tests/run-make/overwrite-input/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-include ../tools.mk
-
-all:
-	$(RUSTC) main.rs -o main.rs 2> $(TMPDIR)/file.stderr || echo "failed successfully"
-	$(RUSTC) main.rs -o . 2> $(TMPDIR)/folder.stderr || echo "failed successfully"
-	$(RUSTC_TEST_OP) "$(TMPDIR)"/file.stderr file.stderr
-	$(RUSTC_TEST_OP) "$(TMPDIR)"/folder.stderr folder.stderr
diff --git a/tests/run-make/overwrite-input/file.stderr b/tests/run-make/overwrite-input/file.stderr
index c13a270b067..3a741ae3852 100644
--- a/tests/run-make/overwrite-input/file.stderr
+++ b/tests/run-make/overwrite-input/file.stderr
@@ -1,6 +1,4 @@
-warning: ignoring --out-dir flag due to -o flag
-
 error: the input file "main.rs" would be overwritten by the generated executable
 
-error: aborting due to 1 previous error; 1 warning emitted
+error: aborting due to 1 previous error
 
diff --git a/tests/run-make/overwrite-input/folder.stderr b/tests/run-make/overwrite-input/folder.stderr
index 6e51cb812ce..30db08428fd 100644
--- a/tests/run-make/overwrite-input/folder.stderr
+++ b/tests/run-make/overwrite-input/folder.stderr
@@ -1,6 +1,4 @@
-warning: ignoring --out-dir flag due to -o flag
-
 error: the generated executable for the input file "main.rs" conflicts with the existing directory "."
 
-error: aborting due to 1 previous error; 1 warning emitted
+error: aborting due to 1 previous error
 
diff --git a/tests/run-make/overwrite-input/main.stderr b/tests/run-make/overwrite-input/main.stderr
deleted file mode 100644
index c13a270b067..00000000000
--- a/tests/run-make/overwrite-input/main.stderr
+++ /dev/null
@@ -1,6 +0,0 @@
-warning: ignoring --out-dir flag due to -o flag
-
-error: the input file "main.rs" would be overwritten by the generated executable
-
-error: aborting due to 1 previous error; 1 warning emitted
-
diff --git a/tests/run-make/overwrite-input/rmake.rs b/tests/run-make/overwrite-input/rmake.rs
new file mode 100644
index 00000000000..b87a7c7e0a8
--- /dev/null
+++ b/tests/run-make/overwrite-input/rmake.rs
@@ -0,0 +1,13 @@
+// An attempt to set the output `-o` into a directory or a file we cannot write into should indeed
+// be an error; but not an ICE (Internal Compiler Error). This test attempts both and checks
+// that the standard error matches what is expected.
+// See https://github.com/rust-lang/rust/issues/66530
+
+use run_make_support::{diff, rustc};
+
+fn main() {
+    let file_out = rustc().input("main.rs").output("main.rs").run_fail().stderr_utf8();
+    let folder_out = rustc().input("main.rs").output(".").run_fail().stderr_utf8();
+    diff().expected_file("file.stderr").actual_text("actual-file-stderr", file_out).run();
+    diff().expected_file("folder.stderr").actual_text("actual-folder-stderr", folder_out).run();
+}