Skip to content

rustdoc: Tuple structs with no fields are marked as having private fields #118180

Closed
@Kyuuhachi

Description

@Kyuuhachi

I tried this code:

pub struct MyStruct();
pub enum MyEnum {
    A(),
    B(u8),
}

I would expect this to be documented as-is: as tuple structs/variants with no fields. But instead, rustdoc marks them as having private fields:

pub struct MyStruct(/* private fields */);
pub enum MyEnum {
    A(/* private fields */),
    B(u8),
}

Enums can't even have private fields!

Named structs/variants do not have this issue.

Meta

rustdoc --version --verbose:

rustdoc 1.76.0-nightly (2f8d81f9d 2023-11-21)
binary: rustdoc
commit-hash: 2f8d81f9dbac6b8df982199f69da04a4c8357227
commit-date: 2023-11-21
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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