There isn't a reliable way to determine if a given target tuple supports std or not
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Related to #141863. I'd like to implement a reliable //@ needs-target-std compiletest directive, but after some experimentation I found out that we don't really have a reliable way to determine if a given target tuple supports std.
Bootstrap, for this reason, has to resort to the hack for determining target std support that is
Noratrieb suggested a proper long-term solution (on community discord)
the std build script should probably read it from the metadata field [..]
and then the metadata is actually reliable
which seems way more principled to me.
rustc similarly does not have any way to convey this information. For instance, the closest thing is the target spec metadata.std field, but not all built-in target specs actually populate this field[^intent]. Built-in target specs currently without std support field (2025-06-10)[^illustrative]:
aarch64-unknown-redox
aarch64-unknown-teeos
aarch64-unknown-uefi
aarch64-uwp-windows-msvc
arm64ec-pc-windows-msvc
armv6k-nintendo-3ds
armv7-wrs-vxworks-eabihf
avr-none
i586-unknown-redox
i686-unknown-uefi
i686-uwp-windows-gnu
i686-uwp-windows-msvc
mips-mti-none-elf
mipsel-mti-none-elf
powerpc-wrs-vxworks-spe
powerpc64-ibm-aix
riscv32im-risc0-zkvm-elf
riscv32imac-unknown-xous-elf
thumbv7a-pc-windows-msvc
wasm32-wali-linux-musl
wasm64-unknown-unknown
x86_64-unknown-l4re-uclibc
x86_64-unknown-uefi
xtensa-esp32-espidf
xtensa-esp32s2-espidf
xtensa-esp32s3-espidf
[^intent]: Putting aside that metadata is really only intended for doc generation purposes and is by no means guaranteed to be reliable
[^illustrative]: Just for expository purposes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the target-support hack in src/bootstrap/src/core/config/toml/target.rs and the existing compiletest needs-target-std proposal. Investigate how the std build script could expose reliable target metadata and how rustc or compiletest would consume it. Done means the directive can reliably determine std support for the listed target tuples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100