Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: Remove the intra-doc links side channel #92601

Merged
merged 9 commits into from
Jan 11, 2022

Conversation

camelid
Copy link
Member

@camelid camelid commented Jan 6, 2022

The side channel made the code much more complex and harder to
understand. It was added as a temporary workaround in
0c99d80, but it's no longer necessary.

The addition of UrlFragment in #92088 was the key to getting rid of
the side channel. The semantic information (rather than the strings that
used to be used for fragments) that is now captured by UrlFragment is
enough to obviate the side channel. An additional change had to be made
to UrlFragment in this PR to make this possible: it now records
DefIds rather than item names.

This PR also consolidates the checks for anchor conflicts into one place.

r? @Manishearth

@camelid camelid added A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-cleanup Category: PRs that clean code up or issues documenting cleanup. labels Jan 6, 2022
@rust-highfive
Copy link
Collaborator

Some changes occurred in clean/types.rs.

cc @camelid

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 6, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2022
@camelid camelid 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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 6, 2022
@camelid camelid marked this pull request as draft January 6, 2022 01:20
@rust-log-analyzer

This comment has been minimized.

@camelid camelid added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 6, 2022
@camelid camelid marked this pull request as ready for review January 6, 2022 05:38
@camelid camelid changed the title rustdoc: Continue cleaning up intra-doc links code rustdoc: Remove the intra-doc links side channel Jan 6, 2022
@bors

This comment has been minimized.

I think it makes the code easier to understand.
This is the next step in computing more "semantic" information during
intra-doc link collection and then doing rendering all at the end.
This coalesces the checks into one place.
I had the epiphany that now that fragments are "semantic" -- rather than
just strings -- they fill the role that used to be handled by the side
channel. I think I may be able to get rid of the other uses of the side
channel using this technique too.
@rust-log-analyzer

This comment has been minimized.

Hooray! It was no longer used, so it can just be deleted.
This allows eliminating branches in the code where a user-written
fragment is impossible.
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 6, 2022

📌 Commit a626da4 has been approved by Manishearth

@bors bors 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 Jan 6, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 6, 2022
…anishearth

rustdoc: Remove the intra-doc links side channel

The side channel made the code much more complex and harder to
understand. It was added as a temporary workaround in
0c99d80, but it's no longer necessary.

The addition of `UrlFragment` in rust-lang#92088 was the key to getting rid of
the side channel. The semantic information (rather than the strings that
used to be used for fragments) that is now captured by `UrlFragment` is
enough to obviate the side channel. An additional change had to be made
to `UrlFragment` in this PR to make this possible: it now records
`DefId`s rather than item names.

This PR also consolidates the checks for anchor conflicts into one place.

r? `@Manishearth`
@camelid
Copy link
Member Author

camelid commented Jan 6, 2022

@bors rollup=never (for perf and bisecting reasons)

@camelid
Copy link
Member Author

camelid commented Jan 10, 2022

@bors p=1 (this is blocking two other PRs)

@bors
Copy link
Contributor

bors commented Jan 11, 2022

⌛ Testing commit a626da4 with merge 1f213d9...

@bors
Copy link
Contributor

bors commented Jan 11, 2022

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing 1f213d9 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 11, 2022
@bors bors merged commit 1f213d9 into rust-lang:master Jan 11, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 11, 2022
@camelid camelid deleted the more-intra-doc-cleanup branch January 11, 2022 03:22
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1f213d9): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@camelid
Copy link
Member Author

camelid commented Jan 11, 2022

Slight improvements on doc benchmarks 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-cleanup Category: PRs that clean code up or issues documenting cleanup. merged-by-bors This PR was explicitly merged by bors. 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.

8 participants