diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-16 05:48:05 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-16 05:48:05 +0000 |
commit | 152f385055510c65bd94238878be23a258f5cc19 (patch) | |
tree | e8470eb83c1bc1283f0bb28ea01db789607a3140 /crates/hir_def/src/item_tree.rs | |
parent | c0a2b4e826e1da20d3cfa8c279fcdffa24f32a7d (diff) | |
parent | 8e07b23b84bff16c0decc6f2b80c27862eac6df1 (diff) |
Merge #8044
8044: Fix macro expansion for statements w/o semicolon r=edwin0cheng a=edwin0cheng
Fixes #7845
And up `ungrammer` to 1.12.
cc @jonas-schievink
bors r+
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/hir_def/src/item_tree.rs')
-rw-r--r-- | crates/hir_def/src/item_tree.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index 09bcb10dc..86239d903 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs | |||
@@ -110,6 +110,11 @@ impl ItemTree { | |||
110 | // still need to collect inner items. | 110 | // still need to collect inner items. |
111 | ctx.lower_inner_items(e.syntax()) | 111 | ctx.lower_inner_items(e.syntax()) |
112 | }, | 112 | }, |
113 | ast::ExprStmt(stmt) => { | ||
114 | // Macros can expand to stmt. We return an empty item tree in this case, but | ||
115 | // still need to collect inner items. | ||
116 | ctx.lower_inner_items(stmt.syntax()) | ||
117 | }, | ||
113 | _ => { | 118 | _ => { |
114 | panic!("cannot create item tree from {:?} {}", syntax, syntax); | 119 | panic!("cannot create item tree from {:?} {}", syntax, syntax); |
115 | }, | 120 | }, |