diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-03-01 11:33:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-01 11:33:59 +0100 |
| commit | db12f00627e0ebabf6fca52049789e63257fbdfb (patch) | |
| tree | f35d63bafd4a58dbdfbeddcbc8f448d009efb288 | |
| parent | 415b207b7fee2416fef38ea030def6e988620c11 (diff) | |
| parent | 4747bb6017a50771f48bee856c839311134eed48 (diff) | |
Rollup merge of #137719 - GuillaumeGomez:missing-doc, r=notriddle
Add missing case explanation for doc inlined re-export of doc hidden item This case was not covered in the rustdoc book as uncovered in #137342. r? ``@notriddle``
| -rw-r--r-- | src/doc/rustdoc/src/write-documentation/re-exports.md | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/doc/rustdoc/src/write-documentation/re-exports.md b/src/doc/rustdoc/src/write-documentation/re-exports.md index 34688545c74..ee60916351a 100644 --- a/src/doc/rustdoc/src/write-documentation/re-exports.md +++ b/src/doc/rustdoc/src/write-documentation/re-exports.md @@ -85,7 +85,22 @@ pub struct Hidden; pub use self::Hidden as InlinedHidden; ``` -The same applies on re-exports themselves: if you have multiple re-exports and some of them have +However, if you still want the re-export itself to be visible, you can add the `#[doc(inline)]` +attribute on it: + +```rust,ignore (inline) +// This struct won't be visible. +#[doc(hidden)] +pub struct Hidden; + +#[doc(inline)] +pub use self::Hidden as InlinedHidden; +``` + +In this case, you will have `pub use self::Hidden as InlinedHidden;` in the generated documentation +but no link to the `Hidden` item. + +So back to `#[doc(hidden)]`: if you have multiple re-exports and some of them have `#[doc(hidden)]`, then these ones (and only these) won't appear in the documentation: ```rust,ignore (inline) |
