diff options
| author | bors <bors@rust-lang.org> | 2021-06-22 17:34:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-06-22 17:34:55 +0000 |
| commit | b8be3162d734f3583b240977615f3e1bae6b364a (patch) | |
| tree | 2ec2e82248d3bd3ba7155285f6759bbe40feffdf /src | |
| parent | 80926fc409d671e7da13f08c90642b1e71f800d9 (diff) | |
| parent | 45146978e8d593d5ec713f54140407d64f620800 (diff) | |
| download | rust-b8be3162d734f3583b240977615f3e1bae6b364a.tar.gz rust-b8be3162d734f3583b240977615f3e1bae6b364a.zip | |
Auto merge of #86045 - jsgf:fix-emit-path-hashing, r=bjorn3
Fix emit path hashing With `--emit KIND=PATH`, the PATH should not affect hashes used for dependency tracking. It does not with other ways of specifying output paths (`-o` or `--out-dir`). Also updates `rustc -Zls` to print more info about crates, which is used here to implement a `run-make` test. It seems there was already a test explicitly checking that `OutputTypes` hash *is* affected by the path. I think this behaviour is wrong, so I updated the test.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/run-make/emit-path-unhashed/Makefile | 37 | ||||
| -rw-r--r-- | src/test/run-make/emit-path-unhashed/foo.rs | 1 |
2 files changed, 38 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..b6b2d8af648 --- /dev/null +++ b/src/test/run-make/emit-path-unhashed/Makefile @@ -0,0 +1,37 @@ +-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 $(OUT)/c/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 + $(RUSTC) -Zls $(OUT)/c/libfoo.rlib > $(TMPDIR)/c.txt + + diff $(TMPDIR)/base.txt $(TMPDIR)/a.txt + diff $(TMPDIR)/base.txt $(TMPDIR)/b.txt + + # Different KIND parameters do affect hash. + # diff exits 1 on difference, 2 on trouble + diff $(TMPDIR)/base.txt $(TMPDIR)/c.txt ; test "$$?" -eq 1 + +# 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 + +# Output multiple kinds +$(OUT)/c/libfoo.rlib: foo.rs + mkdir -p $(OUT)/c + $(RUSTC) --emit link=$@,metadata 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"] |
