Skip to content

Commit 00cf19a

Browse files
committed
Auto merge of rust-lang#107933 - petrochenkov:rmdlc, r=GuillaumeGomez
rustdoc: Remove cache for preprocessed markdown links It's quite possible that it's no longer useful after rust-lang#94857 is merged.
2 parents adb4bfd + 0e61d3a commit 00cf19a

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

828818
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)