From ec2895e95649ca87bcac54ee635abb8b6f78b086 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 9 Apr 2021 17:14:48 +0200 Subject: Insert unnamed consts to ChildBySource DynMap --- crates/hir_def/src/child_by_source.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/hir_def') diff --git a/crates/hir_def/src/child_by_source.rs b/crates/hir_def/src/child_by_source.rs index f40a7f80d..f2e809ca9 100644 --- a/crates/hir_def/src/child_by_source.rs +++ b/crates/hir_def/src/child_by_source.rs @@ -80,6 +80,10 @@ impl ChildBySource for ModuleId { impl ChildBySource for ItemScope { fn child_by_source_to(&self, db: &dyn DefDatabase, res: &mut DynMap) { self.declarations().for_each(|item| add_module_def(db, res, item)); + self.unnamed_consts().for_each(|konst| { + let src = konst.lookup(db).source(db); + res[keys::CONST].insert(src, konst); + }); self.impls().for_each(|imp| add_impl(db, res, imp)); fn add_module_def(db: &dyn DefDatabase, map: &mut DynMap, item: ModuleDefId) { -- cgit v1.2.3