-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: Generates wrong signature for function with associated type parameter #24417
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
Comments
You may want to try the nightly; a number of bugs have been fixed post-beta. Can you check? |
@steveklabnik: I can reproduce with |
👍 thanks for checking. |
triage: I-nominated This can lead to some very confusing signatures, especially since associated types are quite widely used in the standard library with core types like iterators. |
I ran into the problem while reading the documentation for mio. I have not been able to find any instances of this problem in the standard library (only a couple of hits in the [1] |
P-high, not 1.0. Seems nice to fix, but without an example of this bug occurring in the stdlib itself, it is not a 1.0 blocker. |
The exception seems to be associated types on Libcore displays this problem! But libstd does not. See .zip() in libcore and .zip() in libstd |
Functions such as `fn foo<I: Iterator>(x: I::Item)` would not render correctly and displayed `I` instead of `I::Item`. Same thing with `I::Item` appearing in where bounds. This fixes the bug by using paths for generics. Fixes rust-lang#24417
Functions such as `fn foo<I: Iterator>(x: I::Item)` would not render correctly and displayed `I` instead of `I::Item`. Same thing with `I::Item` appearing in where bounds. This fixes the bug by using paths for generics. Fixes rust-lang#24417
Functions such as `fn foo<I: Iterator>(x: I::Item)` would not render correctly and displayed `I` instead of `I::Item`. Same thing with `I::Item` appearing in where bounds. This fixes the bug by using paths for generics. Fixes rust-lang#24417
rustdoc: Associated type fixes The first commit fixes a bug with "dud" items in the search index from misrepresented `type` items in trait impl blocks. For a trait *implementation* there are typedefs which are the types for that particular trait and implementor. Skip these in the search index. There were lots of dud items in the search index due to this (search for Item, Iterator's associated type). Add a boolean to clean::TypedefItem so that it tracks whether the it is a type alias on its own, or if it's a `type` item in a trait impl. The second commit fixes a bug that made signatures and where bounds using associated types (if they were not on `Self`) incorrect. The third commit fixes so that where clauses in type alias definititons are shown. Fixes #22442 Fixes #24417 Fixes #25769
Functions such as `fn foo<I: Iterator>(x: I::Item)` would not render correctly and displayed `I` instead of `I::Item`. Same thing with `I::Item` appearing in where bounds. This fixes the bug by using paths for generics. Fixes rust-lang#24417
Create a library with the following
src/lib.rs
:and run
cargo doc
. The documentation will show the type ofFoo::foo
asfn foo(&self, bar: T)
and notfn foo(&self, bar: T::Typ)
as expected.rustdoc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
The text was updated successfully, but these errors were encountered: