rust/compiler/rustc_errors/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
..
json Rename many DiagCtxt and EarlyDiagCtxt locals. 2023-12-18 16:06:22 +11:00
markdown apply fmt 2024-01-11 15:04:48 +03:00
annotate_snippet_emitter_writer.rs Rework how diagnostic lints are stored. 2024-01-14 14:04:25 +11:00
diagnostic_builder.rs Rework how diagnostic lints are stored. 2024-01-14 14:04:25 +11:00
diagnostic_impls.rs Rename consuming chaining methods on DiagnosticBuilder. 2024-01-10 07:40:00 +11:00
diagnostic.rs Rework how diagnostic lints are stored. 2024-01-14 14:04:25 +11:00
emitter.rs Rework how diagnostic lints are stored. 2024-01-14 14:04:25 +11:00
error.rs Make translate_message return result and add tests 2023-01-08 23:35:43 +01:00
json.rs Rework how diagnostic lints are stored. 2024-01-14 14:04:25 +11:00
lib.rs Rework how diagnostic lints are stored. 2024-01-14 14:04:25 +11:00
lock.rs bump windows crate 0.46 -> 0.48 in workspace 2023-05-09 18:20:13 +03:00
registry.rs refactor: statically guarantee that current error codes are documented 2023-02-26 20:12:36 +13:00
snippet.rs Create AnnotationColumn struct to fix hard tab column numbers in errors 2023-03-28 09:18:55 -04:00
styled_buffer.rs Replace some _ == _ || _ == _s with matches!(_, _ | _)s 2023-01-30 12:26:26 +00:00
tests.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
translation.rs Restore behavior when primary bundle is missing 2023-02-23 01:14:10 +01:00