We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
sysroot
1 parent c234b83 commit b4742e4Copy full SHA for b4742e4
src/tools/run-make-support/src/external_deps/rustc.rs
@@ -1,5 +1,6 @@
1
use std::ffi::{OsStr, OsString};
2
-use std::path::Path;
+use std::path::{Path, PathBuf};
3
+use std::str::FromStr as _;
4
5
use crate::command::Command;
6
use crate::env::env_var;
@@ -390,3 +391,10 @@ impl Rustc {
390
391
self
392
}
393
394
+
395
+/// Query the sysroot path corresponding `rustc --print=sysroot`.
396
+#[track_caller]
397
+pub fn sysroot() -> PathBuf {
398
+ let path = rustc().print("sysroot").run().stdout_utf8();
399
+ PathBuf::from_str(path.trim()).unwrap()
400
+}
0 commit comments