Skip to content

Documentation of associated constants #94652

Closed
@DJDuque

Description

@DJDuque

Maybe this is not a bug, but I was expecting the documentation of associated constants to work in the same way as it does for functions.

I tried this code:

pub trait MyConstants {
    const A: usize;
    const B: usize;
    const TOTAL: usize = Self::A + Self::B;
}

I was expecting the documentation to show e.g. A and B as required, and then TOTAL would just be auto generated. Same way as it happens with functions of a trait.

In practice it does work like that. I can implement only A and B, and then TOTAL will be auto implemented. The problem is that the documentation is not generated in a way that shows this, it simply looks as if all 3 constants are needed.

Metadata

Metadata

Assignees

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