about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-08-10 15:49:22 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-08-10 15:49:22 +0200
commit25e767b0ee95d21b62d2fb509809946005081d40 (patch)
treedef2b22baec17d7ca8e7c22341014c14e3ec8648 /src
parentd528a49fd7c0447cc51406908fb13fe055d273aa (diff)
downloadrust-25e767b0ee95d21b62d2fb509809946005081d40.tar.gz
rust-25e767b0ee95d21b62d2fb509809946005081d40.zip
Ignore impl associated types in jump to def feature
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render/span_map.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs
index 6906e6e30ff..e5bdc2a941c 100644
--- a/src/librustdoc/html/render/span_map.rs
+++ b/src/librustdoc/html/render/span_map.rs
@@ -205,7 +205,13 @@ impl SpanMapVisitor<'_> {
 // panicking.
 fn hir_enclosing_body_owner(tcx: TyCtxt<'_>, hir_id: HirId) -> Option<LocalDefId> {
     for (_, node) in tcx.hir_parent_iter(hir_id) {
-        if let Some((def_id, _)) = node.associated_body() {
+        // FIXME: associated type impl items don't have an associated body, so we don't handle
+        // them currently.
+        if let Node::ImplItem(impl_item) = node
+            && matches!(impl_item.kind, rustc_hir::ImplItemKind::Type(_))
+        {
+            return None;
+        } else if let Some((def_id, _)) = node.associated_body() {
             return Some(def_id);
         }
     }