-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
trait extension trait methods not always visible in rustdoc output #85995
Copy link
Copy link
Open
Labels
A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsC-bugCategory: This is a bug.Category: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsC-bugCategory: This is a bug.Category: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Hi. I'm not sure if it's right to call this a bug, but it is a thing that can be quite confusing (and time-consuming to resolve via the docs rather than via an IDE) so I thought I would file an issue.
The problem can be seen in
gitlab::api, for example. Consider this quote from the top level example on docs.rs:Suppose the user wants to know what this
querymethod is. They navigate to the docs forproject::Project(since that is the return type from the builder),Searching that page does not reveal any methods called
query. Nor is looking at the trait impls in the left sidebar particularly illuminating. Perhaps the programmer will spot thatendpointin the code is likely to be theEndpoint. Clicking through to theendpointtrait gets a page which shows various methods. No mention of aquerymethod.In fact, the
querymethod is on the extension traitQuerywhich is relevant because:It would be really nice if it would be possible to use Rustdoc output to find all the methods for a struct.
I tried to find an example in the standard library, but it wasn't so easy. The standard libray doesn't have many of these trait extension traits. The most obvious one is
ToStringwhich does seem to get itsto_stringmethod into all the places I looked. LikewiseToOwned(which is impl forT: Clone).I confess I probably don't appreciate what the downsides would be of such a change, or how hard it might be, or, why the gitlab crate output is different from the stdlib output. I hope this report is helpful anyway. Thanks.