Skip to content

Commit 7222172

Browse files
committed
Rename SubdiagnosticVariant as SubdiagVariant.
1 parent c90dc20 commit 7222172

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use syn::Token;
1212
use syn::{parse_quote, spanned::Spanned, Attribute, Meta, Path, Type};
1313
use synstructure::{BindingInfo, Structure, VariantInfo};
1414

15-
use super::utils::SubdiagnosticVariant;
15+
use super::utils::SubdiagVariant;
1616

1717
/// What kind of diagnostic is being derived - a fatal/error/warning or a lint?
1818
#[derive(Clone, Copy, PartialEq, Eq)]
@@ -142,7 +142,7 @@ impl DiagDeriveVariantBuilder {
142142
&self,
143143
attr: &Attribute,
144144
) -> Result<Option<(SubdiagKind, Path, bool)>, DiagDeriveError> {
145-
let Some(subdiag) = SubdiagnosticVariant::from_attr(attr, self)? else {
145+
let Some(subdiag) = SubdiagVariant::from_attr(attr, self)? else {
146146
// Some attributes aren't errors - like documentation comments - but also aren't
147147
// subdiagnostics.
148148
return Ok(None);

compiler/rustc_macros/src/diagnostics/subdiagnostic.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use quote::{format_ident, quote};
1414
use syn::{spanned::Spanned, Attribute, Meta, MetaList, Path};
1515
use synstructure::{BindingInfo, Structure, VariantInfo};
1616

17-
use super::utils::SubdiagnosticVariant;
17+
use super::utils::SubdiagVariant;
1818

1919
/// The central struct for constructing the `add_to_diag` method from an annotated struct.
2020
pub(crate) struct AddToDiagDerive {
@@ -183,8 +183,8 @@ impl<'parent, 'a> SubdiagDeriveVariantBuilder<'parent, 'a> {
183183
let mut kind_slugs = vec![];
184184

185185
for attr in self.variant.ast().attrs {
186-
let Some(SubdiagnosticVariant { kind, slug, no_span }) =
187-
SubdiagnosticVariant::from_attr(attr, self)?
186+
let Some(SubdiagVariant { kind, slug, no_span }) =
187+
SubdiagVariant::from_attr(attr, self)?
188188
else {
189189
// Some attributes aren't errors - like documentation comments - but also aren't
190190
// subdiagnostics.

compiler/rustc_macros/src/diagnostics/utils.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -592,20 +592,20 @@ pub(super) enum SubdiagKind {
592592
},
593593
}
594594

595-
pub(super) struct SubdiagnosticVariant {
595+
pub(super) struct SubdiagVariant {
596596
pub(super) kind: SubdiagKind,
597597
pub(super) slug: Option<Path>,
598598
pub(super) no_span: bool,
599599
}
600600

601-
impl SubdiagnosticVariant {
602-
/// Constructs a `SubdiagnosticVariant` from a field or type attribute such as `#[note]`,
601+
impl SubdiagVariant {
602+
/// Constructs a `SubdiagVariant` from a field or type attribute such as `#[note]`,
603603
/// `#[error(parser::add_paren, no_span)]` or `#[suggestion(code = "...")]`. Returns the
604604
/// `SubdiagKind` and the diagnostic slug, if specified.
605605
pub(super) fn from_attr(
606606
attr: &Attribute,
607607
fields: &impl HasFieldMap,
608-
) -> Result<Option<SubdiagnosticVariant>, DiagDeriveError> {
608+
) -> Result<Option<SubdiagVariant>, DiagDeriveError> {
609609
// Always allow documentation comments.
610610
if is_doc_comment(attr) {
611611
return Ok(None);
@@ -680,7 +680,7 @@ impl SubdiagnosticVariant {
680680
| SubdiagKind::Help
681681
| SubdiagKind::Warn
682682
| SubdiagKind::MultipartSuggestion { .. } => {
683-
return Ok(Some(SubdiagnosticVariant { kind, slug: None, no_span: false }));
683+
return Ok(Some(SubdiagVariant { kind, slug: None, no_span: false }));
684684
}
685685
SubdiagKind::Suggestion { .. } => {
686686
throw_span_err!(span, "suggestion without `code = \"...\"`")
@@ -830,7 +830,7 @@ impl SubdiagnosticVariant {
830830
SubdiagKind::Label | SubdiagKind::Note | SubdiagKind::Help | SubdiagKind::Warn => {}
831831
}
832832

833-
Ok(Some(SubdiagnosticVariant { kind, slug, no_span }))
833+
Ok(Some(SubdiagVariant { kind, slug, no_span }))
834834
}
835835
}
836836

0 commit comments

Comments
 (0)