diff options
-rw-r--r-- | crates/ra_ide_api/src/name_kind.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/name_kind.rs b/crates/ra_ide_api/src/name_kind.rs index 2f944fb04..583399cfe 100644 --- a/crates/ra_ide_api/src/name_kind.rs +++ b/crates/ra_ide_api/src/name_kind.rs | |||
@@ -221,6 +221,9 @@ impl HasDefinition for AssocItem { | |||
221 | } | 221 | } |
222 | 222 | ||
223 | fn from_def(db: &RootDatabase, file_id: HirFileId, def: Self::Def) -> Option<Definition> { | 223 | fn from_def(db: &RootDatabase, file_id: HirFileId, def: Self::Def) -> Option<Definition> { |
224 | if def.syntax().parent().and_then(ast::ItemList::cast).is_none() { | ||
225 | return None; | ||
226 | } | ||
224 | let src = hir::Source { file_id, ast: def }; | 227 | let src = hir::Source { file_id, ast: def }; |
225 | let item = AssocItem::from_source(db, src)?; | 228 | let item = AssocItem::from_source(db, src)?; |
226 | Some(item.definition(db)) | 229 | Some(item.definition(db)) |