Skip to content

Commit

Permalink
ensure rustc returned a sysroot that exists on disk
Browse files Browse the repository at this point in the history
  • Loading branch information
lqd committed Dec 15, 2024
1 parent 2968c39 commit 862da08
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion collector/src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,14 @@ fn get_lib_dir_from_rustc(rustc: &Path) -> anyhow::Result<PathBuf> {
);
}
let sysroot_path = String::from_utf8_lossy(&output.stdout);
Ok(Path::new(sysroot_path.as_ref().trim()).join("lib"))
let lib_dir = Path::new(sysroot_path.as_ref().trim()).join("lib");
if !lib_dir.exists() {
anyhow::bail!(
"rustc returned non-existent sysroot: `{}`",
lib_dir.display()
);
}
Ok(lib_dir)
}

#[cfg(test)]
Expand Down

0 comments on commit 862da08

Please sign in to comment.