Skip to content

Check redundant_explicit_links against generated URLs#156009

Open
qaijuang wants to merge 1 commit intorust-lang:mainfrom
qaijuang:rustdoc-redundant-explicit-links-url
Open

Check redundant_explicit_links against generated URLs#156009
qaijuang wants to merge 1 commit intorust-lang:mainfrom
qaijuang:rustdoc-redundant-explicit-links-url

Conversation

@qaijuang
Copy link
Copy Markdown
Contributor

@qaijuang qaijuang commented Apr 30, 2026

Fixes #155458.

rustdoc::redundant_explicit_links checked explicit link destinations by resolving both the label and the destination as intra-doc paths. That misses links written as local rustdoc page URLs, such as struct.B.html, because those URLs do not appear in doc_link_resolutions.

This PR keeps the existing path-resolution check and falls back to comparing the explicit destination with the local href rustdoc would generate for the resolved label. Fragmented URLs remain non-redundant, since removing the explicit target would change the destination.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 30, 2026
@qaijuang qaijuang changed the title rustdoc: Check redundant_explicit_links against generated URLs Check redundant_explicit_links against generated URLs Apr 30, 2026
@qaijuang
Copy link
Copy Markdown
Contributor Author

cc @lolbinarycat

@rust-log-analyzer

This comment has been minimized.

@qaijuang qaijuang force-pushed the rustdoc-redundant-explicit-links-url branch from 78cc7d7 to 52290d1 Compare April 30, 2026 16:46
@rust-log-analyzer

This comment has been minimized.

@qaijuang qaijuang force-pushed the rustdoc-redundant-explicit-links-url branch from 52290d1 to 4c47005 Compare April 30, 2026 17:35
@qaijuang qaijuang marked this pull request as ready for review April 30, 2026 19:36
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 30, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 30, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 30, 2026

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: rustdoc
  • rustdoc expanded to 9 candidates
  • Random selection from GuillaumeGomez, fmease, lolbinarycat, notriddle

@qaijuang qaijuang force-pushed the rustdoc-redundant-explicit-links-url branch from 4c47005 to 8a48cea Compare April 30, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustdoc: redundant_explicit_links does not fire when link target is url segment.

4 participants