Skip to content

Commit d226890

Browse files
committed
rewrite and rename issue-10971-temps-dir to rmake format
1 parent bbe9a9c commit d226890

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ run-make/invalid-library/Makefile
7979
run-make/invalid-so/Makefile
8080
run-make/invalid-staticlib/Makefile
8181
run-make/issue-107094/Makefile
82-
run-make/issue-10971-temps-dir/Makefile
8382
run-make/issue-109934-lto-debuginfo/Makefile
8483
run-make/issue-14698/Makefile
8584
run-make/issue-15460/Makefile

tests/run-make/issue-10971-temps-dir/Makefile

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// When two instances of rustc are invoked in parallel, they
2+
// can conflict on their temporary files and overwrite each others',
3+
// leading to unsuccessful compilation. The -Z temps-dir flag adds
4+
// separate designated directories for each rustc invocation, preventing
5+
// conflicts. This test uses this flag and checks for successful compilation.
6+
// See https://github.com/rust-lang/rust/pull/83846
7+
8+
use run_make_support::{fs_wrapper, rustc};
9+
use std::thread;
10+
11+
fn main() {
12+
fs_wrapper::create_file("lib.rs");
13+
let handle1 = thread::spawn(move || {
14+
rustc().crate_type("lib").arg("-Ztemps-dir=temp1").input("lib.rs");
15+
});
16+
17+
let handle2 = thread::spawn(move || {
18+
rustc().crate_type("staticlib").arg("-Ztemps-dir=temp2").input("lib.rs");
19+
});
20+
handle1.join().expect("lib thread panicked");
21+
handle2.join().expect("staticlib thread panicked");
22+
}

0 commit comments

Comments
 (0)