Traits inheritance is not documented by cargo doc


Yesterday I posted a question and when I was checking one answer I found something on the documentation that I never noticed.

The answer was correctly stating that Clone is Sized, so I open the documentation just to read details and I found out that in Clone trait documentation is not stated anywhere. I found out that documentation produced by cargo doc is not documenting which traits are inherited by another trait! :dizzy_face:

I think this information should be reported in trait documentation (maybe at the beginning or in a specific section).

What is your opinion?

Thank you

Most traits do show their “supertraits” in the documentation. For example, the Error docs show this declaration:

pub trait Error: Debug + Display { ... }

It looks like this is a rustdoc bug specifically related to the Sized trait: rustdoc: Self: Sized bounds in different crates are pruned · Issue #24183 · rust-lang/rust · GitHub


Just wondering if this is bug in the doc generator or if it is a documentation bug (so somebody just forgot to write it manually).

In my opinion this information should be automatically generated in order to avoid missing of some important information.

It is a documentation generator bug that's being worked on.


Good! Nice to know!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.