Add note if RUST_SRC_PATH is likely to be wrong

This commit is contained in:
Jonas Schievink 2020-10-09 16:11:16 +02:00
parent c1a8c03299
commit 7d0772e796

View File

@ -90,9 +90,15 @@ impl Sysroot {
}
if sysroot.by_name("core").is_none() {
let var_note = if env::var_os("RUST_SRC_PATH").is_some() {
" (`RUST_SRC_PATH` might be set incorrectly)"
} else {
""
};
anyhow::bail!(
"could not find libcore in sysroot path `{}`",
sysroot_src_dir.as_ref().display()
"could not find libcore in sysroot path `{}`{}",
sysroot_src_dir.as_ref().display(),
var_note,
);
}