rewrite and rename issue-83112-incr-test-moved-file to rmake

This commit is contained in:
Oneirical 2024-07-09 16:13:45 -04:00
parent 9dcaa7f92c
commit 37599b2072
4 changed files with 27 additions and 26 deletions

View File

@ -62,7 +62,6 @@ run-make/issue-36710/Makefile
run-make/issue-47551/Makefile
run-make/issue-69368/Makefile
run-make/issue-83045/Makefile
run-make/issue-83112-incr-test-moved-file/Makefile
run-make/issue-84395-lto-embed-bitcode/Makefile
run-make/issue-85019-moved-src-dir/Makefile
run-make/issue-85401-static-mir/Makefile

View File

@ -0,0 +1,27 @@
// The generated test harness code contains spans with a dummy location,
// but a non-dummy SyntaxContext. Previously, the incremental cache was encoding
// these spans as a full span (with a source file index), instead of skipping
// the encoding of the location information. If the file gest moved, the hash
// of the span will be unchanged (since it has a dummy location), so the incr
// cache would end up try to load a non-existent file using the previously
// enccoded source file id.
// This test reproduces the steps that used to trigger this bug, and checks
// for successful compilation.
// See https://github.com/rust-lang/rust/issues/83112
//@ ignore-none
// Reason: no-std is not supported
//@ ignore-nvptx64-nvidia-cuda
// FIXME: can't find crate for 'std'
use run_make_support::{fs_wrapper, rust_lib_name, rustc};
fn main() {
fs_wrapper::create_dir("incr");
fs_wrapper::create_dir("src");
fs_wrapper::create_dir("src/mydir");
fs_wrapper::copy("main.rs", "src/main.rs");
rustc().input("src/main.rs").incremental("incr").arg("--test").run();
fs_wrapper::rename("src/main.rs", "src/mydir/main.rs");
rustc().input("src/mydir/main.rs").incremental("incr").arg("--test").run();
}

View File

@ -1,25 +0,0 @@
include ../tools.mk
# ignore-none no-std is not supported
# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std'
# Regression test for issue #83112
# The generated test harness code contains spans with a dummy location,
# but a non-dummy SyntaxContext. Previously, the incremental cache was encoding
# these spans as a full span (with a source file index), instead of skipping
# the encoding of the location information. If the file gest moved, the hash
# of the span will be unchanged (since it has a dummy location), so the incr
# cache would end up try to load a non-existent file using the previously
# enccoded source file id.
SRC=$(TMPDIR)/src
INCR=$(TMPDIR)/incr
all:
mkdir $(SRC)
mkdir $(SRC)/mydir
mkdir $(INCR)
cp main.rs $(SRC)/main.rs
$(RUSTC) --test -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET)
mv $(SRC)/main.rs $(SRC)/mydir/main.rs
$(RUSTC) --test -C incremental=$(INCR) $(SRC)/mydir/main.rs --target $(TARGET)