Skip to content

Fix parser stack overflow#22513

Open
sunny026 wants to merge 2 commits into
rust-lang:masterfrom
sunny026:fix-parser-stack-overflow
Open

Fix parser stack overflow#22513
sunny026 wants to merge 2 commits into
rust-lang:masterfrom
sunny026:fix-parser-stack-overflow

Conversation

@sunny026

@sunny026 sunny026 commented Jun 2, 2026

Copy link
Copy Markdown

No description provided.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 2, 2026
r: Restrictions,
bp: u8,
) -> Option<(CompletedMarker, BlockLike)> {
if !p.check_recursion_limit() {

@ChayimFriedman2 ChayimFriedman2 Jun 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is, of course, not enough. Many functions in the parser recurse.

I'm not yet sure whether we want such thing, though.

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we want to fix this we should do what rustc does which is growing the stack on demand

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And there are also plenty of places besides parsing that will need that (although parsing is the most important).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea hir-def lowering does as well at the very least

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Wait, did you even check that it is parsing that stack overflows on this code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants