diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2024-03-18 18:35:49 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2024-03-18 21:35:18 -0700 |
| commit | cdeb170fc21dc9099c2a79ea8c36be58a7b405f4 (patch) | |
| tree | 03ae3aaa611e0f7783fd4f9497f71cbad69d8d64 /compiler/rustc_parse/src/parser | |
| parent | 3c85e56249b0b1942339a6a989a971bf6f1c9e0f (diff) | |
| download | rust-cdeb170fc21dc9099c2a79ea8c36be58a7b405f4.tar.gz rust-cdeb170fc21dc9099c2a79ea8c36be58a7b405f4.zip | |
Ensure stack before parsing dot-or-call
There are many cases where, due to codegen or a massively unruly codebase, a deeply nested call(call(call(call(call(call(call(call(call(f()))))))))) can happen. This is a spot where it would be good to grow our stack, so that we can survive to tell the programmer their code is dubiously written.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index e27a5f93799..136145dd182 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -943,7 +943,10 @@ impl<'a> Parser<'a> { // Stitch the list of outer attributes onto the return value. // A little bit ugly, but the best way given the current code // structure - let res = self.parse_expr_dot_or_call_with_(e0, lo); + let res = ensure_sufficient_stack( + // this expr demonstrates the recursion it guards against + || self.parse_expr_dot_or_call_with_(e0, lo), + ); if attrs.is_empty() { res } else { |
