diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-21 19:48:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-21 19:48:02 +0000 |
| commit | d2b89ebb92593139dc3eb9738ef7bef7bb5bf414 (patch) | |
| tree | 9cac4d20cec39106408ce7e5027b079e6cd966a1 | |
| parent | 8b3d93ee29619c090878679d06477fe9d32bc14d (diff) | |
| parent | d368b663bdb8a6239d4a487112d4246e76d2c542 (diff) | |
| download | rust-d2b89ebb92593139dc3eb9738ef7bef7bb5bf414.tar.gz rust-d2b89ebb92593139dc3eb9738ef7bef7bb5bf414.zip | |
Merge #9363
9363: Set explicit target directory to avoid cargo deadlock r=jonas-schievink a=oxalica Fix #9360 r? @jonas-schievink Co-authored-by: oxalica <oxalicc@pm.me>
| -rw-r--r-- | crates/proc_macro_test/build.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/proc_macro_test/build.rs b/crates/proc_macro_test/build.rs index 4653a93dde1..1e7aa026fa5 100644 --- a/crates/proc_macro_test/build.rs +++ b/crates/proc_macro_test/build.rs @@ -17,9 +17,16 @@ fn main() { let name = "proc_macro_test_impl"; let version = "0.0.0"; + let target_dir = out_dir.join("target"); let output = Command::new(toolchain::cargo()) .current_dir("imp") .args(&["build", "-p", "proc_macro_test_impl", "--message-format", "json"]) + // Explicit override the target directory to avoid using the same one which the parent + // cargo is using, or we'll deadlock. + // This can happen when `CARGO_TARGET_DIR` is set or global config forces all cargo + // instance to use the same target directory. + .arg("--target-dir") + .arg(&target_dir) .output() .unwrap(); assert!(output.status.success()); @@ -39,10 +46,9 @@ fn main() { } } - let src_path = artifact_path.expect("no dylib for proc_macro_test_impl found"); - let dest_path = out_dir.join(src_path.file_name().unwrap()); - fs::copy(src_path, &dest_path).unwrap(); + // This file is under `target_dir` and is already under `OUT_DIR`. + let artifact_path = artifact_path.expect("no dylib for proc_macro_test_impl found"); let info_path = out_dir.join("proc_macro_test_location.txt"); - fs::write(info_path, dest_path.to_str().unwrap()).unwrap(); + fs::write(info_path, artifact_path.to_str().unwrap()).unwrap(); } |
