diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
commit | a4b7ed7a42c716ab9f05e351f003d589124fd55d (patch) | |
tree | b620cd3f223850b28716e474e80c58059dca5dd4 /tests/run-make/incr-foreign-head-span | |
parent | Adding upstream version 1.67.1+dfsg1. (diff) | |
download | rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip |
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/incr-foreign-head-span')
-rw-r--r-- | tests/run-make/incr-foreign-head-span/Makefile | 21 | ||||
-rw-r--r-- | tests/run-make/incr-foreign-head-span/first_crate.rs | 1 | ||||
-rw-r--r-- | tests/run-make/incr-foreign-head-span/second_crate.rs | 8 |
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/run-make/incr-foreign-head-span/Makefile b/tests/run-make/incr-foreign-head-span/Makefile new file mode 100644 index 000000000..712965eaa --- /dev/null +++ b/tests/run-make/incr-foreign-head-span/Makefile @@ -0,0 +1,21 @@ +include ../../run-make-fulldeps/tools.mk + +# ignore-none no-std is not supported +# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std' + +# Ensure that modifying a crate on disk (without recompiling it) +# does not cause ICEs in downstream crates. +# Previously, we would call `SourceMap.guess_head_span` on a span +# from an external crate, which would cause us to read an upstream +# source file from disk during compilation of a downstream crate +# See #86480 for more details + +INCR=$(TMPDIR)/incr + +all: + cp first_crate.rs second_crate.rs $(TMPDIR) + $(RUSTC) $(TMPDIR)/first_crate.rs -C incremental=$(INCR) --target $(TARGET) --crate-type lib + $(RUSTC) $(TMPDIR)/second_crate.rs -C incremental=$(INCR) --target $(TARGET) --extern first-crate=$(TMPDIR) --crate-type lib + rm $(TMPDIR)/first_crate.rs + $(RUSTC) $(TMPDIR)/second_crate.rs -C incremental=$(INCR) --target $(TARGET) --cfg second_run --crate-type lib + diff --git a/tests/run-make/incr-foreign-head-span/first_crate.rs b/tests/run-make/incr-foreign-head-span/first_crate.rs new file mode 100644 index 000000000..69dd103bf --- /dev/null +++ b/tests/run-make/incr-foreign-head-span/first_crate.rs @@ -0,0 +1 @@ +pub trait OtherTrait {} diff --git a/tests/run-make/incr-foreign-head-span/second_crate.rs b/tests/run-make/incr-foreign-head-span/second_crate.rs new file mode 100644 index 000000000..102f6b26c --- /dev/null +++ b/tests/run-make/incr-foreign-head-span/second_crate.rs @@ -0,0 +1,8 @@ +extern crate first_crate; +use first_crate::OtherTrait; + +#[cfg(not(second_run))] +trait Foo: OtherTrait {} + +#[cfg(second_run)] +trait Bar: OtherTrait {} |