about summary refs log tree commit diff
path: root/compiler/rustc_macros/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_macros/src')
-rw-r--r--compiler/rustc_macros/src/diagnostics/diagnostic.rs22
-rw-r--r--compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs6
-rw-r--r--compiler/rustc_macros/src/diagnostics/mod.rs8
-rw-r--r--compiler/rustc_macros/src/lib.rs2
4 files changed, 19 insertions, 19 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic.rs b/compiler/rustc_macros/src/diagnostics/diagnostic.rs
index 891b6a118de..c5b5edab816 100644
--- a/compiler/rustc_macros/src/diagnostics/diagnostic.rs
+++ b/compiler/rustc_macros/src/diagnostics/diagnostic.rs
@@ -11,27 +11,27 @@ use synstructure::Structure;
 /// The central struct for constructing the `into_diagnostic` method from an annotated struct.
 pub(crate) struct SessionDiagnosticDerive<'a> {
     structure: Structure<'a>,
-    sess: syn::Ident,
+    handler: syn::Ident,
     builder: DiagnosticDeriveBuilder,
 }
 
 impl<'a> SessionDiagnosticDerive<'a> {
-    pub(crate) fn new(diag: syn::Ident, sess: syn::Ident, structure: Structure<'a>) -> Self {
+    pub(crate) fn new(diag: syn::Ident, handler: syn::Ident, structure: Structure<'a>) -> Self {
         Self {
             builder: DiagnosticDeriveBuilder {
                 diag,
                 fields: build_field_mapping(&structure),
-                kind: DiagnosticDeriveKind::SessionDiagnostic,
+                kind: DiagnosticDeriveKind::DiagnosticHandler,
                 code: None,
                 slug: None,
             },
-            sess,
+            handler,
             structure,
         }
     }
 
     pub(crate) fn into_tokens(self) -> TokenStream {
-        let SessionDiagnosticDerive { mut structure, sess, mut builder } = self;
+        let SessionDiagnosticDerive { mut structure, handler, mut builder } = self;
 
         let ast = structure.ast();
         let implementation = {
@@ -53,7 +53,7 @@ impl<'a> SessionDiagnosticDerive<'a> {
                     }
                     Some(slug) => {
                         quote! {
-                            let mut #diag = #sess.struct_diagnostic(rustc_errors::fluent::#slug);
+                            let mut #diag = #handler.struct_diagnostic(rustc_errors::fluent::#slug);
                         }
                     }
                 };
@@ -72,7 +72,7 @@ impl<'a> SessionDiagnosticDerive<'a> {
             } else {
                 span_err(
                     ast.span().unwrap(),
-                    "`#[derive(SessionDiagnostic)]` can only be used on structs",
+                    "`#[derive(DiagnosticHandler)]` can only be used on structs",
                 )
                 .emit();
 
@@ -81,15 +81,15 @@ impl<'a> SessionDiagnosticDerive<'a> {
         };
 
         structure.gen_impl(quote! {
-            gen impl<'__session_diagnostic_sess, G>
-                    rustc_errors::SessionDiagnostic<'__session_diagnostic_sess, G>
+            gen impl<'__diagnostic_handler_sess, G>
+                    rustc_errors::IntoDiagnostic<'__diagnostic_handler_sess, G>
                     for @Self
                 where G: rustc_errors::EmissionGuarantee
             {
                 fn into_diagnostic(
                     self,
-                    #sess: &'__session_diagnostic_sess rustc_errors::Handler
-                ) -> rustc_errors::DiagnosticBuilder<'__session_diagnostic_sess, G> {
+                    #handler: &'__diagnostic_handler_sess rustc_errors::Handler
+                ) -> rustc_errors::DiagnosticBuilder<'__diagnostic_handler_sess, G> {
                     use rustc_errors::IntoDiagnosticArg;
                     #implementation
                 }
diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs
index 2a4fe48a8ac..4af3fd23624 100644
--- a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs
+++ b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs
@@ -21,12 +21,12 @@ use synstructure::{BindingInfo, Structure};
 /// What kind of diagnostic is being derived - a fatal/error/warning or a lint?
 #[derive(Copy, Clone, PartialEq, Eq)]
 pub(crate) enum DiagnosticDeriveKind {
-    SessionDiagnostic,
+    DiagnosticHandler,
     LintDiagnostic,
 }
 
 /// Tracks persistent information required for building up individual calls to diagnostic methods
-/// for generated diagnostic derives - both `SessionDiagnostic` for fatal/errors/warnings and
+/// for generated diagnostic derives - both `DiagnosticHandler` for fatal/errors/warnings and
 /// `LintDiagnostic` for lints.
 pub(crate) struct DiagnosticDeriveBuilder {
     /// The identifier to use for the generated `DiagnosticBuilder` instance.
@@ -333,7 +333,7 @@ impl DiagnosticDeriveBuilder {
             }
             "primary_span" => {
                 match self.kind {
-                    DiagnosticDeriveKind::SessionDiagnostic => {
+                    DiagnosticDeriveKind::DiagnosticHandler => {
                         report_error_if_not_applied_to_span(attr, &info)?;
 
                         Ok(quote! {
diff --git a/compiler/rustc_macros/src/diagnostics/mod.rs b/compiler/rustc_macros/src/diagnostics/mod.rs
index 2ff21e18ff8..162089c881e 100644
--- a/compiler/rustc_macros/src/diagnostics/mod.rs
+++ b/compiler/rustc_macros/src/diagnostics/mod.rs
@@ -12,7 +12,7 @@ use quote::format_ident;
 use subdiagnostic::SessionSubdiagnosticDerive;
 use synstructure::Structure;
 
-/// Implements `#[derive(SessionDiagnostic)]`, which allows for errors to be specified as a struct,
+/// Implements `#[derive(DiagnosticHandler)]`, which allows for errors to be specified as a struct,
 /// independent from the actual diagnostics emitting code.
 ///
 /// ```ignore (rust)
@@ -22,7 +22,7 @@ use synstructure::Structure;
 /// # use rustc_span::{symbol::Ident, Span};
 /// # extern crate rust_middle;
 /// # use rustc_middle::ty::Ty;
-/// #[derive(SessionDiagnostic)]
+/// #[derive(DiagnosticHandler)]
 /// #[diag(borrowck::move_out_of_borrow, code = "E0505")]
 /// pub struct MoveOutOfBorrowError<'tcx> {
 ///     pub name: Ident,
@@ -56,10 +56,10 @@ use synstructure::Structure;
 /// });
 /// ```
 ///
-/// See rustc dev guide for more examples on using the `#[derive(SessionDiagnostic)]`:
+/// See rustc dev guide for more examples on using the `#[derive(DiagnosticHandler)]`:
 /// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html>
 pub fn session_diagnostic_derive(s: Structure<'_>) -> TokenStream {
-    SessionDiagnosticDerive::new(format_ident!("diag"), format_ident!("sess"), s).into_tokens()
+    SessionDiagnosticDerive::new(format_ident!("diag"), format_ident!("handler"), s).into_tokens()
 }
 
 /// Implements `#[derive(LintDiagnostic)]`, which allows for lints to be specified as a struct,
diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs
index 2c027d754da..13305782ff1 100644
--- a/compiler/rustc_macros/src/lib.rs
+++ b/compiler/rustc_macros/src/lib.rs
@@ -127,7 +127,7 @@ decl_derive!([TypeFoldable, attributes(type_foldable)] => type_foldable::type_fo
 decl_derive!([TypeVisitable, attributes(type_visitable)] => type_visitable::type_visitable_derive);
 decl_derive!([Lift, attributes(lift)] => lift::lift_derive);
 decl_derive!(
-    [SessionDiagnostic, attributes(
+    [DiagnosticHandler, attributes(
         // struct attributes
         diag,
         help,