Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing case explanation for doc inlined re-export of doc hidden item #137719

Merged
merged 1 commit into from
Mar 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/doc/rustdoc/src/write-documentation/re-exports.md
Original file line number Diff line number Diff line change
@@ -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)
Loading