Skip to content

Commit bfa0358

Browse files
authored
Rollup merge of #87359 - jyn514:bless-rustup, r=estebank
Remove detection of rustup and cargo in 'missing extern crate' diagnostics Previously, this would change the test output when RUSTUP_HOME was set: ``` ---- [ui] ui/issues/issue-49851/compiler-builtins-error.rs stdout ---- diff of stderr: 1 error[E0463]: can't find crate for `core` 2 | 3 = note: the `thumbv7em-none-eabihf` target may not be installed + = help: consider downloading the target with `rustup target add thumbv7em-none-eabihf` 4 5 error: aborting due to previous error 6 ``` Originally, I fixed it by explicitly unsetting RUSTUP_HOME in compiletest. Then I realized that almost no one has RUSTUP_HOME set, since rustup doesn't set it itself. It does set RUST_RECURSION_COUNT whenever it launches a proxy, though - use that instead. r? ```@estebank``` cc ```@petrochenkov``` ```@kinnison```
2 parents e4d8f0e + 17f7536 commit bfa0358

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

compiler/rustc_metadata/src/locator.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,10 @@ impl CrateError {
10801080
locator.triple
10811081
));
10821082
}
1083-
if missing_core && std::env::var("RUSTUP_HOME").is_ok() {
1083+
// NOTE: this suggests using rustup, even though the user may not have it installed.
1084+
// That's because they could choose to install it; or this may give them a hint which
1085+
// target they need to install from their distro.
1086+
if missing_core {
10841087
err.help(&format!(
10851088
"consider downloading the target with `rustup target add {}`",
10861089
locator.triple
@@ -1097,7 +1100,7 @@ impl CrateError {
10971100
current_crate
10981101
));
10991102
}
1100-
if sess.is_nightly_build() && std::env::var("CARGO").is_ok() {
1103+
if sess.is_nightly_build() {
11011104
err.help("consider building the standard library from source with `cargo build -Zbuild-std`");
11021105
}
11031106
} else if Some(crate_name)

src/test/ui/crate-loading/missing-std.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// compile-flags: --target x86_64-unknown-uefi
22
// needs-llvm-components: x86
33
// rustc-env:CARGO=/usr/bin/cargo
4-
// rustc-env:RUSTUP_HOME=/home/bors/.rustup
54
#![no_core]
65
extern crate core;
76
//~^ ERROR can't find crate for `core`

src/test/ui/crate-loading/missing-std.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0463]: can't find crate for `core`
2-
--> $DIR/missing-std.rs:6:1
2+
--> $DIR/missing-std.rs:5:1
33
|
44
LL | extern crate core;
55
| ^^^^^^^^^^^^^^^^^^ can't find crate

src/test/ui/issues/issue-37131.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
error[E0463]: can't find crate for `std`
22
|
33
= note: the `thumbv6m-none-eabi` target may not be installed
4+
= help: consider downloading the target with `rustup target add thumbv6m-none-eabi`
5+
= help: consider building the standard library from source with `cargo build -Zbuild-std`
46

57
error: aborting due to previous error
68

src/test/ui/issues/issue-49851/compiler-builtins-error.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
error[E0463]: can't find crate for `core`
22
|
33
= note: the `thumbv7em-none-eabihf` target may not be installed
4+
= help: consider downloading the target with `rustup target add thumbv7em-none-eabihf`
5+
= help: consider building the standard library from source with `cargo build -Zbuild-std`
46

57
error: aborting due to previous error
68

0 commit comments

Comments
 (0)