diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-19 08:27:37 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-19 09:05:23 +1100 |
| commit | 31df50c8973aeb70fcf42b403239f4fc4712988c (patch) | |
| tree | a3d4ef0880844ebac6fdfac02bf83b047a6525e9 /compiler/rustc_builtin_macros/src/errors.rs | |
| parent | 18251c480b37c96db2d93ce79c138754d4e28904 (diff) | |
| download | rust-31df50c8973aeb70fcf42b403239f4fc4712988c.tar.gz rust-31df50c8973aeb70fcf42b403239f4fc4712988c.zip | |
Streamline `Diagnostic` proc macro.
First, it is parameterized by the name of the diagnostic and the DiagCtxt. These are given to `session_diagnostic_derive` and `lint_diagnostic_derive`. But the names are hard-wired as "diag" and "handler" (should be "dcx"), and there's no clear reason for the parameterization. So this commit removes the parameterization and hard-wires the names internally. Once that is done `DiagnosticDeriveBuilder` is reduced to a trivial wrapper around `DiagnosticDeriveKind`, and can be removed. Also, `DiagnosticDerive` and `LintDiagnosticDerive` don't need the `builder` field, because it has been reduced to a kind, and they know their own kind. This avoids the need for some `let`/`else`/`unreachable!` kind checks And `DiagnosticDeriveVariantBuilder` no longer needs a lifetime, because the `parent` field is changed to `kind`, which is now a trivial copy type.
Diffstat (limited to 'compiler/rustc_builtin_macros/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
