rust/compiler
bors 9062b780b3 Auto merge of #101558 - JhonnyBillM:session-diagnostic-to-diagnostic-handler-refactor, r=davidtwco
Move and rename `SessionDiagnostic` & `SessionSubdiagnostic` traits and macros

After PR #101434, we want to:
- [x] Move `SessionDiagnostic` to `rustc_errors`.
- [x] Add `emit_` methods that accept `impl SessionDiagnostic` to `Handler`.
- [x] _(optional)_ Rename trait `SessionDiagnostic` to `DiagnosticHandler`.
- [x] _(optional)_ Rename macro `SessionDiagnostic` to `DiagnosticHandler`.
- [x] Update Rustc Dev Guide and Docs to reflect these changes. https://github.com/rust-lang/rustc-dev-guide/pull/1460

Now I am having build issues getting the compiler to build when trying to rename the macro.

<details>
  <summary>See diagnostics errors and context when building.</summary>

```
error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
  --> compiler/rustc_attr/src/session_diagnostics.rs:13:10
   |
13 |   #[derive(DiagnosticHandler)]
   |            ^^^^^^^^^^^^^^^^^ in this derive macro expansion
   |
  ::: /Users/jhonny/.cargo/registry/src/github.com-1ecc6299db9ec823/synstructure-0.12.6/src/macros.rs:94:9
   |
94 | /         pub fn $derives(
95 | |             i: $crate::macros::TokenStream
96 | |         ) -> $crate::macros::TokenStream {
   | |________________________________________- in this expansion of `#[derive(DiagnosticHandler)]`
   |
note: the lint level is defined here
  --> compiler/rustc_attr/src/lib.rs:10:9
   |
10 | #![deny(rustc::diagnostic_outside_of_impl)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

And also this one:

```
error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
   --> compiler/rustc_attr/src/session_diagnostics.rs:213:32
    |
213 |         let mut diag = handler.struct_span_err_with_code(
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^
```

> **Note**
> Can't find where this message is coming from, because you can see in [this experimental branch](https://github.com/JhonnyBillM/rust/tree/experimental/trying-to-rename-session-diagnostic-macro)  that I updated all errors and diags to say:
> error: diagnostics should only be created in **`DiagnosticHandler`**/`AddSubdiagnostic` impls
> and not:
> error: diagnostics should only be created in **`SessionDiagnostic`**/`AddSubdiagnostic` impls

</details>

I tried building the compiler in different ways (playing with the stages etc), but nothing worked.

## Question

**Do we need to build or do something different when renaming a macro and identifiers?**

