Skip to content
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

fix: fix "parser seems stuck" panic when parsing colossal files #13794

Merged
merged 1 commit into from
Dec 19, 2022
Merged

fix: fix "parser seems stuck" panic when parsing colossal files #13794

merged 1 commit into from
Dec 19, 2022

Conversation

jonas-schievink
Copy link
Contributor

The parser step count is incremented every time the parser inspects a token. It's purpose is to ensure the parser doesn't get stuck in infinite loops. But since self.pos grows monotonically when parsing source code, it gives a better idea for whether the parser is stuck or not: if self.pos is changed, we know that the parser cannot be stuck, so it is safe to reset the step count to 0. This makes the limit check scale with the size of the file, and so should fix #13788.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 19, 2022
@jonas-schievink
Copy link
Contributor Author

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 19, 2022

📌 Commit c110481 has been approved by jonas-schievink

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Dec 19, 2022

⌛ Testing commit c110481 with merge 9ae0b0c...

bors added a commit that referenced this pull request Dec 19, 2022
…=jonas-schievink

fix: fix "parser seems stuck" panic when parsing colossal files

The parser step count is incremented every time the parser inspects a token. It's purpose is to ensure the parser doesn't get stuck in infinite loops. But since `self.pos` grows monotonically when parsing source code, it gives a better idea for whether the parser is stuck or not: if `self.pos` is changed, we know that the parser cannot be stuck, so it is safe to reset the step count to 0. This makes the limit check scale with the size of the file, and so should fix #13788.
@bors
Copy link
Collaborator

bors commented Dec 19, 2022

💔 Test failed - checks-actions

@jonas-schievink
Copy link
Contributor Author

@bors retry

@bors
Copy link
Collaborator

bors commented Dec 19, 2022

⌛ Testing commit c110481 with merge 1f74b1b...

@bors
Copy link
Collaborator

bors commented Dec 19, 2022

☀️ Test successful - checks-actions
Approved by: jonas-schievink
Pushing 1f74b1b to master...

@bors bors merged commit 1f74b1b into rust-lang:master Dec 19, 2022
@jonas-schievink jonas-schievink deleted the reset-step-limit-after-bump branch December 19, 2022 16:25
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.

Parser gets stuck after trying to parse auto-generated file
3 participants