Skip to content

Commit d69b099

Browse files
committed
Auto merge of #75431 - ehuss:platform-support, r=Mark-Simulacrum
Move platform support to the rustc book. This moves the [Platform Support](https://forge.rust-lang.org/release/platform-support.html) page from the forge to the rustc book. There are several reasons for doing this: * The forge is not really oriented towards end-users (it mostly contains infrastructure, governance and policy, internal team pages, etc.). This platform support page is useful to user to know which targets are supported. * This page can now be updated in-sync with any PRs that add or remove a target, or change its status. * This is now automatically checked on CI to verify the list does not get out of sync. Currently it only checks the presence/absence of an entry, but more sophisticated checks could be added in the future. I'm not 100% certain this is the best location, but I think it fits. I'd like to see the rustc guide continue to grow, including things like linking information and more platform-specific details.
2 parents 814bc4f + ce71747 commit d69b099

File tree

9 files changed

+344
-5
lines changed

9 files changed

+344
-5
lines changed

Diff for: Cargo.lock

+4
Original file line numberDiff line numberDiff line change
@@ -4624,6 +4624,10 @@ dependencies = [
46244624
"walkdir",
46254625
]
46264626

4627+
[[package]]
4628+
name = "tier-check"
4629+
version = "0.1.0"
4630+
46274631
[[package]]
46284632
name = "time"
46294633
version = "0.1.42"

Diff for: Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ members = [
1313
"src/tools/rustbook",
1414
"src/tools/unstable-book-gen",
1515
"src/tools/tidy",
16+
"src/tools/tier-check",
1617
"src/tools/build-manifest",
1718
"src/tools/remote-test-client",
1819
"src/tools/remote-test-server",

Diff for: src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ impl<'a> Builder<'a> {
404404
test::CrateLibrustc,
405405
test::CrateRustdoc,
406406
test::Linkcheck,
407+
test::TierCheck,
407408
test::Cargotest,
408409
test::Cargo,
409410
test::Rls,

Diff for: src/bootstrap/test.rs

+44
Original file line numberDiff line numberDiff line change
@@ -2043,3 +2043,47 @@ impl Step for Bootstrap {
20432043
run.builder.ensure(Bootstrap);
20442044
}
20452045
}
2046+
2047+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2048+
pub struct TierCheck {
2049+
pub compiler: Compiler,
2050+
target: TargetSelection,
2051+
}
2052+
2053+
impl Step for TierCheck {
2054+
type Output = ();
2055+
const DEFAULT: bool = true;
2056+
const ONLY_HOSTS: bool = true;
2057+
2058+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
2059+
run.path("src/tools/tier-check")
2060+
}
2061+
2062+
fn make_run(run: RunConfig<'_>) {
2063+
let compiler = run.builder.compiler_for(run.builder.top_stage, run.host, run.host);
2064+
run.builder.ensure(TierCheck { compiler, target: run.host });
2065+
}
2066+
2067+
/// Tests the Platform Support page in the rustc book.
2068+
fn run(self, builder: &Builder<'_>) {
2069+
builder.ensure(compile::Std { compiler: self.compiler, target: self.target });
2070+
let mut cargo = tool::prepare_tool_cargo(
2071+
builder,
2072+
self.compiler,
2073+
Mode::ToolRustc,
2074+
self.target,
2075+
"run",
2076+
"src/tools/tier-check",
2077+
SourceType::InTree,
2078+
&[],
2079+
);
2080+
cargo.arg(builder.src.join("src/doc/rustc/src/platform-support.md"));
2081+
cargo.arg(&builder.rustc(self.compiler));
2082+
if builder.is_verbose() {
2083+
cargo.arg("--verbose");
2084+
}
2085+
2086+
builder.info("platform support check");
2087+
try_run(builder, &mut cargo.into());
2088+
}
2089+
}

Diff for: src/doc/rustc/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Deny-by-default lints](lints/listing/deny-by-default.md)
1212
- [Codegen options](codegen-options/index.md)
1313
- [JSON Output](json.md)
14+
- [Platform Support](platform-support.md)
1415
- [Targets](targets/index.md)
1516
- [Built-in Targets](targets/built-in.md)
1617
- [Custom Targets](targets/custom.md)

