Skip to content

Commit 862da08

Browse files
committed
ensure rustc returned a sysroot that exists on disk
1 parent 2968c39 commit 862da08

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

collector/src/toolchain.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,14 @@ fn get_lib_dir_from_rustc(rustc: &Path) -> anyhow::Result<PathBuf> {
598598
);
599599
}
600600
let sysroot_path = String::from_utf8_lossy(&output.stdout);
601-
Ok(Path::new(sysroot_path.as_ref().trim()).join("lib"))
601+
let lib_dir = Path::new(sysroot_path.as_ref().trim()).join("lib");
602+
if !lib_dir.exists() {
603+
anyhow::bail!(
604+
"rustc returned non-existent sysroot: `{}`",
605+
lib_dir.display()
606+
);
607+
}
608+
Ok(lib_dir)
602609
}
603610

604611
#[cfg(test)]

0 commit comments

Comments
 (0)