Skip to content

Rustdoc does not list associated constants for types in the sidebar #89354

@orlp

Description

@orlp

Consider the following struct and trait:

pub trait Trait {
    /// Foo.
    fn foo() { }

    /// Bar.
    const BAR: usize = 0;
}

pub struct Struct { }

impl Struct {
    /// Foo.
    pub fn foo() { }

    /// Bar.
    pub const BAR: usize = 0;
}

The sidebar generated by rustdoc for the trait is informative, allowing you to quickly jump to the methods and associated constants:
image

Sadly, the associated constant is completely missing in the sidebar for the struct:
image

This is particularly painful for types with many members, such as f32. It is not immediately obvious which associated constants it has. In my opinion rustdoc should also generate an 'associated constants' section in the sidebar for types, not just for traits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)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