rust/compiler/rustc_macros/src
Nicholas Nethercote d71f535a6f Rework how diagnostic lints are stored.
`Diagnostic::code` has the type `DiagnosticId`, which has `Error` and
`Lint` variants. Plus `Diagnostic::is_lint` is a bool, which should be
redundant w.r.t. `Diagnostic::code`.

Seems simple. Except it's possible for a lint to have an error code, in
which case its `code` field is recorded as `Error`, and `is_lint` is
required to indicate that it's a lint. This is what happens with
`derive(LintDiagnostic)` lints. Which means those lints don't have a
lint name or a `has_future_breakage` field because those are stored in
the `DiagnosticId::Lint`.

It's all a bit messy and confused and seems unintentional.

This commit:
- removes `DiagnosticId`;
- changes `Diagnostic::code` to `Option<String>`, which means both
  errors and lints can straightforwardly have an error code;
- changes `Diagnostic::is_lint` to `Option<IsLint>`, where `IsLint` is a
  new type containing a lint name and a `has_future_breakage` bool, so
  all lints can have those, error code or not.
2024-01-14 14:04:25 +11:00
..
diagnostics Rework how diagnostic lints are stored. 2024-01-14 14:04:25 +11:00
symbols Fix symbols::tests::test_symbols 2023-10-26 02:02:22 -07:00
current_version.rs Simplify the current_rustc_version macro. 2023-11-10 10:54:21 +11:00
hash_stable.rs remove redundant imports 2023-12-10 10:56:22 +08:00
lib.rs Avoid specialization for the Span Encodable and Decodable impls 2023-12-31 20:42:17 +00:00
lift.rs remove redundant imports 2023-12-10 10:56:22 +08:00
query.rs Stash and cancel cycle errors for auto trait leakage in opaques 2023-10-26 17:58:02 +00:00
serialize.rs u8 tags for smaller enums 2024-01-09 20:08:44 -05:00
symbols.rs Re-format code with new rustfmt 2023-11-15 21:45:48 -05:00
type_foldable.rs migrate rustc_macros to syn 2.0 2023-04-06 04:55:58 +00:00
type_visitable.rs migrate rustc_macros to syn 2.0 2023-04-06 04:55:58 +00:00