Skip to content

Commit 3691752

Browse files
committed
Auto merge of #9625 - hi-rustin:rustin-msg, r=ehuss
Include toolchain specification in error message close https://github.com/rust-lang/rustup/issues/2795
2 parents 4c27c96 + 00bf770 commit 3691752

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/cargo/core/compiler/standard_lib.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,19 @@ fn detect_sysroot_src_path(target_data: &RustcTargetData<'_>) -> CargoResult<Pat
200200
.join("rust");
201201
let lock = src_path.join("Cargo.lock");
202202
if !lock.exists() {
203-
anyhow::bail!(
203+
let msg = format!(
204204
"{:?} does not exist, unable to build with the standard \
205205
library, try:\n rustup component add rust-src",
206206
lock
207207
);
208+
match env::var("RUSTUP_TOOLCHAIN") {
209+
Ok(rustup_toolchain) => {
210+
anyhow::bail!("{} --toolchain {}", msg, rustup_toolchain);
211+
}
212+
Err(_) => {
213+
anyhow::bail!(msg);
214+
}
215+
}
208216
}
209217
Ok(src_path)
210218
}

0 commit comments

Comments
 (0)