We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4c27c96 + 00bf770 commit 3691752Copy full SHA for 3691752
src/cargo/core/compiler/standard_lib.rs
@@ -200,11 +200,19 @@ fn detect_sysroot_src_path(target_data: &RustcTargetData<'_>) -> CargoResult<Pat
200
.join("rust");
201
let lock = src_path.join("Cargo.lock");
202
if !lock.exists() {
203
- anyhow::bail!(
+ let msg = format!(
204
"{:?} does not exist, unable to build with the standard \
205
library, try:\n rustup component add rust-src",
206
lock
207
);
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
216
}
217
Ok(src_path)
218
0 commit comments