File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
src/librustdoc/html/render Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -205,7 +205,13 @@ impl SpanMapVisitor<'_> {
205205// panicking.
206206fn hir_enclosing_body_owner ( tcx : TyCtxt < ' _ > , hir_id : HirId ) -> Option < LocalDefId > {
207207 for ( _, node) in tcx. hir_parent_iter ( hir_id) {
208- if let Some ( ( def_id, _) ) = node. associated_body ( ) {
208+ // FIXME: associated type impl items don't have an associated body, so we don't handle
209+ // them currently.
210+ if let Node :: ImplItem ( impl_item) = node
211+ && matches ! ( impl_item. kind, rustc_hir:: ImplItemKind :: Type ( _) )
212+ {
213+ return None ;
214+ } else if let Some ( ( def_id, _) ) = node. associated_body ( ) {
209215 return Some ( def_id) ;
210216 }
211217 }
Original file line number Diff line number Diff line change 1+ // This test ensures that associated types don't crash rustdoc jump to def.
2+
3+ //@ compile-flags: -Zunstable-options --generate-link-to-definition
4+
5+
6+ #![ crate_name = "foo" ]
7+
8+ //@ has 'src/foo/jump-to-def-ice-assoc-types.rs.html'
9+
10+ pub trait Trait {
11+ type Node ;
12+ }
13+
14+ pub fn y < G : Trait > ( ) {
15+ struct X < G > ( G ) ;
16+
17+ impl < G : Trait > Trait for X < G > {
18+ type Node = G :: Node ;
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments