Skip to content

Commit

Permalink
rewrite and rename issue-85019-moved-src-dir to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jul 12, 2024
1 parent cef8a04 commit c6cdbe6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 31 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ run-make/issue-47551/Makefile
run-make/issue-69368/Makefile
run-make/issue-83045/Makefile
run-make/issue-84395-lto-embed-bitcode/Makefile
run-make/issue-85019-moved-src-dir/Makefile
run-make/issue-85401-static-mir/Makefile
run-make/issue-88756-default-output/Makefile
run-make/issue-97463-abi-param-passing/Makefile
Expand Down
2 changes: 0 additions & 2 deletions tests/run-make/extra-filename-with-temp-outputs/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// are named as expected.
// See https://github.com/rust-lang/rust/pull/15686

//FIXME(Oneirical): ignore-cross-compile

use run_make_support::{
bin_name, cwd, fs_wrapper, has_prefix, has_suffix, rustc, shallow_find_files,
};
Expand Down
28 changes: 0 additions & 28 deletions tests/run-make/issue-85019-moved-src-dir/Makefile

This file was deleted.

38 changes: 38 additions & 0 deletions tests/run-make/moved-src-dir-fingerprint-ice/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// A SourceFile created during compilation may have a relative
// path (e.g. if rustc itself is invoked with a relative path).
// When we write out crate metadata, we convert all relative paths
// to absolute paths using the current working directory.
// However, the working directory was previously not included in the crate hash.
// This meant that the crate metadata could change while the crate
// hash remained the same. Among other problems, this could cause a
// fingerprint mismatch ICE, since incremental compilation uses
// the crate metadata hash to determine if a foreign query is green.
// This test checks that we don't get an ICE when the working directory
// (but not the build directory!) changes between compilation
// sessions.
// See https://github.com/rust-lang/rust/issues/85019

//@ 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("first_src");
fs_wrapper::create_dir("output");
fs_wrapper::rename("my_lib.rs", "first_src/my_lib.rs");
fs_wrapper::rename("main.rs", "first_src/main.rs");
// Build from "first_src"
std::env::set_current_dir("first_src").unwrap();
rustc().input("my_lib.rs").incremental("incr").crate_type("lib").run();
rustc().input("main.rs").incremental("incr").extern_("my_lib", rust_lib_name("my_lib")).run();
std::env::set_current_dir("..").unwrap();
fs_wrapper::rename("first_src", "second_src");
std::env::set_current_dir("second_src").unwrap();
// Build from "second_src" - the output and incremental directory remain identical
rustc().input("my_lib.rs").incremental("incr").crate_type("lib").run();
rustc().input("main.rs").incremental("incr").extern_("my_lib", rust_lib_name("my_lib")).run();
}

0 comments on commit c6cdbe6

Please sign in to comment.