Skip to content

Commit

Permalink
Auto merge of #9625 - hi-rustin:rustin-msg, r=ehuss
Browse files Browse the repository at this point in the history
Include toolchain specification in error message

close https://github.com/rust-lang/rustup/issues/2795
  • Loading branch information
bors committed Jun 25, 2021
2 parents 4c27c96 + 00bf770 commit 3691752
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 3691752

Please sign in to comment.