rust/compiler
Nicholas Nethercote f6f8779843 Reduce capabilities of Diagnostic.
Currently many diagnostic modifier methods are available on both
`Diagnostic` and `DiagnosticBuilder`. This commit removes most of them
from `Diagnostic`. To minimize the diff size, it keeps them within
`diagnostic.rs` but changes the surrounding `impl Diagnostic` block to
`impl DiagnosticBuilder`. (I intend to move things around later, to give
a more sensible code layout.)

`Diagnostic` keeps a few methods that it still needs, like `sub`,
`arg`, and `replace_args`.

The `forward!` macro, which defined two additional methods per call
(e.g. `note` and `with_note`), is replaced by the `with_fn!` macro,
which defines one additional method per call (e.g. `with_note`). It's
now also only used when necessary -- not all modifier methods currently
need a `with_*` form. (New ones can be easily added as necessary.)

All this also requires changing `trait AddToDiagnostic` so its methods
take `DiagnosticBuilder` instead of `Diagnostic`, which leads to many
mechanical changes. `SubdiagnosticMessageOp` gains a type parameter `G`.

There are three subdiagnostics -- `DelayedAtWithoutNewline`,
`DelayedAtWithNewline`, and `InvalidFlushedDelayedDiagnosticLevel` --
that are created within the diagnostics machinery and appended to
external diagnostics. These are handled at the `Diagnostic` level, which
means it's now hard to construct them via `derive(Diagnostic)`, so
instead we construct them by hand. This has no effect on what they look
like when printed.

There are lots of new `allow` markers for `untranslatable_diagnostics`
and `diagnostics_outside_of_impl`. This is because
`#[rustc_lint_diagnostics]` annotations were present on the `Diagnostic`
modifier methods, but missing from the `DiagnosticBuilder` modifier
methods. They're now present.
2024-02-20 13:22:17 +11:00
..
rustc
rustc_abi Fix rustc_abi build on stable 2024-01-16 21:15:31 +01:00
rustc_arena Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_ast Rollup merge of #121109 - nnethercote:TyKind-Err-guar-2, r=oli-obk 2024-02-16 00:27:32 +01:00
rustc_ast_lowering Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_ast_passes Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_ast_pretty Rollup merge of #121109 - nnethercote:TyKind-Err-guar-2, r=oli-obk 2024-02-16 00:27:32 +01:00
rustc_attr Use generic NonZero internally. 2024-02-15 08:09:42 +01:00
rustc_baked_icu_data
rustc_borrowck Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_builtin_macros Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_codegen_cranelift Auto merge of #121034 - obeis:improve-static-mut-ref, r=RalfJung 2024-02-18 08:00:34 +00:00
rustc_codegen_gcc Auto merge of #121034 - obeis:improve-static-mut-ref, r=RalfJung 2024-02-18 08:00:34 +00:00
rustc_codegen_llvm Rollup merge of #121209 - nnethercote:infallible-join_codegen, r=bjorn3 2024-02-17 18:47:42 +01:00
rustc_codegen_ssa Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_const_eval Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_data_structures By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking. 2024-02-18 16:38:11 +08:00
rustc_driver
rustc_driver_impl Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwco 2024-02-09 14:41:50 +01:00
rustc_error_codes Improve wording of static_mut_ref 2024-02-18 06:01:40 +03:00
rustc_error_messages errors: only eagerly translate subdiagnostics 2024-02-15 10:34:41 +00:00
rustc_errors Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_expand Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_feature Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
rustc_fluent_macro Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_fs_util Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_graphviz Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_hir Add more checks for unnamed_field during HIR analysis 2024-02-17 15:12:33 +00:00
rustc_hir_analysis Prefer DiagnosticBuilder over Diagnostic in diagnostic modifiers. 2024-02-19 20:23:20 +11:00
rustc_hir_pretty Lower anonymous structs or unions to HIR 2024-02-12 12:47:23 +08:00
rustc_hir_typeck Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_incremental Use better heuristic for printing Cargo specific diagnostics 2024-02-17 16:49:01 +01:00
rustc_index Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_index_macros Step all bootstrap cfgs forward 2024-02-08 07:44:34 -05:00
rustc_infer Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_interface Rollup merge of #121209 - nnethercote:infallible-join_codegen, r=bjorn3 2024-02-17 18:47:42 +01:00
rustc_lexer Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_lint Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_lint_defs Improve wording of static_mut_ref 2024-02-18 06:01:40 +03:00
rustc_llvm Pin cc version 2024-02-13 21:13:06 +00:00
rustc_log Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_macros Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_metadata Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_middle Prefer DiagnosticBuilder over Diagnostic in diagnostic modifiers. 2024-02-19 20:23:20 +11:00
rustc_mir_build Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_mir_dataflow Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
rustc_mir_transform Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_monomorphize Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_next_trait_solver Move visitable bounds up into interner 2024-02-13 15:53:15 +00:00
rustc_parse Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_parse_format remove a couple of redundant clones 2024-02-17 12:46:18 +01:00
rustc_passes Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_pattern_analysis Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_privacy Dejargnonize subst 2024-02-12 15:46:35 +09:00
rustc_query_impl Replace NonZero::<_>::new with NonZero::new. 2024-02-15 08:09:42 +01:00
rustc_query_system Use generic NonZero internally. 2024-02-15 08:09:42 +01:00
rustc_resolve Prefer DiagnosticBuilder over Diagnostic in diagnostic modifiers. 2024-02-19 20:23:20 +11:00
rustc_serialize Replace NonZero::<_>::new with NonZero::new. 2024-02-15 08:09:42 +01:00
rustc_session Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_smir Rollup merge of #120982 - momvart:smir-61-foreign_kind, r=oli-obk 2024-02-15 09:20:18 +01:00
rustc_span By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking. 2024-02-18 16:38:11 +08:00
rustc_symbol_mangling Rollup merge of #120958 - ShoyuVanilla:remove-subst, r=oli-obk 2024-02-12 23:18:54 +01:00
rustc_target Rollup merge of #121210 - madsmtm:fix-target-abi-i386-apple-ios, r=workingjubilee 2024-02-17 18:47:42 +01:00
rustc_trait_selection Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
rustc_traits Dejargnonize subst 2024-02-12 15:46:35 +09:00
rustc_transmute Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_ty_utils Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
rustc_type_ir Move visitable bounds up into interner 2024-02-13 15:53:15 +00:00
stable_mir Rollup merge of #120982 - momvart:smir-61-foreign_kind, r=oli-obk 2024-02-15 09:20:18 +01:00