rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.61k stars 12.48k forks source link

`./x check std` should not try to check `no_std` targets #128027

Closed ChrisDenton closed 1 month ago

ChrisDenton commented 1 month ago

no_std targets don't support std so checking is pointless and can be skipped. Or at the very least it could inform users that failing checks is expected and not an error.

Maybe there could be some way to force a check if someone really wants to.

onur-ozkan commented 1 month ago

For no_std targets bootstrap does this: https://github.com/rust-lang/rust/blob/d111ccdb6186b368ead16c01f43c645a6e5f4a67/src/bootstrap/src/core/build_steps/compile.rs#L482-L494

which seems good enough already. Do we need to skip the whole std step?

ChrisDenton commented 1 month ago

It doesn't seem to work though? Picking aarch64-unknown-none-softfloat as it's the first none on the list of targets:

> .\x check std --target aarch64-unknown-none-softfloat
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.09s
cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `cc` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `c++` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `c++` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
Checking stage0 library artifacts {std} (x86_64-pc-windows-msvc -> aarch64-unknown-none-softfloat)
    Checking std v0.0.0 (F:\rust\library\std)
warning: dropping unsupported crate type `dylib` for target `aarch64-unknown-none-softfloat`

error[E0432]: unresolved imports `crate::sys::thread_local::key::get`, `crate::sys::thread_local::key::set`, `crate::sys::thread_local::key::Key`, `crate::sys::thread_local::key::LazyKey`
 --> library\std\src\sys\thread_local\os.rs:5:37
  |
5 | use crate::sys::thread_local::key::{get, set, Key, LazyKey};
  |                                     ^^^  ^^^  ^^^  ^^^^^^^ no `LazyKey` in `sys::thread_local::key`
  |                                     |    |    |
  |                                     |    |    no `Key` in `sys::thread_local::key`
  |                                     |    no `set` in `sys::thread_local::key`
  |                                     no `get` in `sys::thread_local::key`
  |
note: module `crate::collections::hash::set` exists but is inaccessible
 --> library\std\src\collections\hash\mod.rs:4:1
  |
4 | pub mod set;
  | ^^^^^^^^^^^^ not accessible

For more information about this error, try `rustc --explain E0432`.
warning: `std` (lib) generated 1 warning
error: could not compile `std` (lib) due to 1 previous error; 1 warning emitted

Some other non-std targets print a lot more errors.