From 13f30e9ef5f3d78fdaef450e935782a2edd9f88e Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Thu, 18 Mar 2021 19:39:40 +0800 Subject: Handle inner recursive macro rules cases --- crates/hir_def/src/item_tree.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/hir_def/src/item_tree.rs') diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index 7bb22c4c4..4477bdd36 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs @@ -115,6 +115,10 @@ impl ItemTree { // still need to collect inner items. ctx.lower_inner_items(stmt.syntax()) }, + ast::Item(item) => { + // Macros can expand to stmt and other item, and we add it as top level item + ctx.lower_single_item(item) + }, _ => { panic!("cannot create item tree from {:?} {}", syntax, syntax); }, -- cgit v1.2.3