Skip to content

[rustdoc] Correctly handle intra-doc links on inlined same item with different names - #162669

Open
GuillaumeGomez wants to merge 3 commits into
rust-lang:mainfrom
GuillaumeGomez:inline-same-item-with-different-names
Open

[rustdoc] Correctly handle intra-doc links on inlined same item with different names#162669
GuillaumeGomez wants to merge 3 commits into
rust-lang:mainfrom
GuillaumeGomez:inline-same-item-with-different-names

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

Fixes #136777.

It works as follow: we keep the DefId indexing, but we add a new alternatives entry (same inlined items, but under a different path) which allows to pick the right entry.

So now, why this approach instead of changing the indexing (like (DefId, Symbol))? Because it's much less common to import a same item with different names, so increasing the size of the index seems unnecessary. That does make the code more noisy, which I'm not a big fan of, so if someone has ideas for improvements, definitely interested!

r? @lolbinarycat

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Sep 11, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 11, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 11, 2026
…t-names, r=<try>

[rustdoc] Correctly handle intra-doc links on inlined same item with different names
@rust-bors

rust-bors Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 99fb368 (99fb3688c36e7a0926fe47967953f64fb06a366a)
Base parent: 0fc1413 (0fc141305da7a8a222f65aef1f1acc739c46282b)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (99fb368): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.0%, secondary -1.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.7% [0.5%, 1.1%] 3
Regressions ❌
(secondary)
3.9% [3.9%, 3.9%] 1
Improvements ✅
(primary)
-0.6% [-0.8%, -0.4%] 4
Improvements ✅
(secondary)
-6.0% [-6.0%, -6.0%] 1
All ❌✅ (primary) -0.0% [-0.8%, 1.1%] 7

Cycles

Results (primary 0.1%, secondary 1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.9% [0.4%, 1.7%] 8
Regressions ❌
(secondary)
1.2% [1.2%, 1.2%] 1
Improvements ✅
(primary)
-0.7% [-1.0%, -0.5%] 7
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-1.0%, 1.7%] 15

Binary size

Results (primary 0.0%, secondary 0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.1%] 4
Regressions ❌
(secondary)
0.0% [0.0%, 0.1%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.1%] 4

Bootstrap: 492.706s -> 494.246s (0.31%)
Artifact size: 406.91 MiB -> 406.92 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 12, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

That's an unexpected good surprise. =D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-json Area: Rustdoc JSON backend 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustdoc regression: intra-doc link links to wrong item

4 participants