diff options
| author | Chayim Refael Friedman <chayimfr@gmail.com> | 2025-01-12 23:28:30 +0200 |
|---|---|---|
| committer | Chayim Refael Friedman <chayimfr@gmail.com> | 2025-01-13 15:55:30 +0200 |
| commit | 70309b11e0440135e9ce08028aa8e5082067a757 (patch) | |
| tree | 4cfda8f334ba0dd36468407e48a69b2264f7ed5a /src/tools/rust-analyzer/crates/mbe | |
| parent | 0f900e24281c812752ed2bdb47650b985923b519 (diff) | |
| download | rust-70309b11e0440135e9ce08028aa8e5082067a757.tar.gz rust-70309b11e0440135e9ce08028aa8e5082067a757.zip | |
Fix another bug when reaching macro expansion limit caused a stack overflow
This time without missing bindings. Solve it by returning to the old ways, i.e. just throw the extra nodes away. In other words, I acknowledge defeat.
Diffstat (limited to 'src/tools/rust-analyzer/crates/mbe')
| -rw-r--r-- | src/tools/rust-analyzer/crates/mbe/src/expander/transcriber.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/mbe/src/expander/transcriber.rs b/src/tools/rust-analyzer/crates/mbe/src/expander/transcriber.rs index acab989437a..7710ea79389 100644 --- a/src/tools/rust-analyzer/crates/mbe/src/expander/transcriber.rs +++ b/src/tools/rust-analyzer/crates/mbe/src/expander/transcriber.rs @@ -448,6 +448,7 @@ fn expand_repeat( let mut counter = 0; let mut err = None; + let initial_restore_point = builder.restore_point(); let mut restore_point = builder.restore_point(); loop { let ExpandResult { value: (), err: e } = @@ -465,6 +466,10 @@ fn expand_repeat( counter += 1; if counter == limit { + // FIXME: This is a bug here, we get here when we shouldn't, see https://github.com/rust-lang/rust-analyzer/issues/18910. + // If we don't restore we emit a lot of nodes which causes a stack overflow down the road. For now just ignore them, + // there is always an error here anyway. + builder.restore(initial_restore_point); err = Some(ExpandError::new(ctx.call_site, ExpandErrorKind::LimitExceeded)); break; } |
