rust/compiler/rustc_macros/src
Dylan DPC df1f415305
Rollup merge of #98884 - davidtwco:translation-on-lints-derive, r=oli-obk
macros: `LintDiagnostic` derive

- Move `LintDiagnosticBuilder` into `rustc_errors` so that a diagnostic derive can refer to it.
- Introduce a `DecorateLint` trait, which is equivalent to `SessionDiagnostic` or `AddToDiagnostic` but for lints. Necessary without making more changes to the lint infrastructure as `DecorateLint` takes a `LintDiagnosticBuilder` and re-uses all of the existing logic for determining what type of diagnostic a lint should be emitted as (e.g. error/warning).
- Various refactorings of the diagnostic derive machinery (extracting `build_field_mapping` helper and moving `sess` field out of the `DiagnosticDeriveBuilder`).
- Introduce a `LintDiagnostic` derive macro that works almost exactly like the `SessionDiagnostic` derive macro  except that it derives a `DecorateLint` implementation instead. A new derive is necessary for this because `SessionDiagnostic` is intended for when the generated code creates the diagnostic. `AddToDiagnostic` could have been used but it would have required more changes to the lint machinery.

~~At time of opening this pull request, ignore all of the commits from #98624, it's just the last few commits that are new.~~

r? `@oli-obk`
2022-07-06 14:49:10 +05:30
..
diagnostics macros: add diagnostic derive for lints 2022-07-05 16:00:21 +01:00
symbols Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
hash_stable.rs more clippy fixes 2021-11-07 16:59:05 +01:00
lib.rs Rollup merge of #98884 - davidtwco:translation-on-lints-derive, r=oli-obk 2022-07-06 14:49:10 +05:30
lift.rs Lift: take self by value 2020-10-21 23:59:35 +02:00
newtype.rs Use delayed error handling for Encodable and Encoder infallible. 2022-06-08 07:01:26 +10:00
query.rs Move ty::print methods to Drop-based scope guards 2022-02-16 17:24:23 -05:00
serialize.rs Use delayed error handling for Encodable and Encoder infallible. 2022-06-08 07:01:26 +10:00
symbols.rs Use a separate interner type for UniqueTypeId 2021-09-13 14:42:06 +02:00
type_foldable.rs Add #[derive(TypeVisitable)] 2022-07-05 22:25:15 +01:00
type_visitable.rs Add #[derive(TypeVisitable)] 2022-07-05 22:25:15 +01:00