Files
rust/compiler
Nicholas Nethercote 2d91c6d1bf Remove DiagnosticBuilderState.
Currently it's used for two dynamic checks:
- When a diagnostic is emitted, has it been emitted before?
- When a diagnostic is dropped, has it been emitted/cancelled?

The first check is no longer need, because `emit` is consuming, so it's
impossible to emit a `DiagnosticBuilder` twice. The second check is
still needed.

This commit replaces `DiagnosticBuilderState` with a simpler
`Option<Box<Diagnostic>>`, which is enough for the second check:
functions like `emit` and `cancel` can take the `Diagnostic` and then
`drop` can check that the `Diagnostic` was taken.

The `DiagCtxt` reference from `DiagnosticBuilderState` is now stored as
its own field, removing the need for the `dcx` method.

As well as making the code shorter and simpler, the commit removes:
- One (deprecated) `ErrorGuaranteed::unchecked_claim_error_was_emitted`
  call.
- Two `FIXME(eddyb)` comments that are no longer relevant.
- The use of a dummy `Diagnostic` in `into_diagnostic`.

Nice!
2024-01-08 16:18:54 +11:00
..
2023-10-30 08:46:02 +11:00
2023-12-05 17:52:51 -08:00
2024-01-05 10:56:59 +00:00
2023-11-15 19:41:28 -05:00
2023-11-15 19:41:28 -05:00
2023-11-26 08:38:02 +11:00
2023-11-23 14:11:02 +03:00
2024-01-05 10:56:59 +00:00
2024-01-05 10:56:59 +00:00
2023-11-22 08:13:21 +11:00
2023-12-31 20:58:36 +00:00
2023-12-28 16:35:01 +00:00