From 7b0644d81e52d00a7a6795b187f356213ff68225 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 12 Dec 2019 14:09:13 +0100 Subject: Switch to the new location for impls --- crates/ra_hir/src/from_source.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src/from_source.rs') diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index 307f3d5bf..b35188a21 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs @@ -107,8 +107,10 @@ impl FromSource for MacroDef { impl FromSource for ImplBlock { type Ast = ast::ImplBlock; fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile) -> Option { - let id = from_source(db, src)?; - Some(ImplBlock { id }) + // XXX: use `.parent()` to avoid finding ourselves + let parent = src.value.syntax().parent()?; + let container = Container::find(db, src.with_value(parent).as_ref())?; + container.child_by_source(db)[keys::IMPL].get(&src).copied().map(ImplBlock::from) } } -- cgit v1.2.3