Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
orlp opened this issue Sep 29, 2021 · 0 comments · Fixed by #89815
Closed

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

orlp opened this issue Sep 29, 2021 · 0 comments · Fixed by #89815
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@orlp
Copy link
Contributor

orlp commented Sep 29, 2021

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.

@jyn514 jyn514 added A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 29, 2021
@bors bors closed this as completed in 7807a69 Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants