Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/project-model/src/sysroot.rs')
-rw-r--r--crates/project-model/src/sysroot.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/project-model/src/sysroot.rs b/crates/project-model/src/sysroot.rs
index da862c9e87..fe046dd146 100644
--- a/crates/project-model/src/sysroot.rs
+++ b/crates/project-model/src/sysroot.rs
@@ -115,10 +115,19 @@ impl Sysroot {
Ok(Sysroot::load(sysroot_dir, src))
}
- pub fn discover_rustc(&self) -> Option<ManifestPath> {
+ pub fn discover_rustc_src(&self) -> Option<ManifestPath> {
get_rustc_src(&self.root)
}
+ pub fn discover_rustc(&self) -> Result<AbsPathBuf, std::io::Error> {
+ let rustc = self.root.join("bin/rustc");
+ tracing::debug!(?rustc, "checking for rustc binary at location");
+ match fs::metadata(&rustc) {
+ Ok(_) => Ok(rustc),
+ Err(e) => Err(e),
+ }
+ }
+
pub fn with_sysroot_dir(sysroot_dir: AbsPathBuf) -> Result<Sysroot> {
let sysroot_src_dir = discover_sysroot_src_dir(&sysroot_dir).ok_or_else(|| {
format_err!("can't load standard library from sysroot path {sysroot_dir}")