Skip to content

Rustdoc reports intradoc link errors twice if there are multiple links #77681

Closed
@jyn514

Description

@jyn514

I tried this code:

/// Links to [a] [twice][a]
///
/// [a]: not_found
pub fn f() {}

I expected to see this happen: Rustdoc warns once, because there is only one reference link.

Instead, this happened: Rustdoc warns twice, because there are multiple uses of the reference link.

warning: unresolved link to `not_found`
 --> tmp.rs:3:10
  |
3 | /// [a]: not_found
  |          ^^^^^^^^^ the module `tmp` contains no item named `not_found`
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `not_found`
 --> tmp.rs:3:10
  |
3 | /// [a]: not_found
  |          ^^^^^^^^^ the module `tmp` contains no item named `not_found`
  |
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

Meta

rustdoc +nightly --version: rustdoc 1.48.0-nightly (8fe73e8 2020-10-01)

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-bugCategory: This is a bug.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.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