|
1 |
| -# target tier docs experiment |
| 1 | +# target-docs |
2 | 2 |
|
3 |
| -Experiment with automatically generating target tier docs. |
| 3 | +This tool generates target documentation for all targets in the rustc book. |
4 | 4 |
|
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. |
6 | 7 |
|
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. |
8 | 10 |
|
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 |
14 | 13 |
|
15 |
| -## Solution |
| 14 | +- Overview |
| 15 | +- Requirements |
| 16 | +- Testing |
| 17 | +- Building the target |
| 18 | +- Cross compilation |
| 19 | +- Building Rust programs |
16 | 20 |
|
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. |
18 | 23 |
|
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