Move proc-macro-test test path fetching from include to env var

This commit is contained in:
Lukas Wirth 2024-06-30 15:37:00 +02:00
parent 0b88dfc8b1
commit 678420e66a
3 changed files with 3 additions and 5 deletions

View file

@ -1,7 +1,7 @@
//! Determine rustc version `proc-macro-srv` (and thus the sysroot ABI) is //! Determine rustc version `proc-macro-srv` (and thus the sysroot ABI) is
//! build with and make it accessible at runtime for ABI selection. //! build with and make it accessible at runtime for ABI selection.
use std::{env, fs::File, io::Write, path::PathBuf, process::Command}; use std::{env, process::Command};
fn main() { fn main() {
println!("cargo::rustc-check-cfg=cfg(rust_analyzer)"); println!("cargo::rustc-check-cfg=cfg(rust_analyzer)");

View file

@ -121,6 +121,5 @@ fn main() {
// This file is under `target_dir` and is already under `OUT_DIR`. // 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 artifact_path = artifact_path.expect("no dylib for proc-macro-test-impl found");
let info_path = out_dir.join("proc_macro_test_location.txt"); println!("cargo::rustc-env=PROC_MACRO_TEST_LOCATION={}", artifact_path.display());
fs::write(info_path, artifact_path.to_str().unwrap()).unwrap();
} }

View file

@ -1,4 +1,3 @@
//! Exports a few trivial procedural macros for testing. //! Exports a few trivial procedural macros for testing.
pub static PROC_MACRO_TEST_LOCATION: &str = pub static PROC_MACRO_TEST_LOCATION: &str = env!("PROC_MACRO_TEST_LOCATION");
include_str!(concat!(env!("OUT_DIR"), "/proc_macro_test_location.txt"));