summaryrefslogtreecommitdiffstats
path: root/tests/run-make/issue-83112-incr-test-moved-file
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/run-make/issue-83112-incr-test-moved-file
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/issue-83112-incr-test-moved-file')
-rw-r--r--tests/run-make/issue-83112-incr-test-moved-file/Makefile25
-rw-r--r--tests/run-make/issue-83112-incr-test-moved-file/main.rs1
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/run-make/issue-83112-incr-test-moved-file/Makefile b/tests/run-make/issue-83112-incr-test-moved-file/Makefile
new file mode 100644
index 000000000..2f796e5b2
--- /dev/null
+++ b/tests/run-make/issue-83112-incr-test-moved-file/Makefile
@@ -0,0 +1,25 @@
+include ../../run-make-fulldeps/tools.mk
+
+# ignore-none no-std is not supported
+# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std'
+
+# Regression test for issue #83112
+# The generated test harness code contains spans with a dummy location,
+# but a non-dummy SyntaxContext. Previously, the incremental cache was encoding
+# these spans as a full span (with a source file index), instead of skipping
+# the encoding of the location information. If the file gest moved, the hash
+# of the span will be unchanged (since it has a dummy location), so the incr
+# cache would end up try to load a non-existent file using the previously
+# enccoded source file id.
+
+SRC=$(TMPDIR)/src
+INCR=$(TMPDIR)/incr
+
+all:
+ mkdir $(SRC)
+ mkdir $(SRC)/mydir
+ mkdir $(INCR)
+ cp main.rs $(SRC)/main.rs
+ $(RUSTC) --test -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET)
+ mv $(SRC)/main.rs $(SRC)/mydir/main.rs
+ $(RUSTC) --test -C incremental=$(INCR) $(SRC)/mydir/main.rs --target $(TARGET)
diff --git a/tests/run-make/issue-83112-incr-test-moved-file/main.rs b/tests/run-make/issue-83112-incr-test-moved-file/main.rs
new file mode 100644
index 000000000..f328e4d9d
--- /dev/null
+++ b/tests/run-make/issue-83112-incr-test-moved-file/main.rs
@@ -0,0 +1 @@
+fn main() {}