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.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/project-model/src/sysroot.rs b/crates/project-model/src/sysroot.rs index e1dde12bad..328d2fbcf3 100644 --- a/crates/project-model/src/sysroot.rs +++ b/crates/project-model/src/sysroot.rs @@ -76,6 +76,7 @@ impl Sysroot { } } +// FIXME: Expose a builder api as loading the sysroot got way too modular and complicated. impl Sysroot { /// Attempts to discover the toolchain's sysroot from the given `dir`. pub fn discover(dir: &AbsPath, extra_env: &FxHashMap<String, String>) -> Result<Sysroot> { @@ -86,6 +87,16 @@ impl Sysroot { Ok(Sysroot::load(sysroot_dir, sysroot_src_dir)) } + pub fn discover_with_src_override( + dir: &AbsPath, + extra_env: &FxHashMap<String, String>, + src: AbsPathBuf, + ) -> Result<Sysroot> { + tracing::debug!("discovering sysroot for {}", dir.display()); + let sysroot_dir = discover_sysroot_dir(dir, extra_env)?; + Ok(Sysroot::load(sysroot_dir, src)) + } + pub fn discover_rustc( cargo_toml: &ManifestPath, extra_env: &FxHashMap<String, String>, |