Skip to content

Check redundant_explicit_links against generated URLs - #156009

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

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

Conversation

@qaijuang

@qaijuang qaijuang commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

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 that rustdoc would generate for the resolved label.

@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

This comment has been minimized.

@qaijuang
qaijuang force-pushed the rustdoc-redundant-explicit-links-url branch from 4c47005 to 8a48cea Compare April 30, 2026 19:49
@qaijuang

Copy link
Copy Markdown
Contributor Author

I just noticed #156711, which seems related to broader rustdoc/compiler path-resolution work.

Does that tracking issue change the desired direction for this PR? If the preferred approach is to wait for the broader item-signature resolution mechanism, I’m happy to adjust/park this, but I’d appreciate guidance so I know whether this PR is still worth pursuing.

@fmease

fmease commented May 18, 2026

Copy link
Copy Markdown
Member

I've yet to review your PR (sorry about that), so I can't tell for certain. However, I'm inclined to believe that the feature described in that tracking issue is not relevant. Double-checking that later.

@rust-bors

This comment has been minimized.

@qaijuang

Copy link
Copy Markdown
Contributor Author

☔ The latest upstream changes (presumably #159046) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

will rebase rq

@qaijuang
qaijuang force-pushed the rustdoc-redundant-explicit-links-url branch from 8a48cea to da95d5c Compare July 10, 2026 08:42
@rustbot

This comment has been minimized.

@qaijuang

Copy link
Copy Markdown
Contributor Author

Seems @fmease is tight on schedule, safe to @rustbot reroll

@rustbot rustbot assigned GuillaumeGomez and unassigned fmease Jul 10, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member

Sorry, just uncovered this PR in my "to review list". ^^'

Thanks for the improvement!

@bors r+ rollup

@rust-bors

rust-bors Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit da95d5c has been approved by GuillaumeGomez

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 24, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 24, 2026
…t-links-url, r=GuillaumeGomez

Check `redundant_explicit_links` against generated URLs

Fixes rust-lang#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 that rustdoc would generate for the resolved label.
@JonathanBrouwer

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #161683 (comment)

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 24, 2026
@rust-bors

rust-bors Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#161683), which was unapproved.

View changes since this unapproval

@qaijuang

Copy link
Copy Markdown
Contributor Author

I’ll do rebase in a few mins 🫠

@qaijuang
qaijuang force-pushed the rustdoc-redundant-explicit-links-url branch from da95d5c to 1f5e36d Compare August 24, 2026 19:14
@rustbot

rustbot commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@GuillaumeGomez

Copy link
Copy Markdown
Member

Let's go again! =D

@bors r+ rollup

@rust-bors

rust-bors Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f5e36d has been approved by GuillaumeGomez

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 24, 2026
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 24, 2026
…t-links-url, r=GuillaumeGomez

Check `redundant_explicit_links` against generated URLs

Fixes rust-lang#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 that rustdoc would generate for the resolved label.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 24, 2026
…t-links-url, r=GuillaumeGomez

Check `redundant_explicit_links` against generated URLs

Fixes rust-lang#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 that rustdoc would generate for the resolved label.
rust-bors Bot pushed a commit that referenced this pull request Aug 24, 2026
Rollup of 9 pull requests

Successful merges:

 - #161689 (bootstrap: don't LTO C dependencies on aarch64)
 - #161553 (rustdoc: fix issue preventing "read more" links from generating.)
 - #161670 (Pass LargeDataThreshold to LLVM module IR)
 - #146529 (rustdoc: Nuke `--passes=list` and defossilize the passes infrastructure)
 - #156009 (Check `redundant_explicit_links` against generated URLs)
 - #159583 (Add new `invalid_markdown_table` rustdoc lint)
 - #161098 (PassWrapper: handle LLVM 24 change in function types)
 - #161641 (Check for missing rustfmt in the stdarch intrinsic test step sooner)
 - #161661 (Don't treat slashes as path seps after drive letters in verbatim paths)

Failed merges:

 - #156749 (remove `box_patterns`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants