Skip to content

Commit c4c0f33

Browse files
authored
Update docs from date triage for 2021-02 (#1048)
The biggest change was updating the list of rustdoc passes. Several new ones have been added since that documentation was written, so I added those, and I also sorted the list so it is roughly alphabetical (except for the part for the `strip-*` passes, which I left in the same order since one of the list items has two passes so there's no "correct" order).
1 parent 5297659 commit c4c0f33

File tree

5 files changed

+56
-24
lines changed

5 files changed

+56
-24
lines changed

src/compiler-src.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ containing the compiler, the standard libraries (`core`, `alloc`, `std`,
2121
`proc_macro`, etc), and `rustdoc`, along with the build system and a bunch of
2222
tools and submodules for building a full Rust distribution.
2323

24-
As of August 2020 <!-- date: 2020-08 -->, this structure is gradually undergoing
25-
some transformation to make it a bit less monolithic and more approachable,
26-
especially to newcomers.
27-
2824
The repository consists of three main directories:
2925

3026
- `compiler/` contains the source code for `rustc`. It consists of many crates

src/overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ Moreover, the compiler wasn't originally built to use a query system; the query
250250
system has been retrofitted into the compiler, so parts of it are not query-fied
251251
yet. Also, LLVM isn't our code, so that isn't querified either. The plan is to
252252
eventually query-fy all of the steps listed in the previous section, but as of
253-
April 2020 <!-- date: 2020-04 -->, only the steps between HIR and LLVM-IR are
254-
query-fied. That is, lexing and parsing are done all at once for the whole
255-
program.
253+
February 2021 <!-- date: 2021-02 -->, only the steps between HIR and LLVM IR are
254+
query-fied. That is, lexing, parsing, name resolution, and macro expansion are
255+
done all at once for the whole program.
256256

257257
One other thing to mention here is the all-important "typing context",
258258
[`TyCtxt`], which is a giant struct that is at the center of all things.

src/parallel-rustc.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ There are a few basic ideas in this effort:
2222

2323
[`rayon`]: https://crates.io/crates/rayon
2424

25-
As of May 2020 <!-- date: 2020-05 -->, much of this effort is on hold due to
26-
lack of manpower. We have a working prototype with promising performance gains
27-
in many cases. However, there are two blockers:
25+
As of February 2021 <!-- date: 2021-02 -->, much of this effort is on hold due
26+
to lack of manpower. We have a working prototype with promising performance
27+
gains in many cases. However, there are two blockers:
2828

2929
- It's not clear what invariants need to be upheld that might not hold in the
3030
face of concurrency. An auditing effort was underway, but seems to have

src/rustdoc-internals.md

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,44 +51,81 @@ which describe the publicly-documentable items in the target crate.
5151
### Hot potato
5252

5353
Before moving on to the next major step, a few important "passes" occur over
54-
the documentation. These do things like combine the separate "attributes" into
54+
the documentation. These do things like combine the separate "attributes" into
5555
a single string and strip leading whitespace to make the document easier on the
5656
markdown parser, or drop items that are not public or deliberately hidden with
5757
`#[doc(hidden)]`. These are all implemented in the `passes/` directory, one
5858
file per pass. By default, all of these passes are run on a crate, but the ones
5959
regarding dropping private/hidden items can be bypassed by passing
6060
`--document-private-items` to rustdoc. Note that unlike the previous set of AST
61-
transformations, the passes happen on the _cleaned_ crate.
61+
transformations, the passes are run on the _cleaned_ crate.
6262

6363
(Strictly speaking, you can fine-tune the passes run and even add your own, but
6464
[we're trying to deprecate that][44136]. If you need finer-grain control over
6565
these passes, please let us know!)
6666

6767
[44136]: https://github.com/rust-lang/rust/issues/44136
6868

69-
Here is the list of passes as of March 2018 <!-- date: 2018-03 -->:
69+
Here is the list of passes as of February 2021 <!-- date: 2021-02 -->:
70+
71+
- `calculate-doc-coverage` calculates information used for the `--show-coverage`
72+
flag.
73+
74+
- `check-code-block-syntax` validates syntax inside Rust code blocks
75+
(`` ```rust ``)
76+
77+
- `check-invalid-html-tags` detects invalid HTML (like an unclosed `<span>`)
78+
in doc comments.
79+
80+
- `check-non-autolinks` detects links that could or should be written using
81+
angle brackets (the code behind the nightly-only <!-- date: 2021-02 -->
82+
`non_autolinks` lint).
7083

71-
- `propagate-doc-cfg` - propagates `#[doc(cfg(...))]` to child items.
7284
- `collapse-docs` concatenates all document attributes into one document
7385
attribute. This is necessary because each line of a doc comment is given as a
7486
separate doc attribute, and this will combine them into a single string with
7587
line breaks between each attribute.
76-
- `unindent-comments` removes excess indentation on comments in order for
77-
markdown to like it. This is necessary because the convention for writing
78-
documentation is to provide a space between the `///` or `//!` marker and the
79-
text, and stripping that leading space will make the text easier to parse by
80-
the Markdown parser. (In the past, the markdown parser used was not
81-
Commonmark- compliant, which caused annoyances with extra whitespace but this
82-
seems to be less of an issue today.)
88+
89+
- `collect-intra-doc-links` resolves [intra-doc links](https://doc.rust-lang.org/rustdoc/linking-to-items-by-name.html).
90+
91+
- `collect-trait-impls` collects trait impls for each item in the crate. For
92+
example, if we define a struct that implements a trait, this pass will note
93+
that the struct implements that trait.
94+
95+
- `doc-test-lints` runs various lints on the doctests.
96+
97+
- `propagate-doc-cfg` propagates `#[doc(cfg(...))]` to child items.
98+
8399
- `strip-priv-imports` strips all private import statements (`use`, `extern
84100
crate`) from a crate. This is necessary because rustdoc will handle *public*
85101
imports by either inlining the item's documentation to the module or creating
86102
a "Reexports" section with the import in it. The pass ensures that all of
87103
these imports are actually relevant to documentation.
104+
88105
- `strip-hidden` and `strip-private` strip all `doc(hidden)` and private items
89106
from the output. `strip-private` implies `strip-priv-imports`. Basically, the
90107
goal is to remove items that are not relevant for public documentation.
91108

109+
- `unindent-comments` removes excess indentation on comments in order for the
110+
Markdown to be parsed correctly. This is necessary because the convention for
111+
writing documentation is to provide a space between the `///` or `//!` marker
112+
and the doc text, but Markdown is whitespace-sensitive. For example, a block
113+
of text with four-space indentation is parsed as a code block, so if we didn't
114+
unindent comments, these list items
115+
116+
```rust,ignore
117+
/// A list:
118+
///
119+
/// - Foo
120+
/// - Bar
121+
```
122+
123+
would be parsed as if they were in a code block, which is likely not what the
124+
user intended.
125+
126+
There is also a `stripper` module in `passes/`, but it is a collection of
127+
utility functions for the `strip-*` passes and is not a pass itself.
128+
92129
## From clean to crate
93130

94131
This is where the "second phase" in rustdoc begins. This phase primarily lives
@@ -224,4 +261,3 @@ on the internet. For example, the url for `std` will be `/std/".
224261

225262
[`rustdoc` api docs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/
226263
[The rustdoc user guide]: https://doc.rust-lang.org/nightly/rustdoc/
227-

src/tests/adding.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ The error levels that you can have are:
339339

340340
## Revisions
341341

342-
Certain classes of tests support "revisions" (as of February 2018 <!-- date:
343-
2018-02 -->, this includes compile-fail, run-fail, and incremental, though
342+
Certain classes of tests support "revisions" (as of February 2021 <!-- date:
343+
2021-02 -->, this includes compile-fail, run-fail, and incremental, though
344344
incremental tests are somewhat different). Revisions allow a single test file to
345345
be used for multiple tests. This is done by adding a special header at the top
346346
of the file:

0 commit comments

Comments
 (0)