diff options
author | Edwin Cheng <[email protected]> | 2021-01-03 09:56:59 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2021-01-03 09:56:59 +0000 |
commit | 26b9c793f1008e1c5cb1ca61f3c5892f8025f387 (patch) | |
tree | fdc17f36a30935662993a7a285c309d727dd93f4 /crates/hir_expand/src | |
parent | 895d97cfa016ca46c648d250eccb8befa7863502 (diff) |
Fixed nested eager macro bug
Diffstat (limited to 'crates/hir_expand/src')
-rw-r--r-- | crates/hir_expand/src/eager.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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( | |||
218 | } | 218 | } |
219 | }; | 219 | }; |
220 | 220 | ||
221 | // check if the whole original sytnax is replaced | ||
222 | // Note that SyntaxRewriter cannot replace the root node itself | ||
223 | if child.syntax() == &original { | ||
224 | return Ok(insert); | ||
225 | } | ||
226 | |||
221 | rewriter.replace(child.syntax(), &insert); | 227 | rewriter.replace(child.syntax(), &insert); |
222 | } | 228 | } |
223 | 229 | ||