summaryrefslogtreecommitdiffstats
path: root/src/test/run-make/issue-85019-moved-src-dir
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/run-make/issue-85019-moved-src-dir
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-make/issue-85019-moved-src-dir')
-rw-r--r--src/test/run-make/issue-85019-moved-src-dir/Makefile28
-rw-r--r--src/test/run-make/issue-85019-moved-src-dir/main.rs5
-rw-r--r--src/test/run-make/issue-85019-moved-src-dir/my_lib.rs1
3 files changed, 34 insertions, 0 deletions
diff --git a/src/test/run-make/issue-85019-moved-src-dir/Makefile b/src/test/run-make/issue-85019-moved-src-dir/Makefile
new file mode 100644
index 000000000..3606d4fdf
--- /dev/null
+++ b/src/test/run-make/issue-85019-moved-src-dir/Makefile
@@ -0,0 +1,28 @@
+include ../../run-make-fulldeps/tools.mk
+
+INCR=$(TMPDIR)/incr
+FIRST_SRC=$(TMPDIR)/first_src
+SECOND_SRC=$(TMPDIR)/second_src
+
+# ignore-none no-std is not supported
+# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std'
+
+# Tests that we don't get an ICE when the working directory
+# (but not the build directory!) changes between compilation
+# sessions
+
+all:
+ mkdir $(INCR)
+ # Build from 'FIRST_SRC'
+ mkdir $(FIRST_SRC)
+ cp my_lib.rs $(FIRST_SRC)/my_lib.rs
+ cp main.rs $(FIRST_SRC)/main.rs
+ cd $(FIRST_SRC) && \
+ $(RUSTC) -C incremental=$(INCR) --crate-type lib my_lib.rs --target $(TARGET) && \
+ $(RUSTC) -C incremental=$(INCR) --extern my_lib=$(TMPDIR)/libmy_lib.rlib main.rs --target $(TARGET)
+ # Build from 'SECOND_SRC', keeping the output directory and incremental directory
+ # the same
+ mv $(FIRST_SRC) $(SECOND_SRC)
+ cd $(SECOND_SRC) && \
+ $(RUSTC) -C incremental=$(INCR) --crate-type lib my_lib.rs --target $(TARGET) && \
+ $(RUSTC) -C incremental=$(INCR) --extern my_lib=$(TMPDIR)/libmy_lib.rlib main.rs --target $(TARGET)
diff --git a/src/test/run-make/issue-85019-moved-src-dir/main.rs b/src/test/run-make/issue-85019-moved-src-dir/main.rs
new file mode 100644
index 000000000..543559a5c
--- /dev/null
+++ b/src/test/run-make/issue-85019-moved-src-dir/main.rs
@@ -0,0 +1,5 @@
+extern crate my_lib;
+
+fn main() {
+ my_lib::my_fn("hi");
+}
diff --git a/src/test/run-make/issue-85019-moved-src-dir/my_lib.rs b/src/test/run-make/issue-85019-moved-src-dir/my_lib.rs
new file mode 100644
index 000000000..432875739
--- /dev/null
+++ b/src/test/run-make/issue-85019-moved-src-dir/my_lib.rs
@@ -0,0 +1 @@
+pub fn my_fn<T: Copy>(_val: T) {}