rust/compiler/rustc_builtin_macros/src
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
..
assert Desugar for await loops 2023-12-19 12:26:27 -08:00
deriving Add #[derive(Clone, Copy)] to anonymous adts 2024-02-12 12:47:32 +08:00
format_foreign Use as_deref in compiler (but only where it makes sense) 2022-11-16 21:58:58 +00:00
alloc_error_handler.rs Remove ExtCtxt methods that duplicate DiagCtxt methods. 2023-12-24 07:24:52 +11:00
asm.rs Rename consuming chaining methods on DiagnosticBuilder. 2024-01-10 07:40:00 +11:00
assert.rs Make DiagnosticBuilder::emit consuming. 2024-01-08 15:24:49 +11:00
cfg_accessible.rs Remove ExtCtxt methods that duplicate DiagCtxt methods. 2023-12-24 07:24:52 +11:00
cfg_eval.rs Make DiagnosticBuilder::emit consuming. 2024-01-08 15:24:49 +11:00
cfg.rs Add check for ui_testing via promoting parameters from ParseSess to Session 2024-01-13 12:11:13 -05:00
cmdline_attrs.rs Make DiagnosticBuilder::emit consuming. 2024-01-08 15:24:49 +11:00
compile_error.rs Remove ExtCtxt methods that duplicate DiagCtxt methods. 2023-12-24 07:24:52 +11:00
concat_bytes.rs Add ErrorGuaranteed to ast::LitKind::Err, token::LitKind::Err. 2024-02-15 14:46:08 +11:00
concat_idents.rs Remove ExtCtxt methods that duplicate DiagCtxt methods. 2023-12-24 07:24:52 +11:00
concat.rs Add ErrorGuaranteed to ast::LitKind::Err, token::LitKind::Err. 2024-02-15 14:46:08 +11:00
derive.rs Remove Session methods that duplicate DiagCtxt methods. 2023-12-24 08:05:28 +11:00
edition_panic.rs Remove MacDelimiter. 2023-08-03 09:03:30 +10:00
env.rs Rename --env option flag to --env-set 2024-01-12 11:02:57 +01:00
errors.rs Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
format_foreign.rs unwrap return Option value, as it always returns Some for some fns 2023-11-28 14:52:21 +03:00
format.rs Remove has_errors check in builtin macro parsing 2024-01-25 17:12:09 +00:00
global_allocator.rs Remove ExtCtxt methods that duplicate DiagCtxt methods. 2023-12-24 07:24:52 +11:00
lib.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
log_syntax.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
proc_macro_harness.rs Rename consuming chaining methods on DiagnosticBuilder. 2024-01-10 07:40:00 +11:00
source_util.rs Add check for ui_testing via promoting parameters from ParseSess to Session 2024-01-13 12:11:13 -05:00
standard_library_imports.rs rustc: Move features from Session to GlobalCtxt 2023-08-11 16:51:50 +08:00
test_harness.rs Rename many DiagCtxt and EarlyDiagCtxt locals. 2023-12-18 16:06:22 +11:00
test.rs Add #[coverage(off)] to closures introduced by #[test]/#[bench] 2024-01-21 23:17:00 +11:00
trace_macros.rs Remove ExtCtxt methods that duplicate DiagCtxt methods. 2023-12-24 07:24:52 +11:00
type_ascribe.rs Make DiagnosticBuilder::emit consuming. 2024-01-08 15:24:49 +11:00
util.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00