about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2021-06-05 15:43:12 -0700
committerJeremy Fitzhardinge <jsgf@fb.com>2021-06-21 17:22:35 -0700
commita26d99f348de873e7a7b2b9ab6e78506278c0fee (patch)
treec50432ea04c7ffddfc2974f3ea8ccec972310507 /src
parentcef3ab75b12155e0582dd8b7710b7b901215fdd6 (diff)
downloadrust-a26d99f348de873e7a7b2b9ab6e78506278c0fee.tar.gz
rust-a26d99f348de873e7a7b2b9ab6e78506278c0fee.zip
In --emit KIND=PATH options, only hash KIND
The PATH has no material effect on the emitted artifact, and setting
the patch via `-o` or `--out-dir` does not affect the hash.

Closes https://github.com/rust-lang/rust/issues/86044
Diffstat (limited to 'src')
-rw-r--r--src/test/run-make/emit-path-unhashed/Makefile26
-rw-r--r--src/test/run-make/emit-path-unhashed/foo.rs1
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/run-make/emit-path-unhashed/Makefile b/src/test/run-make/emit-path-unhashed/Makefile
new file mode 100644
index 00000000000..bd04b3aa423
--- /dev/null
+++ b/src/test/run-make/emit-path-unhashed/Makefile
@@ -0,0 +1,26 @@
+-include ../../run-make-fulldeps/tools.mk
+
+OUT=$(TMPDIR)/emit
+
+# --emit KIND=PATH should not affect crate hash vs --emit KIND
+all: $(OUT)/a/libfoo.rlib $(OUT)/b/libfoo.rlib $(TMPDIR)/libfoo.rlib
+	$(RUSTC) -Zls $(TMPDIR)/libfoo.rlib > $(TMPDIR)/base.txt
+	$(RUSTC) -Zls $(OUT)/a/libfoo.rlib > $(TMPDIR)/a.txt
+	$(RUSTC) -Zls $(OUT)/b/libfoo.rlib > $(TMPDIR)/b.txt
+
+	diff $(TMPDIR)/base.txt $(TMPDIR)/a.txt
+	diff $(TMPDIR)/base.txt $(TMPDIR)/b.txt
+
+# Default output name
+$(TMPDIR)/libfoo.rlib: foo.rs
+	$(RUSTC) --emit link foo.rs
+
+# Output named with -o
+$(OUT)/a/libfoo.rlib: foo.rs
+	mkdir -p $(OUT)/a
+	$(RUSTC) --emit link -o $@ foo.rs
+
+# Output named with KIND=PATH
+$(OUT)/b/libfoo.rlib: foo.rs
+	mkdir -p $(OUT)/b
+	$(RUSTC) --emit link=$@ foo.rs
diff --git a/src/test/run-make/emit-path-unhashed/foo.rs b/src/test/run-make/emit-path-unhashed/foo.rs
new file mode 100644
index 00000000000..c1bfaa6cab5
--- /dev/null
+++ b/src/test/run-make/emit-path-unhashed/foo.rs
@@ -0,0 +1 @@
+#![crate_type = "rlib"]