Skip to content

rustdoc rendered consts should respect #[doc(hidden)] fields #49259

Closed
@SergioBenitez

Description

@SergioBenitez

For a struct and const declared as:

pub struct HiddenFoo {
    #[doc(hidden)]
    pub foo: usize,
}

pub const SOME_FOO: HiddenFoo = HiddenFoo { foo: 10 };

rustdoc currently renders:

pub const SOME_FOO: HiddenFoo

SOME_FOO: HiddenFoo = HiddenFoo { foo: 10 };

This unhides the hidden foo field. Instead, it should respect the #[doc(hidden)] attribute on foo and render the following:

pub const SOME_FOO: HiddenFoo

SOME_FOO: HiddenFoo = HiddenFoo { .. };

Or, better yet, if all fields are hidden, then I'd prefer for it to not render the definition at all:

pub const SOME_FOO: HiddenFoo

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.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