about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
authorAdam Gemmell <adam.gemmell@arm.com>2024-02-28 15:19:30 +0000
committerAdam Gemmell <adam.gemmell@arm.com>2024-04-02 12:05:12 +0100
commit8923b589bd42838842d8acb20e66637a6fee8765 (patch)
tree330ef295625ece44220a1ba99ab49cd4f72707fb /compiler/rustc_pattern_analysis/src
parent2531d08e342f21f83eef90741c871f32ba7aa7d2 (diff)
downloadrust-8923b589bd42838842d8acb20e66637a6fee8765.tar.gz
rust-8923b589bd42838842d8acb20e66637a6fee8765.zip
Document restricted_std
This PR aims to pin down exactly what restricted_std is meant to achieve
and what it isn't.

This commit fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/87
by explaining why the error appears and what the choices the user has.
The error describes how std cannot function without knowing about some
form of OS/platform support. Any features of std that work without an
OS should be moved to core/alloc (see https://github.com/rust-lang/rust/issues/27242
https://github.com/rust-lang/rust/issues/103765).

Note that the message says "platform" and "environment" because, since
https://github.com/rust-lang/rust/pull/120232, libstd can be built for
some JSON targets. This is still unsupported (all JSON targets probably
should be unstable https://github.com/rust-lang/wg-cargo-std-aware/issues/90),
but a JSON target with the right configuration should hopefully have
some partial libstd support.

I propose closing https://github.com/rust-lang/wg-cargo-std-aware/issues/69
as "Won't fix" since any support of std without properly configured os,
vendor or env fields is very fragile considering future upgrades of Rust
or dependencies. In addition there's no likely path to it being fixed
long term (making std buildable for all targets being the only
solution). This is distinct from tier 3 platforms with limited std
support implemented (and as such aren't restricted_std) because these
platforms can conceptually work in the future and std support should
mainly improve over time.

The alternative to closing https://github.com/rust-lang/wg-cargo-std-aware/issues/69
is a new crate feature for std which escapes the restricted_std
mechanism in build.rs. It could be used with the -Zbuild-std-features
flag if we keep it permanently unstable, which I hope we can do anyway.
A minor side-effect in this scenario is that std wouldn't be marked as
unstable if documentation for it were generated with build-std.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions