-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Grow the stack to allow parsing deeply nested expressions if necessary. #93730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit fcea6bf with merge b6f8940bd8fbcba4b12dc8019074b0b60e95bf89... |
☀️ Try build successful - checks-actions |
Queued b6f8940bd8fbcba4b12dc8019074b0b60e95bf89 with parent 926e784, future comparison URL. |
Finished benchmarking commit (b6f8940bd8fbcba4b12dc8019074b0b60e95bf89): comparison url. Summary: This benchmark run shows 33 relevant regressions 😿 to instruction counts.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
I'm not even sure that it's something that needs to be fixed. Stack overflow is not even an ICE or bug, just a regular runtime error caused by system resource exhaustion, like "disk full" or something. |
Could you elaborate why? |
I thought that |
My rationale was that of all syntactic constructs expressions are the most likely to be deeply nested and hitting the stack limit (e.g. when auto-generated). And since segmented stacks are already used in other parts of the compiler I thought that using them was common practice.
With "disk full" the developer knows what to do: free some space or procure a larger disk. With stack overflows in large projects and generated code they likely do not even know where to look. Alternatively we could implement configurable recursion limits with conservative defaults for the parser just like clang. Then the developer gets at least told where the problem is. |
Let me add my .02 here. @petrochenkov is right in saying that
But there are two separate issues being reported:
IMO, something needs to be done about (at least) turning the segmentation fault into some other response (e.g. avoidance via automatic stack expansion or an abort with a "stack overflow" message ideally followed with a suggestion on how to overcome this). |
parse_assoc_expr_with()
appears to be the best place forensure_sufficient_stack()
.This could be performance-sensitive, so a perf run is required.
Fixes #79766, #93704