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: Add a warning if a link starts with # and could be an intra-doc link #76546

Closed
jyn514 opened this issue Sep 9, 2020 · 1 comment
Closed
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Sep 9, 2020

The link will be broken if the item is re-exported into a different module, see #76497 for an example. Rustdoc should recommend prefixing the link with either Self or self, depending on whether it's on a type or module.

There is a caveat here that this only works if you're documenting an item, not arbitrary # links - otherwise self and Self don't make sense. In particular rustdoc can't tell a # link from a normal link, so this would have to go after the intra-doc pass in https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/markdown.rs somewhere.

@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name labels Sep 9, 2020
@jyn514
Copy link
Member Author

jyn514 commented Sep 10, 2020

I just misunderstood the issue.

@jyn514 jyn514 closed this as completed Sep 10, 2020
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-feature-request Category: A feature request, i.e: not implemented / a PR. 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

1 participant