Skip to content

Commit 720b23b

Browse files
committed
sync
1 parent a688445 commit 720b23b

File tree

7 files changed

+249
-295
lines changed

7 files changed

+249
-295
lines changed

Cargo.lock

+12-52
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
name = "target-docs"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "MIT OR Apache-2.0"
56

67
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
78

89
[dependencies]
910
eyre = "0.6.12"
1011
glob-match = "0.2.1"
11-
rayon = "1.8.1"
12-
serde = { version = "1.0.196", features = ["derive"] }
12+
serde = { version = "1.0.185", features = ["derive"] }
13+
serde_json = "1.0.114"
1314
serde_yaml = "0.9.31"

README.md

+50-19
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,57 @@
1-
# target tier docs experiment
1+
# target-docs
22

3-
Experiment with automatically generating target tier docs.
3+
This tool generates target documentation for all targets in the rustc book.
44

5-
**View the deployment on <https://nilstrieb.github.io/target-tier-docs-experiment/>**
5+
To achieve this, it uses a list of input markdown files provided in `src/doc/rustc/target_infos`. These files follow a strict format.
6+
Every file covers a glob pattern of targets according to its file name.
67

7-
## Problems
8+
For every rustc target, we iterate through all the target infos and find matching globs.
9+
When a glob matches, it extracts the h2 markdown sections and saves them for the target.
810

9-
Currenly, the [target tier docs](https://doc.rust-lang.org/rustc/platform-support.html) are hard to navigate.
10-
If you want to find information about a specific target, you first need to do some glob-search yourself and then also hope
11-
that the target actually exists. This is super annoying (`:(`). Additionally, some targets are completely missing and there
12-
is no reason to believe that the documentation won't suddenly start being out of date.
13-
Pages are also inconsistent about which sections exist and which ones don't.
11+
In the end, a page is generated for every target using these sections.
12+
Sections that are not provided are stubbed out. Currently, the sections are
1413

15-
## Solution
14+
- Overview
15+
- Requirements
16+
- Testing
17+
- Building the target
18+
- Cross compilation
19+
- Building Rust programs
1620

17-
Enter: adding yet another preprocessing step.
21+
In addition to the markdown sections, we also have extra data about the targets.
22+
This is achieved through YAML frontmatter.
1823

19-
By adding yet another preprocessing step, we can solve all these problems.
20-
- Have a *dedicated* page for *every single* target including information about maintainers etc.
21-
This makes it super easy to find things when there are problems.
22-
- Ensure that no target is completely undocumented, at least having a stub page pointing out the undocumentedness
23-
- Error when there is documentation that is not needed anymore, for example a removed target
24-
- Still keep the nice and easy-to-organize glob structure in the source
25-
- Use a unified structure for all the pages
26-
- This also allows us to put more dynamic values into the docs. For example, I put `--print cfg` there, isn't that pretty!?
24+
The frontmatter follows the following format:
25+
26+
```yaml
27+
tier: "1"
28+
maintainers: ["@someone"]
29+
metadata:
30+
- target: "i686-pc-windows-gnu"
31+
notes: "32-bit MinGW (Windows 7+)"
32+
std: true
33+
host: true
34+
footnotes:
35+
- name: "x86_32-floats-return-ABI"
36+
content: |
37+
Due to limitations of the C ABI, floating-point support on `i686` targets is non-compliant:
38+
floating-point return values are passed via an x87 register, so NaN payload bits can be lost.
39+
See [issue #114479][https://github.com/rust-lang/rust/issues/114479].
40+
- name: "windows-support"
41+
content: "Only Windows 10 currently undergoes automated testing. Earlier versions of Windows rely on testing and support from the community."
42+
```
43+
44+
The top level keys are:
45+
46+
- `tier` (optional): `1`, `2` or `3`
47+
- `maintainers` (optional): list of strings
48+
49+
There is also `metadata`, which is specific to every single target and not just a target "group" (the glob).
50+
51+
`metadata` has the following properties:
52+
53+
- `target`: the target name
54+
- `notes`: a string containing a short description of the target for the table
55+
- `std`: `true`, `false`, `unknown`, whether the target has `std`
56+
- `host`: `true`, `false`, `unknown`, whether the target has host tools
57+
- `footnotes` (optional): a list of footnotes, where every footnote has a `name` and `content`. These are used in the table.

0 commit comments

Comments
 (0)