aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_test
diff options
context:
space:
mode:
Diffstat (limited to 'crates/proc_macro_test')
-rw-r--r--crates/proc_macro_test/build.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/proc_macro_test/build.rs b/crates/proc_macro_test/build.rs
index 4653a93dd..1e7aa026f 100644
--- a/crates/proc_macro_test/build.rs
+++ b/crates/proc_macro_test/build.rs
@@ -17,9 +17,16 @@ fn main() {
17 17
18 let name = "proc_macro_test_impl"; 18 let name = "proc_macro_test_impl";
19 let version = "0.0.0"; 19 let version = "0.0.0";
20 let target_dir = out_dir.join("target");
20 let output = Command::new(toolchain::cargo()) 21 let output = Command::new(toolchain::cargo())
21 .current_dir("imp") 22 .current_dir("imp")
22 .args(&["build", "-p", "proc_macro_test_impl", "--message-format", "json"]) 23 .args(&["build", "-p", "proc_macro_test_impl", "--message-format", "json"])
24 // Explicit override the target directory to avoid using the same one which the parent
25 // cargo is using, or we'll deadlock.
26 // This can happen when `CARGO_TARGET_DIR` is set or global config forces all cargo
27 // instance to use the same target directory.
28 .arg("--target-dir")
29 .arg(&target_dir)
23 .output() 30 .output()
24 .unwrap(); 31 .unwrap();
25 assert!(output.status.success()); 32 assert!(output.status.success());
@@ -39,10 +46,9 @@ fn main() {
39 } 46 }
40 } 47 }
41 48
42 let src_path = artifact_path.expect("no dylib for proc_macro_test_impl found"); 49 // This file is under `target_dir` and is already under `OUT_DIR`.
43 let dest_path = out_dir.join(src_path.file_name().unwrap()); 50 let artifact_path = artifact_path.expect("no dylib for proc_macro_test_impl found");
44 fs::copy(src_path, &dest_path).unwrap();
45 51
46 let info_path = out_dir.join("proc_macro_test_location.txt"); 52 let info_path = out_dir.join("proc_macro_test_location.txt");
47 fs::write(info_path, dest_path.to_str().unwrap()).unwrap(); 53 fs::write(info_path, artifact_path.to_str().unwrap()).unwrap();
48} 54}