aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-10-14 16:23:02 +0100
committerGitHub <[email protected]>2020-10-14 16:23:02 +0100
commit84d6cdef86dfe1054ecafaedfddbf90a2b3a469d (patch)
treeca1e57bb424553af4021b2f82c05ff1343fb02ac /crates
parentf7144dcd52c663cefc789445fe561771d935fbf0 (diff)
parent1b3b8c7fdaac900a1fac14db0246fb8e753d36fc (diff)
Merge #6230
6230: Log around sysroot discovery r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/project_model/src/sysroot.rs4
1 files changed, 4 insertions, 0 deletions
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 {
49 } 49 }
50 50
51 pub fn discover(cargo_toml: &AbsPath) -> Result<Sysroot> { 51 pub fn discover(cargo_toml: &AbsPath) -> Result<Sysroot> {
52 log::debug!("Discovering sysroot for {}", cargo_toml.display());
52 let current_dir = cargo_toml.parent().unwrap(); 53 let current_dir = cargo_toml.parent().unwrap();
53 let sysroot_src_dir = discover_sysroot_src_dir(current_dir)?; 54 let sysroot_src_dir = discover_sysroot_src_dir(current_dir)?;
54 let res = Sysroot::load(&sysroot_src_dir)?; 55 let res = Sysroot::load(&sysroot_src_dir)?;
@@ -115,12 +116,14 @@ fn discover_sysroot_src_dir(current_dir: &AbsPath) -> Result<AbsPathBuf> {
115 if let Ok(path) = env::var("RUST_SRC_PATH") { 116 if let Ok(path) = env::var("RUST_SRC_PATH") {
116 let path = AbsPathBuf::try_from(path.as_str()) 117 let path = AbsPathBuf::try_from(path.as_str())
117 .map_err(|path| format_err!("RUST_SRC_PATH must be absolute: {}", path.display()))?; 118 .map_err(|path| format_err!("RUST_SRC_PATH must be absolute: {}", path.display()))?;
119 log::debug!("Discovered sysroot by RUST_SRC_PATH: {}", path.display());
118 return Ok(path); 120 return Ok(path);
119 } 121 }
120 122
121 let sysroot_path = { 123 let sysroot_path = {
122 let mut rustc = Command::new(toolchain::rustc()); 124 let mut rustc = Command::new(toolchain::rustc());
123 rustc.current_dir(current_dir).args(&["--print", "sysroot"]); 125 rustc.current_dir(current_dir).args(&["--print", "sysroot"]);
126 log::debug!("Discovering sysroot by {:?}", rustc);
124 let stdout = utf8_stdout(rustc)?; 127 let stdout = utf8_stdout(rustc)?;
125 AbsPathBuf::assert(PathBuf::from(stdout)) 128 AbsPathBuf::assert(PathBuf::from(stdout))
126 }; 129 };
@@ -150,6 +153,7 @@ fn get_rust_src(sysroot_path: &AbsPath) -> Option<AbsPathBuf> {
150 // FIXME: remove `src` when 1.47 comes out 153 // FIXME: remove `src` when 1.47 comes out
151 // https://github.com/rust-lang/rust/pull/73265 154 // https://github.com/rust-lang/rust/pull/73265
152 let rust_src = sysroot_path.join("lib/rustlib/src/rust"); 155 let rust_src = sysroot_path.join("lib/rustlib/src/rust");
156 log::debug!("Checking sysroot (looking for `library` and `src` dirs): {}", rust_src.display());
153 ["library", "src"].iter().map(|it| rust_src.join(it)).find(|it| it.exists()) 157 ["library", "src"].iter().map(|it| rust_src.join(it)).find(|it| it.exists())
154} 158}
155 159