From 53185459df4552905b4d1c070ee895c2faa9e7a3 Mon Sep 17 00:00:00 2001 From: jyn Date: Thu, 29 Jun 2023 23:48:56 -0500 Subject: [PATCH] document that the panic in collect_intra_doc_links is load-bearing --- src/librustdoc/passes/collect_intra_doc_links.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index c31ba3304b032..0dd9e590b9bb8 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -398,6 +398,10 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { .doc_link_resolutions(module_id) .get(&(Symbol::intern(path_str), ns)) .copied() + // NOTE: do not remove this panic! Missing links should be recorded as `Res::Err`; if + // `doc_link_resolutions` is missing a `path_str`, that means that there are valid links + // that are being missed. To fix the ICE, change + // `rustc_resolve::rustdoc::attrs_to_preprocessed_links` to cache the link. .unwrap_or_else(|| panic!("no resolution for {:?} {:?} {:?}", path_str, ns, module_id)) .and_then(|res| res.try_into().ok()) .or_else(|| resolve_primitive(path_str, ns));