1 //! Determine rustc version `proc-macro-srv` (and thus the sysroot ABI) is
2 //! build with and make it accessible at runtime for ABI selection.
4 use std::{env, fs::File, io::Write, path::PathBuf, process::Command};
7 let mut path = PathBuf::from(env::var_os("OUT_DIR").unwrap());
8 path.push("rustc_version.rs");
9 let mut f = File::create(&path).unwrap();
11 let rustc = env::var("RUSTC").expect("proc-macro-srv's build script expects RUSTC to be set");
12 let output = Command::new(rustc).arg("--version").output().expect("rustc --version must run");
13 let version_string = std::str::from_utf8(&output.stdout[..])
14 .expect("rustc --version output must be UTF-8")
21 pub(crate) const RUSTC_VERSION_STRING: &str = {version_string:?};