Skip to content

Commit 0e61d3a

Browse files
committed
rustdoc: Remove cache for preprocessed markdown links
1 parent 8dabf5d commit 0e61d3a

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

src/librustdoc/core.rs

-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ use crate::clean::inline::build_external_trait;
2727
use crate::clean::{self, ItemId};
2828
use crate::config::{Options as RustdocOptions, OutputFormat, RenderOptions};
2929
use crate::formats::cache::Cache;
30-
use crate::passes::collect_intra_doc_links::PreprocessedMarkdownLink;
3130
use crate::passes::{self, Condition::*};
3231

3332
pub(crate) use rustc_session::config::{Input, Options, UnstableOptions};
3433

3534
pub(crate) struct ResolverCaches {
36-
pub(crate) markdown_links: Option<FxHashMap<String, Vec<PreprocessedMarkdownLink>>>,
3735
pub(crate) all_trait_impls: Option<Vec<DefId>>,
3836
pub(crate) all_macro_rules: FxHashMap<Symbol, Res<NodeId>>,
3937
pub(crate) extern_doc_reachable: DefIdSet,

src/librustdoc/passes/collect_intra_doc_links.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -806,22 +806,12 @@ impl<'a, 'tcx> DocVisitor for LinkCollector<'a, 'tcx> {
806806
// NOTE: if there are links that start in one crate and end in another, this will not resolve them.
807807
// This is a degenerate case and it's not supported by rustdoc.
808808
let parent_node = parent_module.or(parent_node);
809-
let mut tmp_links = self
810-
.cx
811-
.resolver_caches
812-
.markdown_links
813-
.take()
814-
.expect("`markdown_links` are already borrowed");
815-
if !tmp_links.contains_key(&doc) {
816-
tmp_links.insert(doc.clone(), preprocessed_markdown_links(&doc));
817-
}
818-
for md_link in &tmp_links[&doc] {
819-
let link = self.resolve_link(item, &doc, parent_node, md_link);
809+
for md_link in preprocessed_markdown_links(&doc) {
810+
let link = self.resolve_link(item, &doc, parent_node, &md_link);
820811
if let Some(link) = link {
821812
self.cx.cache.intra_doc_links.entry(item.item_id).or_default().push(link);
822813
}
823814
}
824-
self.cx.resolver_caches.markdown_links = Some(tmp_links);
825815
}
826816

827817
if item.is_mod() {

src/librustdoc/passes/collect_intra_doc_links/early.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub(crate) fn early_resolve_intra_doc_links(
2424
link_resolver.process_extern_impls();
2525

2626
ResolverCaches {
27-
markdown_links: Some(Default::default()),
2827
all_trait_impls: Some(link_resolver.all_trait_impls),
2928
all_macro_rules: link_resolver.all_macro_rules,
3029
extern_doc_reachable: link_resolver.extern_doc_reachable,

0 commit comments

Comments
 (0)