Skip to content

Commit 1f213d9

Browse files
committed
Auto merge of #92601 - camelid:more-intra-doc-cleanup, r=Manishearth
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 #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`
2 parents 89b9f7b + a626da4 commit 1f213d9

File tree

2 files changed

+148
-142
lines changed

2 files changed

+148
-142
lines changed

src/librustdoc/clean/types.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::cell::RefCell;
22
use std::default::Default;
3-
use std::fmt::Write;
43
use std::hash::Hash;
54
use std::lazy::SyncOnceCell as OnceCell;
65
use std::path::PathBuf;
@@ -496,7 +495,7 @@ impl Item {
496495
if let Ok((mut href, ..)) = href(*did, cx) {
497496
debug!(?href);
498497
if let Some(ref fragment) = *fragment {
499-
write!(href, "{}", fragment).unwrap()
498+
fragment.render(&mut href, cx.tcx()).unwrap()
500499
}
501500
Some(RenderedLink {
502501
original_text: s.clone(),

0 commit comments

Comments
 (0)