Skip to content

Commit ff7533e

Browse files
committed
rustdoc book: acknowlage --document-hidden-items
1 parent 7028d93 commit ff7533e

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/doc/rustdoc/src/command-line-arguments.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ mod private { // this item is private and will not be documented
100100
}
101101
```
102102

103-
`--document-private-items` documents all items, even if they're not public.
103+
`--document-private-items` includes all non-public items in the generated documentation except for `#[doc(hidden)]` items. Private items will be shown with a 🔒 icon.
104+
104105

105106
## `-L`/`--library-path`: where to look for dependencies
106107

src/doc/rustdoc/src/unstable-features.md

+19
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,25 @@ themselves marked as unstable. To use any of these options, pass `-Z unstable-op
258258
the flag in question to Rustdoc on the command-line. To do this from Cargo, you can either use the
259259
`RUSTDOCFLAGS` environment variable or the `cargo rustdoc` command.
260260

261+
### `--document-hidden-items`: Show items that are `#[doc(hidden)]`
262+
<span id="document-hidden-items"></span>
263+
264+
By default, `rustdoc` does not document items that are annotated with
265+
[`#[doc(hidden)]`](write-documentation/the-doc-attribute.html#hidden).
266+
267+
`--document-hidden-items` causes all items to be documented as if they did not have `#[doc(hidden)]`, except that hidden items will be shown with a 👻 icon.
268+
269+
Here is a table that fully describes which items are documented with each combination of `--document-hidden-items` and `--document-private-items`:
270+
271+
272+
| rustdoc flags | items that will be documented |
273+
|---------------------------------|---------------------------------------|
274+
| neither flag | only public items that are not hidden |
275+
| only `--document-hidden-items` | all public items |
276+
| only `--document-private-items` | all items that are not hidden |
277+
| both flags | all items |
278+
279+
261280
### `--markdown-before-content`: include rendered Markdown before the content
262281

263282
* Tracking issue: [#44027](https://github.com/rust-lang/rust/issues/44027)

src/doc/rustdoc/src/write-documentation/the-doc-attribute.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,8 @@ If you want to know more about inlining rules, take a look at the
230230

231231
<span id="dochidden"></span>
232232

233-
Any item annotated with `#[doc(hidden)]` will not appear in the documentation, unless
234-
the `strip-hidden` pass is removed. Re-exported items where one of its ancestors has
235-
`#[doc(hidden)]` will be considered the same as private.
233+
Any item annotated with `#[doc(hidden)]` will not appear in the documentation,
234+
unless the [`--document-hidden-items`](../unstable-features.md#document-hidden-items) flag is used.
236235

237236
You can find more information in the [`re-exports` chapter](./re-exports.md).
238237

0 commit comments

Comments
 (0)