Skip to content

rustdoc: Provide a flag to document private items while also stripping hidden items #60884

Closed
@euclio

Description

@euclio

Some crates would like to document private items, but still respect #[doc(hidden)].

For example, synstructure generates private constant implementation details for hygiene reasons. Since these constants are private, they normally do not appear in documentation, but they do appear if a downstream crate uses --document-private-items.

The constants are annotated with #[doc(hidden)], so they can be hidden from documentation by using --document-private-items in tandem with --passes strip-hidden, but the --passes flag is deprecated.

Ideally, --document-private-items would be modified to still strip hidden items, because I believe that this is the more common use case. #[doc(hidden)] is generally used for implementation details (hygiene, __Nonexhaustive, etc.), and likely shouldn't ever actually be in the documentation, even for crates that want to document private items. Perhaps the current behavior could be renamed to --document-hidden-items. However, --document-private-items is stable, so I don't think this change can be made.

Instead, I propose adding (and eventually stabilizing) a new flag for rustdoc that has the same effect as --document-private-items and --passes strip-hidden. Something like --document-private-items=exclude-hidden?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions