Subtrait Section

Please can a Subtrait section be added to the documentation (where applicable) so that it’s possible to quickly navigate the subtraits? This balances with the Implementors section.

Apologies if this has been asked before.


this seems like it should be a feature request for rustdoc, which is technically a separate program from the compiler.

Note that it's likely that only subtraits defined within the same crate as the supertrait would be available for listing, unless rustdoc adopted the concept of looking at dependants during a cargo doc alongside the dependencies.

And if it did that, it would of course only add the subtraits defined within that specific build. It would also carry the consequence of making doc builds irreproducible, since what the dependency graph as a whole looks like would matter for what the derived subtraits section would look like.

It's a limitation I think is worth pointing out explicitly as it may not be super obvious initially.


For fairness, this is also how the implementors section of the trait documentation page works. Once you have an intuition for what types do/don't show up in that list, it's reasonably straightforward to apply that same intuition to what subtraits would get listed.

In fact, at least for object safe traits, you could argue them to be the same question/problem, since it's true that dyn ExactSizeIterator is an implementor of trait Iterator.