-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Conversation
Some changes occurred in cc @camelid |
This comment has been minimized.
This comment has been minimized.
08f5c7d
to
456ba8b
Compare
This comment has been minimized.
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.
d76cb99
to
cdde87f
Compare
This comment has been minimized.
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.
cdde87f
to
a626da4
Compare
@bors r+ |
📌 Commit a626da4 has been approved by |
…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`
@bors rollup=never (for perf and bisecting reasons) |
@bors p=1 (this is blocking two other PRs) |
☀️ Test successful - checks-actions |
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 |
Slight improvements on doc benchmarks 🎉 |
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 ofthe side channel. The semantic information (rather than the strings that
used to be used for fragments) that is now captured by
UrlFragment
isenough to obviate the side channel. An additional change had to be made
to
UrlFragment
in this PR to make this possible: it now recordsDefId
s rather than item names.This PR also consolidates the checks for anchor conflicts into one place.
r? @Manishearth