fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1# ignore-cross-compile 2include ../tools.mk 3 4# rust-lang/rust#70924: Test that if we add rust-src component in between two 5# incremental compiles, the compiler does not ICE on the second. 6 7# This test uses `ln -s` rather than copying to save testing time, but its 8# usage doesn't work on windows. So ignore windows. 9 10# ignore-windows 11 12SYSROOT:=$(shell $(RUSTC) --print sysroot) 13FAKEROOT=$(TMPDIR)/fakeroot 14INCR=$(TMPDIR)/incr 15 16# Make a local copy of the sysroot; then remove the rust-src part of it, if 17# present, for the *first* build. Then put in a facsimile of the rust-src 18# component for the second build, in order to expose the ICE from issue #70924. 19# 20# Note that it is much easier to just do `cp -a $(SYSROOT)/* $(FAKEROOT)` as a 21# first step, but I am concerned that would be too expensive in a unit test 22# compared to making symbolic links. 23# 24# Anyway, the pattern you'll see here is: For every prefix in 25# root/lib/rustlib/src, link all of prefix parent content, then remove the 26# prefix, then loop on the next prefix. This way, we basically create a copy of 27# the context around root/lib/rustlib/src, and can freely add/remove the src 28# component itself. 29all: 30 mkdir $(FAKEROOT) 31 ln -s $(SYSROOT)/* $(FAKEROOT) 32 rm -f $(FAKEROOT)/lib 33 mkdir $(FAKEROOT)/lib 34 ln -s $(SYSROOT)/lib/* $(FAKEROOT)/lib 35 rm -f $(FAKEROOT)/lib/rustlib 36 mkdir $(FAKEROOT)/lib/rustlib 37 ln -s $(SYSROOT)/lib/rustlib/* $(FAKEROOT)/lib/rustlib 38 rm -f $(FAKEROOT)/lib/rustlib/src 39 mkdir $(FAKEROOT)/lib/rustlib/src 40 ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src 41 rm -f $(FAKEROOT)/lib/rustlib/src/rust 42 $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs 43 mkdir -p $(FAKEROOT)/lib/rustlib/src/rust/src/libstd 44 touch $(FAKEROOT)/lib/rustlib/src/rust/src/libstd/lib.rs 45 $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs