Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions compiler/rustc_metadata/src/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,10 @@ impl CrateError {
locator.triple
));
}
if missing_core && std::env::var("RUSTUP_HOME").is_ok() {
// NOTE: this suggests using rustup, even though the user may not have it installed.
// That's because they could choose to install it; or this may give them a hint which
// target they need to install from their distro.
if missing_core {
err.help(&format!(
"consider downloading the target with `rustup target add {}`",
locator.triple
Expand All @@ -1097,7 +1100,7 @@ impl CrateError {
current_crate
));
}
if sess.is_nightly_build() && std::env::var("CARGO").is_ok() {
if sess.is_nightly_build() {
err.help("consider building the standard library from source with `cargo build -Zbuild-std`");
}
} else if Some(crate_name)
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/crate-loading/missing-std.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// compile-flags: --target x86_64-unknown-uefi
// needs-llvm-components: x86
// rustc-env:CARGO=/usr/bin/cargo
// rustc-env:RUSTUP_HOME=/home/bors/.rustup
#![no_core]
extern crate core;
//~^ ERROR can't find crate for `core`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/crate-loading/missing-std.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0463]: can't find crate for `core`
--> $DIR/missing-std.rs:6:1
--> $DIR/missing-std.rs:5:1
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ can't find crate
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-37131.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error[E0463]: can't find crate for `std`
|
= note: the `thumbv6m-none-eabi` target may not be installed
= help: consider downloading the target with `rustup target add thumbv6m-none-eabi`
= help: consider building the standard library from source with `cargo build -Zbuild-std`

error: aborting due to previous error

Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-49851/compiler-builtins-error.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error[E0463]: can't find crate for `core`
|
= note: the `thumbv7em-none-eabihf` target may not be installed
= help: consider downloading the target with `rustup target add thumbv7em-none-eabihf`
= help: consider building the standard library from source with `cargo build -Zbuild-std`

error: aborting due to previous error

Expand Down