Skip to content

Rustdoc will report warnings multiple times for reference links #73264

Closed
@jyn514

Description

@jyn514

I tried this code:

/// docs [label][with#anchor#error]
pub struct S;

I expected to see this happen: rustdoc outputs a single warning that only 1 anchor is allowed

Instead, this happened: rustdoc outputs the same warning twice in a row:

warning: `[with#anchor#error]` has an issue with the link anchor.
  --> $DIR/reference-link-has-one-warning.rs:3:18
   |
LL | /// docs [label][with#anchor#error]
   |                  ^^^^^^^^^^^^^^^^^ only one `#` is allowed in a link
   |
   = note: `#[warn(intra_doc_link_resolution_failure)]` on by default

warning: `[with#anchor#error]` has an issue with the link anchor.
  --> $DIR/reference-link-has-one-warning.rs:3:18
   |
LL | /// docs [label][with#anchor#error]
   |                  ^^^^^^^^^^^^^^^^^ only one `#` is allowed in a link

warning: 2 warnings emitted

Meta

rustc --version --verbose:

<version>

@rustbot modify labels: T-rustdoc A-intra-doc-links

Metadata

Metadata

Assignees

Labels

A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-bugCategory: This is a bug.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