@@ -32,7 +32,7 @@ is the `impl Clean<Crate> for visit_ast::RustdocVisitor`, which is called by
32
32
` run_core ` above.
33
33
34
34
You see, I actually lied a little earlier: There's another AST transformation
35
- that happens before the events in ` clean/mod.rs ` . In ` visit_ast.rs ` is the
35
+ that happens before the events in ` clean/mod.rs ` . In ` visit_ast.rs ` is the
36
36
type ` RustdocVisitor ` , which * actually* crawls a ` rustc_hir::Crate ` to get the first
37
37
intermediate representation, defined in ` doctree.rs ` . This pass is mainly to
38
38
get a few intermediate wrappers around the HIR types and to process visibility
@@ -52,10 +52,10 @@ which describe the publicly-documentable items in the target crate.
52
52
53
53
Before moving on to the next major step, a few important "passes" occur over
54
54
the documentation. These do things like combine the separate "attributes" into
55
- a single string and strip leading whitespace to make the document easier on the
56
- markdown parser, or drop items that are not public or deliberately hidden with
57
- ` #[doc(hidden)] ` . These are all implemented in the ` passes/ ` directory, one
58
- file per pass. By default, all of these passes are run on a crate, but the ones
55
+ a single string to make the document easier on the markdown parser,
56
+ or drop items that are not public or deliberately hidden with ` #[doc(hidden)] ` .
57
+ These are all implemented in the ` passes/ ` directory, one file per pass.
58
+ By default, all of these passes are run on a crate, but the ones
59
59
regarding dropping private/hidden items can be bypassed by passing
60
60
` --document-private-items ` to rustdoc. Note that unlike the previous set of AST
61
61
transformations, the passes are run on the _ cleaned_ crate.
@@ -66,15 +66,15 @@ these passes, please let us know!)
66
66
67
67
[ 44136 ] : https://github.com/rust-lang/rust/issues/44136
68
68
69
- Here is the list of passes as of <!-- date: 2021-10 --> October 2021 :
69
+ Here is the list of passes as of <!-- date: 2022-05 --> May 2022 :
70
70
71
71
- ` calculate-doc-coverage ` calculates information used for the ` --show-coverage `
72
72
flag.
73
73
74
74
- ` check-bare-urls ` detects links that are not linkified, e.g., in Markdown such as
75
75
` Go to https://example.com/. ` It suggests wrapping the link with angle brackets:
76
76
` Go to <https://example.com/>. ` to linkify it. This is the code behind the <!--
77
- date: 2021-10 --> ` rustdoc::bare_urls ` lint.
77
+ date: 2022-05 --> ` rustdoc::bare_urls ` lint.
78
78
79
79
- ` check-code-block-syntax ` validates syntax inside Rust code blocks
80
80
(<code >```rust</code >)
@@ -84,7 +84,7 @@ Here is the list of passes as of <!-- date: 2021-10 --> October 2021:
84
84
- ` check-invalid-html-tags ` detects invalid HTML (like an unclosed ` <span> ` )
85
85
in doc comments.
86
86
87
- - ` collect-intra-doc-links ` resolves [ intra-doc links] ( https://doc.rust-lang.org/rustdoc/linking-to-items-by-name.html ) .
87
+ - ` collect-intra-doc-links ` resolves [ intra-doc links] ( https://doc.rust-lang.org/nightly/ rustdoc/write-documentation /linking-to-items-by-name.html ) .
88
88
89
89
- ` collect-trait-impls ` collects trait impls for each item in the crate. For
90
90
example, if we define a struct that implements a trait, this pass will note
@@ -102,23 +102,6 @@ Here is the list of passes as of <!-- date: 2021-10 --> October 2021:
102
102
from the output. ` strip-private ` implies ` strip-priv-imports ` . Basically, the
103
103
goal is to remove items that are not relevant for public documentation.
104
104
105
- - ` unindent-comments ` removes excess indentation on comments in order for the
106
- Markdown to be parsed correctly. This is necessary because the convention for
107
- writing documentation is to provide a space between the ` /// ` or ` //! ` marker
108
- and the doc text, but Markdown is whitespace-sensitive. For example, a block
109
- of text with four-space indentation is parsed as a code block, so if we didn't
110
- unindent comments, these list items
111
-
112
- ``` rust,ignore
113
- /// A list:
114
- ///
115
- /// - Foo
116
- /// - Bar
117
- ```
118
-
119
- would be parsed as if they were in a code block, which is likely not what the
120
- user intended.
121
-
122
105
There is also a ` stripper ` module in ` passes/ ` , but it is a collection of
123
106
utility functions for the ` strip-* ` passes and is not a pass itself.
124
107
0 commit comments