Skip to content

Commit

Permalink
Include toolchain specification in error message
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <[email protected]>
  • Loading branch information
Rustin170506 committed Jun 25, 2021
1 parent 4c27c96 commit 00bf770
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cargo/core/compiler/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,19 @@ fn detect_sysroot_src_path(target_data: &RustcTargetData<'_>) -> CargoResult<Pat
.join("rust");
let lock = src_path.join("Cargo.lock");
if !lock.exists() {
anyhow::bail!(
let msg = format!(
"{:?} does not exist, unable to build with the standard \
library, try:\n rustup component add rust-src",
lock
);
match env::var("RUSTUP_TOOLCHAIN") {
Ok(rustup_toolchain) => {
anyhow::bail!("{} --toolchain {}", msg, rustup_toolchain);
}
Err(_) => {
anyhow::bail!(msg);
}
}
}
Ok(src_path)
}

0 comments on commit 00bf770

Please sign in to comment.