-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustdoc: Include (or link to) methods "inherited" through auto-deref #19190
Comments
Using the |
Nominating for 1.0-stable. |
It would be sweet if this were fixed. But its not a 1.0 blocker. Assigning P-high. |
This is incredibly confusing for people new to the language. Hopefully this gets implemented soon (I'd be happy to help if I could get some direction). |
I've made a couple prototype implementations of this feature in rustdoc and discovered where the pain points are for me. For 1.0, I think the best thing would be a more conservative implementation of this feature, designed to accommodate the most common uses of We absolutely need to be able to inline methods for these very commonly used, and often asked about, standard library deref pairs:
Another nice to have would be additional sections on the Other, more exotic |
nominating for 1.0, while I don't think it should be a blocker, it's a really, really bad polish issue, at least as bad as #23511 |
Assigning to @alexcrichton for 1.0. |
Whenever a type implements Deref, rustdoc will now add a section to the "methods available" sections for "Methods from Deref<Target=Foo>", listing all the inherent methods of the type `Foo`. Closes rust-lang#19190
Whenever a type implements Deref, rustdoc will now add a section to the "methods available" sections for "Methods from Deref<Target=Foo>", listing all the inherent methods of the type `Foo`. Closes rust-lang#19190
Whenever a type implements Deref, rustdoc will now add a section to the "methods available" sections for "Methods from Deref<Target=Foo>", listing all the inherent methods of the type `Foo`. Closes rust-lang#19190
Whenever a type implements Deref, rustdoc will now add a section to the "methods available" sections for "Methods from Deref<Target=Foo>", listing all the inherent methods of the type `Foo`. Closes rust-lang#19190
Whenever a type implements Deref, rustdoc will now add a section to the "methods available" sections for "Methods from Deref<Target=Foo>", listing all the inherent methods of the type `Foo`. Closes rust-lang#19190
Based on new-user questions on IRC, many users are confused by the fact that this is valid code:
even though the
Vec<T>
documentation does not include a method namedhead
. This is becausehead
is actually a method on type[T]
, andVec<T>
implementsDeref<[T]>
.More generally, it's not easy (1) to look at the documentation for a given type and see all the methods that are callable on values of that type, or (2) to look at a piece of code and figure out where to find the documentation for a given method.
This could be fixed by listing "
T
methods callable via dereference" on the documentation page for a any type that implementsDeref<T>
. (This is similar to how systems like JavaDoc list "methods inherited fromBaseClass
" in the docs for any class that extendsBaseClass
.)The text was updated successfully, but these errors were encountered: