about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-05-28 15:41:51 -0400
committerOneirical <manchot@videotron.ca>2024-05-28 15:41:51 -0400
commitd553d5ba2d77feb67fde6649c03e8d1c486eb278 (patch)
treedec3e6c122c6913426bfe8dd3e15ba9597beb0a9
parentb4834a1c981b1ebddc9a4f33039f1348730540ba (diff)
downloadrust-d553d5ba2d77feb67fde6649c03e8d1c486eb278.tar.gz
rust-d553d5ba2d77feb67fde6649c03e8d1c486eb278.zip
rewrite incr-prev-body-beyond-eof in rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/incr-prev-body-beyond-eof/Makefile19
-rw-r--r--tests/run-make/incr-prev-body-beyond-eof/rmake.rs32
3 files changed, 32 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 845dd7f0eee..4e69d67057a 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -79,7 +79,6 @@ run-make/inaccessible-temp-dir/Makefile
 run-make/include_bytes_deps/Makefile
 run-make/incr-add-rust-src-component/Makefile
 run-make/incr-foreign-head-span/Makefile
-run-make/incr-prev-body-beyond-eof/Makefile
 run-make/incremental-debugger-visualizer/Makefile
 run-make/incremental-session-fail/Makefile
 run-make/inline-always-many-cgu/Makefile
diff --git a/tests/run-make/incr-prev-body-beyond-eof/Makefile b/tests/run-make/incr-prev-body-beyond-eof/Makefile
deleted file mode 100644
index aa47552f52c..00000000000
--- a/tests/run-make/incr-prev-body-beyond-eof/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# ignore-none no-std is not supported
-# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std`
-
-include ../tools.mk
-
-# Tests that we don't ICE during incremental compilation after modifying a
-# function span such that its previous end line exceeds the number of lines
-# in the new file, but its start line/column and length remain the same.
-
-SRC=$(TMPDIR)/src
-INCR=$(TMPDIR)/incr
-
-all:
-	mkdir $(SRC)
-	mkdir $(INCR)
-	cp a.rs $(SRC)/main.rs
-	$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET)
-	cp b.rs $(SRC)/main.rs
-	$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET)
diff --git a/tests/run-make/incr-prev-body-beyond-eof/rmake.rs b/tests/run-make/incr-prev-body-beyond-eof/rmake.rs
new file mode 100644
index 00000000000..43f137fea20
--- /dev/null
+++ b/tests/run-make/incr-prev-body-beyond-eof/rmake.rs
@@ -0,0 +1,32 @@
+// After modifying the span of a function, if the length of
+// the span remained the same but the end line number became different,
+// this would cause an internal compiler error (ICE), fixed in #76256.
+
+// This test compiles main.rs twice, first with end line 16 and
+// then with end line 12. If compilation is successful, the end line
+// was hashed by rustc in addition to the span length, and the fix still
+// works.
+
+// FIXME: Ignore flags temporarily disabled for the test.
+// ignore-none
+// ignore-nvptx64-nvidia-cuda
+
+use run_make_support::{rustc, target, tmp_dir};
+use std::fs;
+
+fn main() {
+    fs::create_dir(tmp_dir().join("src"));
+    fs::create_dir(tmp_dir().join("incr"));
+    fs::copy("a.rs", tmp_dir().join("main.rs"));
+    rustc()
+        .incremental(tmp_dir().join("incr"))
+        .input(tmp_dir().join("src/main.rs"))
+        .target(target())
+        .run();
+    fs::copy("b.rs", tmp_dir().join("main.rs"));
+    rustc()
+        .incremental(tmp_dir().join("incr"))
+        .input(tmp_dir().join("src/main.rs"))
+        .target(target())
+        .run();
+}