Skip to content

rustdoc: Inconsistant decision to include impl with docs but no visible items #111564

Open
@aDotInTheVoid

Description

@aDotInTheVoid

Since #90905, rustdoc has impl blocks with docs but no items: But it's logic doesn't make (user facing) sense

pub struct Foo;

/// 1. Empty
impl Foo {}

/// 2. Private
impl Foo {
    fn private() {}
}

/// 3. Public
impl Foo {
    pub fn public() {}
}

/// 4. Public Hidden
impl Foo {
    #[doc(hidden)]
    fn public_hidden() {}
}

/// 5. Private Hidden
impl Foo {
    #[doc(hidden)]
    fn priviate_hidden() {}
}

Running this code across various flag's gets us:

Header --document-private-items --document-hidden-items --document-private-items --document-hidden-items
Empty ✔️ ✔️ ✔️ ✔️
Private ✔️ ✔️ ✔️
Public ✔️ ✔️ ✔️ ✔️
Public Hidden ✔️ ✔️ ✔️ ✔️
Private Hidden ✔️ ✔️ ✔️ ✔️

It doesn't make sense that adding #[doc(hidden)] to a private function makes it's block visible, or that running --document-hidden-items makes a block with only private functions visible. I'm not sure what the exact behavior should be here

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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