Skip to content

Commit 96657dd

Browse files
committed
Rename DiagnosticDeriveKind as DiagDeriveKind.
1 parent 95cbf79 commit 96657dd

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

compiler/rustc_macros/src/diagnostics/diagnostic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::cell::RefCell;
44

5-
use crate::diagnostics::diagnostic_builder::DiagnosticDeriveKind;
5+
use crate::diagnostics::diagnostic_builder::DiagDeriveKind;
66
use crate::diagnostics::error::{span_err, DiagnosticDeriveError};
77
use crate::diagnostics::utils::SetOnce;
88
use proc_macro2::TokenStream;
@@ -22,7 +22,7 @@ impl<'a> DiagnosticDerive<'a> {
2222

2323
pub(crate) fn into_tokens(self) -> TokenStream {
2424
let DiagnosticDerive { mut structure } = self;
25-
let kind = DiagnosticDeriveKind::Diagnostic;
25+
let kind = DiagDeriveKind::Diagnostic;
2626
let slugs = RefCell::new(Vec::new());
2727
let implementation = kind.each_variant(&mut structure, |mut builder, variant| {
2828
let preamble = builder.preamble(variant);
@@ -104,7 +104,7 @@ impl<'a> LintDiagnosticDerive<'a> {
104104

105105
pub(crate) fn into_tokens(self) -> TokenStream {
106106
let LintDiagnosticDerive { mut structure } = self;
107-
let kind = DiagnosticDeriveKind::LintDiagnostic;
107+
let kind = DiagDeriveKind::LintDiagnostic;
108108
let implementation = kind.each_variant(&mut structure, |mut builder, variant| {
109109
let preamble = builder.preamble(variant);
110110
let body = builder.body(variant);

compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use super::utils::SubdiagnosticVariant;
1818

1919
/// What kind of diagnostic is being derived - a fatal/error/warning or a lint?
2020
#[derive(Clone, Copy, PartialEq, Eq)]
21-
pub(crate) enum DiagnosticDeriveKind {
21+
pub(crate) enum DiagDeriveKind {
2222
Diagnostic,
2323
LintDiagnostic,
2424
}
@@ -28,7 +28,7 @@ pub(crate) enum DiagnosticDeriveKind {
2828
/// fatal/errors/warnings and `LintDiagnostic` for lints.
2929
pub(crate) struct DiagnosticDeriveVariantBuilder {
3030
/// The kind for the entire type.
31-
pub kind: DiagnosticDeriveKind,
31+
pub kind: DiagDeriveKind,
3232

3333
/// Initialization of format strings for code suggestions.
3434
pub formatting_init: TokenStream,
@@ -55,7 +55,7 @@ impl HasFieldMap for DiagnosticDeriveVariantBuilder {
5555
}
5656
}
5757

58-
impl DiagnosticDeriveKind {
58+
impl DiagDeriveKind {
5959
/// Call `f` for the struct or for each variant of the enum, returning a `TokenStream` with the
6060
/// tokens from `f` wrapped in an `match` expression. Emits errors for use of derive on unions
6161
/// or attributes on the type itself when input is an enum.
@@ -316,14 +316,14 @@ impl DiagnosticDeriveVariantBuilder {
316316
(Meta::Path(_), "skip_arg") => return Ok(quote! {}),
317317
(Meta::Path(_), "primary_span") => {
318318
match self.kind {
319-
DiagnosticDeriveKind::Diagnostic => {
319+
DiagDeriveKind::Diagnostic => {
320320
report_error_if_not_applied_to_span(attr, &info)?;
321321

322322
return Ok(quote! {
323323
diag.span(#binding);
324324
});
325325
}
326-
DiagnosticDeriveKind::LintDiagnostic => {
326+
DiagDeriveKind::LintDiagnostic => {
327327
throw_invalid_attr!(attr, |diag| {
328328
diag.help("the `primary_span` field attribute is not valid for lint diagnostics")
329329
})

0 commit comments

Comments
 (0)