fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1.3 KiB36 linesraw
1-include ../tools.mk
2
3# Modelled after compile-fail/changing-crates test, but this one puts
4# more than one (mismatching) candidate crate into the search path,
5# which did not appear directly expressible in compile-fail/aux-build
6# infrastructure.
7#
8# Note that we move the built libraries into target direcrtories rather than
9# use the `--out-dir` option because the `../tools.mk` file already bakes a
10# use of `--out-dir` into the definition of $(RUSTC).
11
12A1=$(TMPDIR)/a1
13A2=$(TMPDIR)/a2
14A3=$(TMPDIR)/a3
15
16# A hack to match distinct lines of output from a single run.
17LOG=$(TMPDIR)/log.txt
18
19all:
20	mkdir -p $(A1) $(A2) $(A3)
21	$(RUSTC) --crate-type=rlib crateA1.rs
22	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A1)
23	$(RUSTC) --crate-type=rlib -L $(A1) crateB.rs
24	$(RUSTC) --crate-type=rlib crateA2.rs
25	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A2)
26	$(RUSTC) --crate-type=rlib crateA3.rs
27	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A3)
28	# Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match
29	$(RUSTC) -L $(A2) -L $(A3) crateC.rs >$(LOG) 2>&1 || true
30	$(CGREP) \
31		'found possibly newer version of crate `crateA` which `crateB` depends on' \
32		'note: perhaps that crate needs to be recompiled?' \
33		'crate `crateA`:' \
34		'crate `crateB`:' \
35		< $(LOG)
36	# the 'crate `crateA`' will match two entries.