diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-03 09:58:32 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-03 09:58:32 +0000 |
commit | 354c1daedc91abd15ca0ce6ada417053ce45ecfa (patch) | |
tree | ce9f416dc64893872cba2d25b4012af0183021e1 /crates/hir_expand/src/eager.rs | |
parent | 1cc73d60bbd7149773f2eb57296d5611cbe941b1 (diff) | |
parent | 26b9c793f1008e1c5cb1ca61f3c5892f8025f387 (diff) |
Merge #7136
7136: Fixed nested eager macro bug r=edwin0cheng a=edwin0cheng
fixes #7126
bors r+
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/hir_expand/src/eager.rs')
-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 | ||