This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-11
lines changed
parallel-rustc-no-overwrite Expand file tree Collapse file tree 3 files changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,6 @@ run-make/invalid-library/Makefile
7979run-make/invalid-so/Makefile
8080run-make/invalid-staticlib/Makefile
8181run-make/issue-107094/Makefile
82- run-make/issue-10971-temps-dir/Makefile
8382run-make/issue-109934-lto-debuginfo/Makefile
8483run-make/issue-14698/Makefile
8584run-make/issue-15460/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments