Skip to content

rustdoc should show module for types when the type name is not unique #37762

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

Closed
quodlibetor opened this issue Nov 14, 2016 · 0 comments
Closed
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@quodlibetor
Copy link
Contributor

If you look at the docs for ExactSizeIterator there are I think literally hundreds of implementations, with perhaps dozens that look identical, e.g. here are some lines I copied out:

impl<'a, T> ExactSizeIterator for Iter<'a, T>
impl<T> ExactSizeIterator for IntoIter<T>
impl<'a, T> ExactSizeIterator for Iter<'a, T>
impl<'a, T> ExactSizeIterator for IterMut<'a, T>
impl<T> ExactSizeIterator for IntoIter<T>
impl<T> ExactSizeIterator for IntoIter<T>

Those are all distinct implementations, but with the idiom of not-stuttering module names in type-names it is impossible to know which type you're looking for without hovering your mouse over each.

Those lines would be more helpful if they looked like:

impl<'a, T> ExactSizeIterator for btree_set::Iter<'a, T>
impl<T> ExactSizeIterator for btree_set::IntoIter<T>
impl<'a, T> ExactSizeIterator for linked_list::Iter<'a, T>
impl<'a, T> ExactSizeIterator for linked_list::IterMut<'a, T>
impl<T> ExactSizeIterator for linked_list::IntoIter<T>
impl<T> ExactSizeIterator for vec::IntoIter<T>

IMO the way that rustdoc should handle this is it should check if the type is ambiguous at all in the current documentation run (not just ambiguous on the current documentation page) and disambiguate with as many modules as necessary.

@sanxiyn sanxiyn added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Nov 15, 2016
bors added a commit that referenced this issue Jan 4, 2017
Rustdoc: disambiguate Implementors when the type name is not unique

Presentation [goes from](https://doc.rust-lang.org/stable/std/iter/trait.ExactSizeIterator.html#implementors):

<img width="492" alt="" src="https://cloud.githubusercontent.com/assets/1606434/21276752/b2b50474-c387-11e6-96e1-9766851da269.png">

to:

<img width="787" alt="" src="https://cloud.githubusercontent.com/assets/1606434/21276763/bb37f6b0-c387-11e6-8596-9163cb254674.png">

on cases where there're multiple implementors with the same name.

Fixes #37762.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants