Skip to content
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

Intra-doc links choose a random method if there are multiple implementations of the same generic trait #76895

Open
jyn514 opened this issue Sep 18, 2020 · 2 comments
Assignees
Labels
A-associated-items Area: Associated items (types, constants & functions) A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Sep 18, 2020

This is case three from #74489.

If a type implements a trait that's generic and implemented multiple times with different generic parameters, then rustdoc generates the same link for each. For example, [String::from] resolves to https://doc.rust-lang.org/nightly/alloc/string/struct.String.html#method.from.

However, every From implementation on String has a method called from! So the browser picks a random one.

This requires two fixes:

@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-associated-items Area: Associated items (types, constants & functions) C-bug Category: This is a bug. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name labels Sep 18, 2020
@camelid
Copy link
Member

camelid commented Dec 17, 2021

rustdoc needs to change the #method.from it generates to distinguish the different functions in the browser

cc #92052

@lolbinarycat lolbinarycat self-assigned this Nov 7, 2024
@lolbinarycat
Copy link
Contributor

took a shot at the second part, in theory it should be pretty easy to just prepend the impl disambiguator, but i can't find the code that generates the fragment just by traversing the call graph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. 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

4 participants