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-rustdoc links do not work for unqualified names in doc for a trait impl method #66509

Closed
mzabaluev opened this issue Nov 18, 2019 · 6 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

@mzabaluev
Copy link
Contributor

mzabaluev commented Nov 18, 2019

There may be a problem with using intra-rustdoc links (#43466) in doc for a method implementation in a trait impl item. This fixup had to be made because an unqualified link to the Policy trait that is declared into the same module was rendered as [Policy] without the link. Other unqualified links to Policy in documentation elsewhere in the same module work as expected.

Meta

rustc --version --verbose:
rustc 1.41.0-nightly (5c5b8af 2019-11-16)
binary: rustc
commit-hash: 5c5b8af
commit-date: 2019-11-16
host: x86_64-unknown-linux-gnu
release: 1.41.0-nightly

@jonas-schievink jonas-schievink added 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. labels Nov 18, 2019
@mzabaluev mzabaluev changed the title Intra-rustdoc links do not work for unqualified names in doc for an impl method Intra-rustdoc links do not work for unqualified names in doc for a trait impl method Nov 18, 2019
@ghost
Copy link

ghost commented May 12, 2020

Perhaps related to #54172

@ghost
Copy link

ghost commented May 15, 2020

@mzabaluev is this duplicate of #54172 ?
If so we could close it.

@mzabaluev
Copy link
Contributor Author

@mzabaluev is this duplicate of #54172 ?

No, that issue is about links to a specific impl method. Here, the link is to an unqualified trait name, but it is located in the doc of an impl method of a different trait, which somehow breaks it.

@ghost
Copy link

ghost commented May 19, 2020

unqualified trait name

What is an unqualified trait name? Could you give an example of it?
Sorry i couldn't find anything suitable for it.

I only found fully-qualified term here
https://doc.rust-lang.org/book/ch19-03-advanced-traits.html?search=#fully-qualified-syntax-for-disambiguation-calling-methods-with-the-same-name

@mzabaluev
Copy link
Contributor Author

@xliiv Here's a minimized test case:

use std::fmt;

pub trait Pretty {
    fn to_pretty(&self) -> String;
}

pub struct Ooh<T>(T);

impl<T: Pretty> fmt::Display for Ooh<T> {
    /// Uses [`Pretty`] to format the inner object.
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str(&self.0.to_pretty())
    }
}

It works in nightly, so I assume it is fixed.

@ghost
Copy link

ghost commented May 20, 2020

Great news!

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

2 participants