Skip to content

rustdoc: Add a warning if a link starts with # and could be an intra-doc link #76546

Closed

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions