From 26b9c793f1008e1c5cb1ca61f3c5892f8025f387 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 3 Jan 2021 17:56:59 +0800 Subject: Fixed nested eager macro bug --- crates/hir_expand/src/eager.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/hir_expand/src') diff --git a/crates/hir_expand/src/eager.rs b/crates/hir_expand/src/eager.rs index 6354b090d..ae7b51a08 100644 --- a/crates/hir_expand/src/eager.rs +++ b/crates/hir_expand/src/eager.rs @@ -218,6 +218,12 @@ fn eager_macro_recur( } }; + // check if the whole original sytnax is replaced + // Note that SyntaxRewriter cannot replace the root node itself + if child.syntax() == &original { + return Ok(insert); + } + rewriter.replace(child.syntax(), &insert); } -- cgit v1.2.3