Diff for: src/doc/rustc/src/platform-support.md

+223
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
# Platform Support
2+
3+
<style type="text/css">
4+
td code {
5+
white-space: nowrap;
6+
}
7+
</style>
8+
9+
Support for different platforms are organized into three tiers, each with a
10+
different set of guarantees.
11+
12+
Platforms are identified by their "target triple" which is the string to
13+
inform the compiler what kind of output should be produced. The columns in the
14+
tables below have the following meanings:
15+
16+
* std:
17+
* ✓ indicates the full standard library is available.
18+
* \* indicates the target only supports [`no_std`] development.
19+
* ? indicates the standard library support is unknown or a work-in-progress.
20+
* host: A ✓ indicates that `rustc` and `cargo` can run on the host platform.
21+
22+
[`no_std`]: https://rust-embedded.github.io/book/intro/no-std.html
23+
24+
## Tier 1
25+
26+
Tier 1 platforms can be thought of as "guaranteed to work".
27+
Specifically they will each satisfy the following requirements:
28+
29+
* Official binary releases are provided for the platform.
30+
* Automated testing is set up to run tests for the platform.
31+
* Landing changes to the `rust-lang/rust` repository's master branch is gated
32+
on tests passing.
33+
* Documentation for how to use and how to build the platform is available.
34+
35+
target | std | host | notes
36+
-------|-----|------|-------
37+
`i686-pc-windows-gnu` | ✓ | ✓ | 32-bit MinGW (Windows 7+)
38+
`i686-pc-windows-msvc` | ✓ | ✓ | 32-bit MSVC (Windows 7+)
39+
`i686-unknown-linux-gnu` | ✓ | ✓ | 32-bit Linux (kernel 2.6.32+, glibc 2.11+)
40+
`x86_64-apple-darwin` | ✓ | ✓ | 64-bit OSX (10.7+, Lion+)
41+
`x86_64-pc-windows-gnu` | ✓ | ✓ | 64-bit MinGW (Windows 7+)
42+
`x86_64-pc-windows-msvc` | ✓ | ✓ | 64-bit MSVC (Windows 7+)
43+
`x86_64-unknown-linux-gnu` | ✓ | ✓ | 64-bit Linux (kernel 2.6.32+, glibc 2.11+)
44+
45+
## Tier 2
46+
47+
Tier 2 platforms can be thought of as "guaranteed to build". Automated tests
48+
are not run so it's not guaranteed to produce a working build, but platforms
49+
often work to quite a good degree and patches are always welcome!
50+
Specifically, these platforms are required to have each of the following:
51+
52+
* Official binary releases are provided for the platform.
53+
* Automated building is set up, but may not be running tests.
54+
* Landing changes to the `rust-lang/rust` repository's master branch is gated on
55+
platforms **building**. For some platforms only the standard library is
56+
compiled, but for others `rustc` and `cargo` are too.
57+
58+
target | std | host | notes
59+
-------|-----|------|-------
60+
`aarch64-apple-ios` | ✓[^apple] | | ARM64 iOS
61+
`aarch64-fuchsia` | ✓ | | ARM64 Fuchsia
62+
`aarch64-linux-android` | ✓ | | ARM64 Android
63+
`aarch64-pc-windows-msvc` | ✓ | | ARM64 Windows MSVC
64+
`aarch64-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (kernel 4.2, glibc 2.17)
65+
`aarch64-unknown-linux-musl` | ✓ | | ARM64 Linux with MUSL
66+
`aarch64-unknown-none` | * | | Bare ARM64, hardfloat
67+
`aarch64-unknown-none-softfloat` | * | | Bare ARM64, softfloat
68+
`arm-linux-androideabi` | ✓ | | ARMv7 Android
69+
`arm-unknown-linux-gnueabi` | ✓ | ✓ | ARMv6 Linux (kernel 3.2, glibc 2.17)
70+
`arm-unknown-linux-gnueabihf` | ✓ | ✓ | ARMv6 Linux, hardfloat (kernel 3.2, glibc 2.17)
71+
`arm-unknown-linux-musleabi` | ✓ | | ARMv6 Linux with MUSL
72+
`arm-unknown-linux-musleabihf` | ✓ | | ARMv6 Linux with MUSL, hardfloat
73+
`armebv7r-none-eabi` | * | | Bare ARMv7-R, Big Endian
74+
`armebv7r-none-eabihf` | * | | Bare ARMv7-R, Big Endian, hardfloat
75+
`armv5te-unknown-linux-gnueabi` | ✓ | | ARMv5TE Linux (kernel 4.4, glibc 2.23)
76+
`armv5te-unknown-linux-musleabi` | ✓ | | ARMv5TE Linux with MUSL
77+
`armv7-linux-androideabi` | ✓ | | ARMv7a Android
78+
`armv7a-none-eabi` | * | | Bare ARMv7-A
79+
`armv7r-none-eabi` | * | | Bare ARMv7-R
80+
`armv7r-none-eabihf` | * | | Bare ARMv7-R, hardfloat
81+
`armv7-unknown-linux-gnueabi` | ✓ | | ARMv7 Linux (kernel 4.15, glibc 2.27)
82+
`armv7-unknown-linux-gnueabihf` | ✓ | ✓ | ARMv7 Linux, hardfloat (kernel 3.2, glibc 2.17)
83+
`armv7-unknown-linux-musleabi` | ✓ | | ARMv7 Linux, MUSL
84+
`armv7-unknown-linux-musleabihf` | ✓ | | ARMv7 Linux with MUSL
85+
`asmjs-unknown-emscripten` | ✓ | | asm.js via Emscripten
86+
`i586-pc-windows-msvc` | ✓ | | 32-bit Windows w/o SSE
87+
`i586-unknown-linux-gnu` | ✓ | | 32-bit Linux w/o SSE (kernel 4.4, glibc 2.23)
88+
`i586-unknown-linux-musl` | ✓ | | 32-bit Linux w/o SSE, MUSL
89+
`i686-linux-android` | ✓ | | 32-bit x86 Android
90+
`i686-unknown-freebsd` | ✓ | ✓ | 32-bit FreeBSD
91+
`i686-unknown-linux-musl` | ✓ | | 32-bit Linux with MUSL
92+
`mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23)
93+
`mips-unknown-linux-musl` | ✓ | | MIPS Linux with MUSL
94+
`mips64-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 Linux, n64 ABI (kernel 4.4, glibc 2.23)
95+
`mips64-unknown-linux-muslabi64` | ✓ | | MIPS64 Linux, n64 ABI, MUSL
96+
`mips64el-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 (LE) Linux, n64 ABI (kernel 4.4, glibc 2.23)
97+
`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (LE) Linux, n64 ABI, MUSL
98+
`mipsel-unknown-linux-gnu` | ✓ | ✓ | MIPS (LE) Linux (kernel 4.4, glibc 2.23)
99+
`mipsel-unknown-linux-musl` | ✓ | | MIPS (LE) Linux with MUSL
100+
`nvptx64-nvidia-cuda` | ✓ | | --emit=asm generates PTX code that [runs on NVIDIA GPUs]
101+
`powerpc-unknown-linux-gnu` | ✓ | ✓ | PowerPC Linux (kernel 2.6.32, glibc 2.11)
102+
`powerpc64-unknown-linux-gnu` | ✓ | ✓ | PPC64 Linux (kernel 2.6.32, glibc 2.11)
103+
`powerpc64le-unknown-linux-gnu` | ✓ | ✓ | PPC64LE Linux (kernel 3.10, glibc 2.17)
104+
`riscv32i-unknown-none-elf` | * | | Bare RISC-V (RV32I ISA)
105+
`riscv32imac-unknown-none-elf` | * | | Bare RISC-V (RV32IMAC ISA)
106+
`riscv32imc-unknown-none-elf` | * | | Bare RISC-V (RV32IMC ISA)
107+
`riscv64gc-unknown-linux-gnu` | ✓ | ✓ | RISC-V Linux (kernel 4.20, glibc 2.29)
108+
`riscv64gc-unknown-none-elf` | * | | Bare RISC-V (RV64IMAFDC ISA)
109+
`riscv64imac-unknown-none-elf` | * | | Bare RISC-V (RV64IMAC ISA)
110+
`s390x-unknown-linux-gnu` | ✓ | ✓ | S390x Linux (kernel 2.6.32, glibc 2.11)
111+
`sparc64-unknown-linux-gnu` | ✓ | | SPARC Linux (kernel 4.4, glibc 2.23)
112+
`sparcv9-sun-solaris` | ✓ | | SPARC Solaris 10/11, illumos
113+
`thumbv6m-none-eabi` | * | | Bare Cortex-M0, M0+, M1
114+
`thumbv7em-none-eabi` | * | | Bare Cortex-M4, M7
115+
`thumbv7em-none-eabihf` | * | | Bare Cortex-M4F, M7F, FPU, hardfloat
116+
`thumbv7m-none-eabi` | * | | Bare Cortex-M3
117+
`thumbv7neon-linux-androideabi` | ✓ | | Thumb2-mode ARMv7a Android with NEON
118+
`thumbv7neon-unknown-linux-gnueabihf` | ✓ | | Thumb2-mode ARMv7a Linux with NEON (kernel 4.4, glibc 2.23)
119+
`thumbv8m.base-none-eabi` | * | | ARMv8-M Baseline
120+
`thumbv8m.main-none-eabi` | * | | ARMv8-M Mainline
121+
`thumbv8m.main-none-eabihf` | * | | ARMv8-M Baseline, hardfloat
122+
`wasm32-unknown-emscripten` | ✓ | | WebAssembly via Emscripten
123+
`wasm32-unknown-unknown` | ✓ | | WebAssembly
124+
`wasm32-wasi` | ✓ | | WebAssembly with WASI
125+
`x86_64-apple-ios` | ✓[^apple] | | 64-bit x86 iOS
126+
`x86_64-fortanix-unknown-sgx` | ✓ | | [Fortanix ABI] for 64-bit Intel SGX
127+
`x86_64-fuchsia` | ✓ | | 64-bit Fuchsia
128+
`x86_64-linux-android` | ✓ | | 64-bit x86 Android
129+
`x86_64-rumprun-netbsd` | ✓ | | 64-bit NetBSD Rump Kernel
130+
`x86_64-sun-solaris` | ✓ | | 64-bit Solaris 10/11, illumos
131+
`x86_64-unknown-cloudabi` | ✓ | | 64-bit CloudABI
132+
`x86_64-unknown-freebsd` | ✓ | ✓ | 64-bit FreeBSD
133+
`x86_64-unknown-illumos` | ✓ | ✓ | illumos
134+
`x86_64-unknown-linux-gnux32` | ✓ | | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)
135+
`x86_64-unknown-linux-musl` | ✓ | ✓ | 64-bit Linux with MUSL
136+
`x86_64-unknown-netbsd` | ✓ | ✓ | NetBSD/amd64
137+
`x86_64-unknown-redox` | ✓ | | Redox OS
138+
139+
[Fortanix ABI]: https://edp.fortanix.com/
140+
141+
## Tier 3
142+
143+
Tier 3 platforms are those which the Rust codebase has support for, but which
144+
are not built or tested automatically, and may not work. Official builds are
145+
not available.
146+
147+
target | std | host | notes
148+
-------|-----|------|-------
149+
`aarch64-apple-darwin` | ? | | ARM64 macOS
150+
`aarch64-apple-tvos` | *[^apple] | | ARM64 tvOS
151+
`aarch64-unknown-cloudabi` | ✓ | | ARM64 CloudABI
152+
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
153+
`aarch64-unknown-hermit` | ? | |
154+
`aarch64-unknown-netbsd` | ? | |
155+
`aarch64-unknown-openbsd` | ✓ | ✓ | ARM64 OpenBSD
156+
`aarch64-unknown-redox` | ? | | ARM64 Redox OS
157+
`aarch64-uwp-windows-msvc` | ? | |
158+
`aarch64-wrs-vxworks` | ? | |
159+
`armv4t-unknown-linux-gnueabi` | ? | |
160+
`armv6-unknown-freebsd` | ✓ | ✓ | ARMv6 FreeBSD
161+
`armv6-unknown-netbsd-eabihf` | ? | |
162+
`armv7-apple-ios` | ✓[^apple] | | ARMv7 iOS, Cortex-a8
163+
`armv7-unknown-cloudabi-eabihf` | ✓ | | ARMv7 CloudABI, hardfloat
164+
`armv7-unknown-freebsd` | ✓ | ✓ | ARMv7 FreeBSD
165+
`armv7-unknown-netbsd-eabihf` | ? | |
166+
`armv7-wrs-vxworks-eabihf` | ? | |
167+
`armv7a-none-eabihf` | * | | ARM Cortex-A, hardfloat
168+
`armv7s-apple-ios` | ✓[^apple] | |
169+
`avr-unknown-unknown` | ? | | AVR
170+
`hexagon-unknown-linux-musl` | ? | |
171+
`i386-apple-ios` | ✓[^apple] | | 32-bit x86 iOS
172+
`i686-apple-darwin` | ✓ | ✓ | 32-bit OSX (10.7+, Lion+)
173+
`i686-pc-windows-msvc` | ✓ | | 32-bit Windows XP support
174+
`i686-unknown-cloudabi` | ✓ | | 32-bit CloudABI
175+
`i686-unknown-uefi` | ? | | 32-bit UEFI
176+
`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku
177+
`i686-unknown-netbsd` | ✓ | | NetBSD/i386 with SSE2
178+
`i686-unknown-openbsd` | ✓ | ✓ | 32-bit OpenBSD
179+
`i686-uwp-windows-gnu` | ? | |
180+
`i686-uwp-windows-msvc` | ? | |
181+
`i686-wrs-vxworks` | ? | |
182+
`mips-unknown-linux-uclibc` | ✓ | | MIPS Linux with uClibc
183+
`mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc
184+
`mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP)
185+
`mipsisa32r6-unknown-linux-gnu` | ? | |
186+
`mipsisa32r6el-unknown-linux-gnu` | ? | |
187+
`mipsisa64r6-unknown-linux-gnuabi64` | ? | |
188+
`mipsisa64r6el-unknown-linux-gnuabi64` | ? | |
189+
`msp430-none-elf` | * | | 16-bit MSP430 microcontrollers
190+
`powerpc-unknown-linux-gnuspe` | ✓ | | PowerPC SPE Linux
191+
`powerpc-unknown-linux-musl` | ? | |
192+
`powerpc-unknown-netbsd` | ? | |
193+
`powerpc-wrs-vxworks` | ? | |
194+
`powerpc-wrs-vxworks-spe` | ? | |
195+
`powerpc64-unknown-freebsd` | ✓ | ✓ | PPC64 FreeBSD (ELFv1 and ELFv2)
196+
`powerpc64-unknown-linux-musl` | ? | |
197+
`powerpc64-wrs-vxworks` | ? | |
198+
`powerpc64le-unknown-linux-musl` | ? | |
199+
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
200+
`sparc64-unknown-netbsd` | ✓ | ✓ | NetBSD/sparc64
201+
`sparc64-unknown-openbsd` | ? | |
202+
`thumbv7a-pc-windows-msvc` | ? | |
203+
`thumbv7a-uwp-windows-msvc` | ✓ | |
204+
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode ARMv7a Linux with NEON, MUSL
205+
`thumbv4t-none-eabi` | * | | ARMv4T T32
206+
`x86_64-apple-ios-macabi` | ✓[^apple] | | Apple Catalyst
207+
`x86_64-apple-tvos` | *[^apple] | | x86 64-bit tvOS
208+
`x86_64-linux-kernel` | ? | | Linux kernel modules
209+
`x86_64-pc-solaris` | ? | |
210+
`x86_64-pc-windows-msvc` | ✓ | | 64-bit Windows XP support
211+
`x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD
212+
`x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku
213+
`x86_64-unknown-hermit` | ? | |
214+
`x86_64-unknown-hermit-kernel` | ? | | HermitCore kernel
215+
`x86_64-unknown-l4re-uclibc` | ? | |
216+
`x86_64-unknown-openbsd` | ✓ | ✓ | 64-bit OpenBSD
217+
`x86_64-unknown-uefi` | ? | |
218+
`x86_64-uwp-windows-gnu` | ✓ | |
219+
`x86_64-uwp-windows-msvc` | ✓ | |
220+
`x86_64-wrs-vxworks` | ? | |
221+
222+
[runs on NVIDIA GPUs]: https://github.com/japaric-archived/nvptx#targets
223+
[^apple]: These targets are only available on macOS.

