From 1b3b8c7fdaac900a1fac14db0246fb8e753d36fc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 14 Oct 2020 17:18:33 +0200 Subject: Log around sysroot discovery --- crates/project_model/src/sysroot.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/project_model/src/sysroot.rs b/crates/project_model/src/sysroot.rs index e529e07b0..b2ff98a15 100644 --- a/crates/project_model/src/sysroot.rs +++ b/crates/project_model/src/sysroot.rs @@ -49,6 +49,7 @@ impl Sysroot { } pub fn discover(cargo_toml: &AbsPath) -> Result { + log::debug!("Discovering sysroot for {}", cargo_toml.display()); let current_dir = cargo_toml.parent().unwrap(); let sysroot_src_dir = discover_sysroot_src_dir(current_dir)?; let res = Sysroot::load(&sysroot_src_dir)?; @@ -115,12 +116,14 @@ fn discover_sysroot_src_dir(current_dir: &AbsPath) -> Result { if let Ok(path) = env::var("RUST_SRC_PATH") { let path = AbsPathBuf::try_from(path.as_str()) .map_err(|path| format_err!("RUST_SRC_PATH must be absolute: {}", path.display()))?; + log::debug!("Discovered sysroot by RUST_SRC_PATH: {}", path.display()); return Ok(path); } let sysroot_path = { let mut rustc = Command::new(toolchain::rustc()); rustc.current_dir(current_dir).args(&["--print", "sysroot"]); + log::debug!("Discovering sysroot by {:?}", rustc); let stdout = utf8_stdout(rustc)?; AbsPathBuf::assert(PathBuf::from(stdout)) }; @@ -150,6 +153,7 @@ fn get_rust_src(sysroot_path: &AbsPath) -> Option { // FIXME: remove `src` when 1.47 comes out // https://github.com/rust-lang/rust/pull/73265 let rust_src = sysroot_path.join("lib/rustlib/src/rust"); + log::debug!("Checking sysroot (looking for `library` and `src` dirs): {}", rust_src.display()); ["library", "src"].iter().map(|it| rust_src.join(it)).find(|it| it.exists()) } -- cgit v1.2.3