rust/compiler/rustc_parse
Nicholas Nethercote c733a0216d Remove a fourth DiagnosticBuilder::emit_without_consuming call.
The old code was very hard to understand, involving an
`emit_without_consuming` call *and* a `delay_as_bug_without_consuming`
call.

With slight changes both calls can be avoided. Not creating the error
until later is crucial, as is the early return in the `if recovered`
block.

It took me some time to come up with this reworking -- it went through
intermediate states much further from the original code than this final
version -- and it's isn't obvious at a glance that it is equivalent. But
I think it is, and the unchanged test behaviour is good supporting
evidence.

The commit also changes `check_trailing_angle_brackets` to return
`Option<ErrorGuaranteed>`. This provides a stricter proof that it
emitted an error message than asserting `dcx.has_errors().is_some()`,
which would succeed if any error had previously been emitted anywhere.
2024-01-08 16:04:50 +11:00
..
src Remove a fourth DiagnosticBuilder::emit_without_consuming call. 2024-01-08 16:04:50 +11:00
Cargo.toml Update to bitflags 2 in the compiler 2023-12-30 18:17:28 +01:00
messages.ftl Auto merge of #119569 - matthiaskrgr:rollup-4packja, r=matthiaskrgr 2024-01-04 21:44:14 +00:00