Diff for: src/doc/rustc/src/targets/built-in.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
`rustc` ships with the ability to compile to many targets automatically, we
44
call these "built-in" targets, and they generally correspond to targets that
5-
the team is supporting directly.
5+
the team is supporting directly. To see the list of built-in targets, you can
6+
run `rustc --print target-list`.
67

7-
To see the list of built-in targets, you can run `rustc --print target-list`,
8-
or look at [the API
9-
docs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/index.html#modules).
10-
Each module there defines a builder for a particular target.
8+
Typically, a target needs a compiled copy of the Rust standard library to
9+
work. If using [rustup], then check out the documentation on
10+
[Cross-compilation][rustup-cross] on how to download a pre-built standard
11+
library built by the official Rust distributions. Most targets will need a
12+
system linker, and possibly other things.
13+
14+
[rustup]: https://github.com/rust-lang/rustup
15+
[rustup-cross]: https://github.com/rust-lang/rustup#cross-compilation

Diff for: src/tools/tier-check/Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "tier-check"
3+
version = "0.1.0"
4+
authors = ["Eric Huss"]
5+
edition = "2018"
6+
license = "MIT OR Apache-2.0"
7+
8+
[dependencies]

Diff for: src/tools/tier-check/src/main.rs

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//! This is a script for validating the platform support page in the rustc book.
2+
//!
3+
//! The script takes two arguments, the path to the Platform Support source
4+
//! page, and the second argument is the path to `rustc`.
5+
6+
use std::collections::HashSet;
7+
8+
fn main() {
9+
let mut args = std::env::args().skip(1);
10+
let src = args.next().expect("expected source file as first argument");
11+
let filename = std::path::Path::new(&src).file_name().unwrap().to_str().unwrap();
12+
let rustc = args.next().expect("expected rustc as second argument");
13+
let output = std::process::Command::new(rustc)
14+
.arg("--print=target-list")
15+
.output()
16+
.expect("rustc should run");
17+
if !output.status.success() {
18+
eprintln!("rustc failed to run");
19+
std::process::exit(0);
20+
}
21+
let stdout = std::str::from_utf8(&output.stdout).expect("utf8");
22+
let target_list: HashSet<_> = stdout.lines().collect();
23+
24+
let doc_targets_md = std::fs::read_to_string(&src).expect("failed to read input source");
25+
let doc_targets: HashSet<_> = doc_targets_md
26+
.lines()
27+
.filter(|line| line.starts_with('`') && line.contains('|'))
28+
// These platforms only exist on macos.
29+
.filter(|line| !line.contains("[^apple]") || cfg!(target_os = "macos"))
30+
.map(|line| line.split('`').skip(1).next().expect("expected target code span"))
31+
.collect();
32+
33+
let missing: Vec<_> = target_list.difference(&doc_targets).collect();
34+
let extra: Vec<_> = doc_targets.difference(&target_list).collect();
35+
for target in &missing {
36+
eprintln!(
37+
"error: target `{}` is missing from {}\n\
38+
If this is a new target, please add it to {}.",
39+
target, filename, src
40+
);
41+
}
42+
for target in &extra {
43+
eprintln!(
44+
"error: target `{}` is in {}, but does not appear in the rustc target list\n\
45+
If the target has been removed, please edit {} and remove the target.",
46+
target, filename, src
47+
);
48+
}
49+
if !missing.is_empty() || !extra.is_empty() {
50+
std::process::exit(1);
51+
}
52+
}

0 commit comments

Comments
 (0)