Skip to content

Rustdoc shouldn't document a struct's associated constants as methods #70475

Closed
@melaquin

Description

@melaquin

When writing associated constants in a struct's implementation, those constants appear under the Methods section. Here's a minimal example:

struct Struc;

impl Struc {
    const S: u64 = 0;
}

$ cargo doc

For traits though, they appear under Associated Constants:

trait Tr {
    const S: u64 = 0;
}

There should also be an Associated Constants section for struct documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)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