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

Recover gracefully from struct parse errors #75513

Merged
merged 1 commit into from
Aug 15, 2020

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Aug 14, 2020

Currently the parser tries to recover from finding a keyword where a field name was expected, but this causes extra knock down parse errors that are completely irrelevant. Instead, bail out early in the parsing of the field and consume the remaining tokens in the block. This can reduce output significantly.

Improvements based on the narrative in https://fasterthanli.me/articles/i-am-a-java-csharp-c-or-cplusplus-dev-time-to-do-some-rust

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 14, 2020
@estebank estebank changed the title Recover gracefully from struct parse errors Recover gracefully from struct parse errors Aug 14, 2020
@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Aug 14, 2020

📌 Commit 2e9b45e has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 14, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 15, 2020
Rollup of 4 pull requests

Successful merges:

 - rust-lang#75376 (Set CMAKE_SYSTEM_NAME when cross-compiling)
 - rust-lang#75448 (merge `as_local_hir_id` with `local_def_id_to_hir_id`)
 - rust-lang#75513 (Recover gracefully from `struct` parse errors)
 - rust-lang#75545 (std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.)

Failed merges:

 - rust-lang#75514 (Replaced `log` with `tracing`)

r? @ghost
@bors bors merged commit e38eaf2 into rust-lang:master Aug 15, 2020
@estebank estebank deleted the confused-parser branch November 9, 2023 05:16
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants