forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#72952 - pnkfelix:regression-test-for-issue-…
…70924, r=nikomatsakis run-make regression test for issue rust-lang#70924. Sometime after my PR rust-lang#72767 (to fix issue rust-lang#70924) landed, I realized that I *could* make a local regression test, thanks to `rustc --print sysroot`: I can make a fresh "copy" (really mostly symlinks) of the sysroot, and then modify it to recreate the terms of this bug.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/test/run-make-fulldeps/incr-add-rust-src-component/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-include ../tools.mk | ||
|
||
# rust-lang/rust#70924: Test that if we add rust-src component in between two | ||
# incremetnal compiles, the compiler does not ICE on the second. | ||
|
||
# This test uses `ln -s` rather than copying to save testing time, but its | ||
# usage doesn't work on windows. So ignore windows. | ||
|
||
# ignore-windows | ||
|
||
SYSROOT:=$(shell $(RUSTC) --print sysroot) | ||
FAKEROOT=$(TMPDIR)/fakeroot | ||
INCR=$(TMPDIR)/incr | ||
|
||
# Make a local copy of the sysroot; then remove the rust-src part of it, if | ||
# present, for the *first* build. Then put in a facsimile of the rust-src | ||
# component for the second build, in order to expose the ICE from issue #70924. | ||
# | ||
# Note that it is much easier to just do `cp -a $(SYSROOT)/* $(FAKEROOT)` as a | ||
# first step, but I am concerned that would be too expensive in a unit test | ||
# compared to making symbolic links. | ||
# | ||
# Anyway, the pattern you'll see here is: For every prefix in | ||
# root/lib/rustlib/src, link all of prefix parent content, then remove the | ||
# prefix, then loop on the next prefix. This way, we basically create a copy of | ||
# the context around root/lib/rustlib/src, and can freely add/remove the src | ||
# component itself. | ||
all: | ||
mkdir $(FAKEROOT) | ||
ln -s $(SYSROOT)/* $(FAKEROOT) | ||
rm -f $(FAKEROOT)/lib | ||
mkdir $(FAKEROOT)/lib | ||
ln -s $(SYSROOT)/lib/* $(FAKEROOT)/lib | ||
rm -f $(FAKEROOT)/lib/rustlib | ||
mkdir $(FAKEROOT)/lib/rustlib | ||
ln -s $(SYSROOT)/lib/rustlib/* $(FAKEROOT)/lib/rustlib | ||
rm -f $(FAKEROOT)/lib/rustlib/src | ||
mkdir $(FAKEROOT)/lib/rustlib/src | ||
ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src | ||
rm -f $(FAKEROOT)/lib/rustlib/src/rust | ||
$(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs | ||
mkdir -p $(FAKEROOT)/lib/rustlib/src/rust/src/libstd | ||
touch $(FAKEROOT)/lib/rustlib/src/rust/src/libstd/lib.rs | ||
$(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs |
3 changes: 3 additions & 0 deletions
3
src/test/run-make-fulldeps/incr-add-rust-src-component/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("Hello World"); | ||
} |