For context, see experimental commit f2193a98b4 where the macro and symbols are renamed, but it doesn't compile.
2022-09-21 19:58:39 +00:00
..
rustc
rustc_apfloat
rustc_arena
rustc_ast Rollup merge of #93628 - est31:stabilize_let_else, r=joshtriplett 2022-09-17 15:31:06 +05:30
rustc_ast_lowering FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_ast_passes UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic 2022-09-21 11:39:53 -04:00
rustc_ast_pretty make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
rustc_attr FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_borrowck UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic 2022-09-21 11:39:53 -04:00
rustc_builtin_macros UPDATE - rename DiagnosticHandler macro to Diagnostic 2022-09-21 11:39:53 -04:00
rustc_codegen_cranelift Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank 2022-09-20 12:09:52 +00:00
rustc_codegen_gcc Remove dead broken code from const zst handling in backends 2022-09-06 14:09:49 +00:00
rustc_codegen_llvm Use LLVM C-API to build atomic cmpxchg and fence 2022-09-18 16:01:57 -07:00
rustc_codegen_ssa Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank 2022-09-20 12:09:52 +00:00
rustc_const_eval UPDATE - rename DiagnosticHandler macro to Diagnostic 2022-09-21 11:39:53 -04:00
rustc_data_structures Only enable the let_else feature on bootstrap 2022-09-15 21:06:45 +02:00
rustc_driver UPDATE - rename DiagnosticHandler macro to Diagnostic 2022-09-21 11:39:53 -04:00
rustc_error_codes
rustc_error_messages UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic 2022-09-21 11:39:53 -04:00
rustc_errors FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_expand FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_feature Rollup merge of #101713 - Bryanskiy:AccessLevels, r=petrochenkov 2022-09-17 23:30:49 +02:00
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #93628 - est31:stabilize_let_else, r=joshtriplett 2022-09-17 15:31:06 +05:30
rustc_hir_pretty Handle generic parameters. 2022-09-09 01:31:46 +00:00
rustc_incremental Only enable the let_else feature on bootstrap 2022-09-15 21:06:45 +02:00
rustc_index Only enable the let_else feature on bootstrap 2022-09-15 21:06:45 +02:00
rustc_infer Auto merge of #101558 - JhonnyBillM:session-diagnostic-to-diagnostic-handler-refactor, r=davidtwco 2022-09-21 19:58:39 +00:00
rustc_interface UPDATE - rename DiagnosticHandler macro to Diagnostic 2022-09-21 11:39:53 -04:00
rustc_lexer remove unnecessary PartialOrd and Ord 2022-09-08 06:15:33 +09:00
rustc_lint FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_lint_defs Compute lint_levels by definition 2022-09-14 19:02:44 +02:00
rustc_llvm Use LLVM C-API to build atomic cmpxchg and fence 2022-09-18 16:01:57 -07:00
rustc_log
rustc_macros FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_metadata Auto merge of #101558 - JhonnyBillM:session-diagnostic-to-diagnostic-handler-refactor, r=davidtwco 2022-09-21 19:58:39 +00:00
rustc_middle FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_mir_build Rollup merge of #102021 - lcnr:tyConst-fun, r=b-naber,BoxyUwU 2022-09-20 10:13:01 -07:00
rustc_mir_dataflow UPDATE - rename DiagnosticHandler macro to Diagnostic 2022-09-21 11:39:53 -04:00
rustc_mir_transform Rollup merge of #102045 - RalfJung:const-prop-regression-fix, r=oli-obk 2022-09-21 19:01:08 +05:30
rustc_monomorphize FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_parse FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_parse_format
rustc_passes FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_plugin_impl UPDATE - rename DiagnosticHandler macro to Diagnostic 2022-09-21 11:39:53 -04:00
rustc_privacy UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic 2022-09-21 11:39:53 -04:00
rustc_query_impl Rollup merge of #101801 - SparrowLii:query_depth_note, r=estebank 2022-09-17 19:27:06 +02:00
rustc_query_system FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_resolve Rollup merge of #101713 - Bryanskiy:AccessLevels, r=petrochenkov 2022-09-17 23:30:49 +02:00
rustc_save_analysis UPDATE - rename DiagnosticHandler macro to Diagnostic 2022-09-21 11:39:53 -04:00
rustc_serialize Rollup merge of #101014 - isikkema:fix-zmeta-stats-file-encoder-no-read-perms, r=isikkema 2022-09-20 10:12:57 -07:00
rustc_session FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_smir Only keep one version of ImplicitSelfKind. 2022-09-13 19:18:23 +02:00
rustc_span FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_symbol_mangling UPDATE - rename DiagnosticHandler trait to IntoDiagnostic 2022-09-21 11:39:52 -04:00
rustc_target Auto merge of #101329 - QuinnPainter:armv5te-targets, r=nagisa 2022-09-21 09:36:21 +00:00
rustc_trait_selection FIX - adopt new Diagnostic naming in newly migrated modules 2022-09-21 11:43:22 -04:00
rustc_traits remove the Subst trait, always use EarlyBinder 2022-09-19 11:37:27 +02:00
rustc_transmute Auto merge of #100726 - jswrenn:transmute, r=oli-obk 2022-09-04 07:55:44 +00:00
rustc_ty_utils UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic 2022-09-21 11:39:53 -04:00
rustc_type_ir Address code review comments 2022-09-13 14:50:12 -07:00
rustc_typeck UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic 2022-09-21 11:39:53 -04:00