Skip to content

Recover gracefully from struct parse errors - #75513

Merged
bors merged 1 commit into
rust-lang:masterfrom
estebank:confused-parser
Aug 15, 2020
Merged

Recover gracefully from struct parse errors#75513
bors merged 1 commit into
rust-lang:masterfrom
estebank:confused-parser

Conversation

@estebank

@estebankestebank commented Aug 14, 2020

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

r? @davidtwco

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

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 14, 2020
@estebankestebank changed the title Recover gracefully from struct parse errorsRecover gracefully from struct parse errorsAug 14, 2020
@davidtwco

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Aug 14, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 2e9b45e has been approved by davidtwco

@borsbors 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
@tmandrytmandry mentioned this pull request Aug 15, 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:masterAug 15, 2020
@estebank
estebank deleted the confused-parser branch November 9, 2023 05:16
@cuvipercuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: 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

@estebank@rust-highfive@davidtwco@bors@cuviper