Skip to content

rustdoc: Show span of link definition for broken_intra_doc_links #82210

Closed
@camelid

Description

@camelid

Code

//! Look at [foo].
//!
//! [foo]: Nonexistent

Error

warning: unresolved link to `Nonexistent`
 --> foo.rs:1:13
  |
1 | //! Look at [foo].
  |             ^^^^^ no item named `Nonexistent` in scope
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

Instead (or in addition) it should point to [foo]: Nonexistent. The way it is now is confusing because you can't see Nonexistent anywhere in the span that is pointed to.

Not sure if an issue for this already exists, so I filed this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-releaseRelevant to the release subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions