Files
rust/compiler
Jonathan Brouwer e525e00bf1 Rollup merge of #162591 - fmease:out-of-line-recovery, r=petrochenkov
Move parse error recovery for expression operators "out of line" & refactor in the area

**Background**: While we do have 3k-line module `rustc_parse/src/parser/diagnostics.rs`[^1] dedicated to syntax error diagnostics & parse error recovery, the rest of the parser is still "littered" or "interwoven" through and through with complex or verbose diagnostic code. We support numerous recoveries from syntaxes found in other languages right next to code that actually decides what is and what isn't part of Rust syntactically. This makes the parser code very messy, illegible, bug prone and otherwise hard to maintain.

So my long-term plan is to push all this diagnostic & recovery code "out of line", namely into new `rustc_parse/src/parser/$fragment/diagnostics.rs` files, to keep the "inline code" of parsing routines in `$fragment.rs` focused on actually parsing Rust code.

Why not just use the pre-existing `parser/diagnostics.rs` module? Well, making diagnostic code for expressions, patterns, types etc. share the same module is the definition of a hodgepodge. Moreover, moving all diagnostic code there would make the file way too large. Of course, for common code (if any) `parser/diagnostics.rs` would remain suitable.

Best reviewed commit by commit.

Commit [Refactor check_assoc_op to make it more legible](66311aa499) was cherry-picked from my PR rust-lang/rust#161775.

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>

[^1]: Not to be confused with `rustc_parse/src/diagnostics.rs` which holds diagnostic structs.
2026-09-19 08:45:32 +02:00
..
2026-09-17 11:33:58 +02:00
2026-09-18 16:29:52 +02:00
2026-09-17 06:52:28 +02:00
2026-09-17 06:52:28 +02:00