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

rustdoc intra-doc links cannot disambiguate inherent methods on generic types #85960

Open
digama0 opened this issue Jun 3, 2021 · 3 comments
Labels
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

@digama0
Copy link
Contributor

digama0 commented Jun 3, 2021

struct A;
struct B;
struct My<T>(T);
type MyA = My<A>;
type MyB = My<B>;

impl MyA { pub fn foo() {} }
impl MyB { pub fn foo() {} }

/// * fails: [MyA::foo]
/// * links to MyA::foo: [My<A>::foo]
/// * fails: [MyB::foo]
/// * links to MyA::foo: [My<B>::foo]
/// * links to MyA::foo: [My::foo]
/// * fails: [My<B>::foo-1]
pub fn main() {}

In this example, there are two implementations of My::foo for specific instantiations of the parameter. These both show up in the page for struct My, which is fine, I guess, and the links to the two methods are respectively struct.My.html#method.foo and struct.My.html#method.foo-1, so the URL scheme has difficulty with differentiating them. But I don't think intra-doc links have any analogous way to disambiguate these kinds of methods, and the substitution syntax My<A>::foo doesn't seem to work (it assumes that A is a type variable, not a struct).

This is similar to issues #74563 and #62834, and the (incorrectly closed) #54172 is about the version of this issue for trait impls, but here it's just inherent methods for different substitutions and/or type aliases. (I would like to use the type alias in the doc link, but really any way to refer to both items in the presence of this kind of ambiguity would be great.)

@digama0 digama0 added the C-bug Category: This is a bug. label Jun 3, 2021
@jyn514
Copy link
Member

jyn514 commented Jun 3, 2021

the (incorrectly closed) #54172 is about the version of this issue for trait impls

There are about 4 different problems reported in that issue, I don't plan to reopen it. The problem described in the original issue description is fixed.

@digama0
Copy link
Contributor Author

digama0 commented Jun 3, 2021

Sorry, I wasn't intending to re-litigate anything going on in that issue, only to indicate that just because the issue is closed doesn't mean that everything it talks about is no longer applicable. In any case this issue is related but different.

@jyn514
Copy link
Member

jyn514 commented Jun 3, 2021

If you find something in that issue that hasn't yet been fixed and doesn't have an open issue, please open a new issue for it.

@jyn514 jyn514 added the A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name label Jun 3, 2021
@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed T-rustdoc-temp labels Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

3 participants