about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-07-01 00:35:06 +0200
committerGitHub <noreply@github.com>2023-07-01 00:35:06 +0200
commite82396957395dfddd7f715490246456fa16d49af (patch)
tree44583f581bf8e4283b9b7b5e2be5120785a70839
parenta2c18616e303b805aa81e6c8e58a4cdef10ea7e5 (diff)
parent53185459df4552905b4d1c070ee895c2faa9e7a3 (diff)
downloadrust-e82396957395dfddd7f715490246456fa16d49af.tar.gz
rust-e82396957395dfddd7f715490246456fa16d49af.zip
Rollup merge of #113186 - jyn514:intra-doc-panic, r=petrochenkov
document that the panic in collect_intra_doc_links is load-bearing

r? ``@petrochenkov``
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index c31ba3304b0..0dd9e590b9b 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));