Skip to main content

rustc_expand/
diagnostics.rs

1use std::borrow::Cow;
2
3use rustc_errors::codes::*;
4use rustc_macros::{Diagnostic, Subdiagnostic};
5use rustc_span::{Ident, MacroRulesNormalizedIdent, Span, Symbol};
6use rustc_structures::Limit;
7
8#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for CfgAttrNoAttributes
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CfgAttrNoAttributes => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[cfg_attr]` does not expand to any attributes")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
9#[diag("`#[cfg_attr]` does not expand to any attributes")]
10pub(crate) struct CfgAttrNoAttributes;
11
12#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CfgNotSupportedInPosition {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CfgNotSupportedInPosition { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`cfg` is not supported in this position")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
13#[diag("`cfg` is not supported in this position")]
14pub(crate) struct CfgNotSupportedInPosition {
15    #[primary_span]
16    pub span: Span,
17}
18
19#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NoSyntaxVarsExprRepeat {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NoSyntaxVarsExprRepeat {
                        span: __binding_0,
                        typo_repeatable: __binding_1,
                        typo_unrepeatable: __binding_2,
                        typo_unrepeatable_label: __binding_3,
                        var_no_typo: __binding_4,
                        no_repeatable_var: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attempted to repeat an expression containing no syntax variables matched as repeating at this depth")));
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        if let Some(__binding_4) = __binding_4 {
                            diag.subdiagnostic(__binding_4);
                        }
                        if let Some(__binding_5) = __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
20#[diag(
21    "attempted to repeat an expression containing no syntax variables matched as repeating at this depth"
22)]
23pub(crate) struct NoSyntaxVarsExprRepeat {
24    #[primary_span]
25    pub span: Span,
26    #[subdiagnostic]
27    pub typo_repeatable: Option<VarTypoSuggestionRepeatable>,
28    #[subdiagnostic]
29    pub typo_unrepeatable: Option<VarTypoSuggestionUnrepeatable>,
30    #[subdiagnostic]
31    pub typo_unrepeatable_label: Option<VarTypoSuggestionUnrepeatableLabel>,
32    #[subdiagnostic]
33    pub var_no_typo: Option<VarNoTypo>,
34    #[subdiagnostic]
35    pub no_repeatable_var: Option<NoRepeatableVar>,
36}
37
38#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for VarTypoSuggestionRepeatable {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    VarTypoSuggestionRepeatable {
                        span: __binding_0, name: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_0 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                });
                        suggestions.push((__binding_0, __code_0));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there's a macro metavariable with a similar name")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
39#[multipart_suggestion(
40    "there's a macro metavariable with a similar name",
41    applicability = "maybe-incorrect",
42    style = "verbose"
43)]
44pub(crate) struct VarTypoSuggestionRepeatable {
45    #[suggestion_part(code = "{name}")]
46    pub span: Span,
47    pub name: Symbol,
48}
49
50#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for VarTypoSuggestionUnrepeatable {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    VarTypoSuggestionUnrepeatable { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("argument not found")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
51#[label("argument not found")]
52pub(crate) struct VarTypoSuggestionUnrepeatable {
53    #[primary_span]
54    pub span: Span,
55}
56
57#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            VarTypoSuggestionUnrepeatableLabel {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    VarTypoSuggestionUnrepeatableLabel { span: __binding_0 } =>
                        {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this similarly named macro metavariable is unrepeatable")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
58#[label("this similarly named macro metavariable is unrepeatable")]
59pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
60    #[primary_span]
61    pub span: Span,
62}
63
64#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for VarNoTypo {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    VarNoTypo { span: __binding_0, msg: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("msg".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a repeatable metavariable: {$msg}")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
65#[label("expected a repeatable metavariable: {$msg}")]
66pub(crate) struct VarNoTypo {
67    #[primary_span]
68    pub span: Span,
69    pub msg: String,
70}
71
72#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for NoRepeatableVar {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    NoRepeatableVar { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this macro metavariable is not repeatable and there are no other repeatable metavariables")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
73#[label(
74    "this macro metavariable is not repeatable and there are no other repeatable metavariables"
75)]
76pub(crate) struct NoRepeatableVar {
77    #[primary_span]
78    pub span: Span,
79}
80
81#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MustRepeatOnce {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MustRepeatOnce { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this must repeat at least once")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
82#[diag("this must repeat at least once")]
83pub(crate) struct MustRepeatOnce {
84    #[primary_span]
85    pub span: Span,
86}
87
88#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CountRepetitionMisplaced {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CountRepetitionMisplaced { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`count` can not be placed inside the innermost repetition")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
89#[diag("`count` can not be placed inside the innermost repetition")]
90pub(crate) struct CountRepetitionMisplaced {
91    #[primary_span]
92    pub span: Span,
93}
94
95#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MacroVarStillRepeating {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MacroVarStillRepeating {
                        span: __binding_0, ident: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable `{$ident}` is still repeating at this depth")));
                        ;
                        diag.arg("ident", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
96#[diag("variable `{$ident}` is still repeating at this depth")]
97pub(crate) struct MacroVarStillRepeating {
98    #[primary_span]
99    pub span: Span,
100    pub ident: MacroRulesNormalizedIdent,
101}
102
103#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MetaVarStillRepeatingLint {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MetaVarStillRepeatingLint {
                        label: __binding_0, ident: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable `{$ident}` is still repeating at this depth")));
                        ;
                        diag.arg("ident", __binding_1);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected repetition")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
104#[diag("variable `{$ident}` is still repeating at this depth")]
105pub(crate) struct MetaVarStillRepeatingLint {
106    #[label("expected repetition")]
107    pub label: Span,
108    pub ident: MacroRulesNormalizedIdent,
109}
110
111#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MetaVariableWrongOperator {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MetaVariableWrongOperator {
                        binder: __binding_0, occurrence: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("meta-variable repeats with different Kleene operator")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected repetition")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("conflicting repetition")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
112#[diag("meta-variable repeats with different Kleene operator")]
113pub(crate) struct MetaVariableWrongOperator {
114    #[label("expected repetition")]
115    pub binder: Span,
116    #[label("conflicting repetition")]
117    pub occurrence: Span,
118}
119
120#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MetaVarsDifSeqMatchers {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MetaVarsDifSeqMatchers { span: __binding_0, msg: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$msg}")));
                        ;
                        diag.arg("msg", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
121#[diag("{$msg}")]
122pub(crate) struct MetaVarsDifSeqMatchers {
123    #[primary_span]
124    pub span: Span,
125    pub msg: String,
126}
127
128#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnknownMacroVariable
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnknownMacroVariable { name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown macro variable `{$name}`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
129#[diag("unknown macro variable `{$name}`")]
130pub(crate) struct UnknownMacroVariable {
131    pub name: MacroRulesNormalizedIdent,
132}
133
134#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MacroBodyStability {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MacroBodyStability {
                        span: __binding_0, head_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macros cannot have body stability attributes")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid body stability attribute")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("body stability attribute affects this macro")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
135#[diag("macros cannot have body stability attributes")]
136pub(crate) struct MacroBodyStability {
137    #[primary_span]
138    #[label("invalid body stability attribute")]
139    pub span: Span,
140    #[label("body stability attribute affects this macro")]
141    pub head_span: Span,
142}
143
144#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            FeatureRemoved<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FeatureRemoved {
                        span: __binding_0,
                        reason: __binding_1,
                        removed_rustc_version: __binding_2,
                        pull_note: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("feature has been removed")));
                        diag.code(E0557);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("removed in {$removed_rustc_version}{$pull_note}")));
                        ;
                        diag.arg("removed_rustc_version", __binding_2);
                        diag.arg("pull_note", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("feature has been removed")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
145#[diag("feature has been removed", code = E0557)]
146#[note("removed in {$removed_rustc_version}{$pull_note}")]
147pub(crate) struct FeatureRemoved<'a> {
148    #[primary_span]
149    #[label("feature has been removed")]
150    pub span: Span,
151    #[subdiagnostic]
152    pub reason: Option<FeatureRemovedReason<'a>>,
153    pub removed_rustc_version: &'a str,
154    pub pull_note: String,
155}
156
157#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for FeatureRemovedReason<'a> {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    FeatureRemovedReason { reason: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("reason".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$reason}")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
158#[note("{$reason}")]
159pub(crate) struct FeatureRemovedReason<'a> {
160    pub reason: &'a str,
161}
162
163#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FeatureNotAllowed {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FeatureNotAllowed { span: __binding_0, name: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature `{$name}` is not in the list of allowed features")));
                        diag.code(E0725);
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
164#[diag("the feature `{$name}` is not in the list of allowed features", code = E0725)]
165pub(crate) struct FeatureNotAllowed {
166    #[primary_span]
167    pub span: Span,
168    pub name: Symbol,
169}
170
171#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RecursionLimitReached {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RecursionLimitReached {
                        span: __binding_0,
                        descr: __binding_1,
                        suggested_limit: __binding_2,
                        crate_name: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("recursion limit reached while expanding `{$descr}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]` attribute to your crate (`{$crate_name}`)")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.arg("suggested_limit", __binding_2);
                        diag.arg("crate_name", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
172#[diag("recursion limit reached while expanding `{$descr}`")]
173#[help(
174    "consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]` attribute to your crate (`{$crate_name}`)"
175)]
176pub(crate) struct RecursionLimitReached {
177    #[primary_span]
178    pub span: Span,
179    pub descr: String,
180    pub suggested_limit: Limit,
181    pub crate_name: Symbol,
182}
183
184#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RemoveExprNotSupported {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RemoveExprNotSupported { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("removing an expression is not supported in this position")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
185#[diag("removing an expression is not supported in this position")]
186pub(crate) struct RemoveExprNotSupported {
187    #[primary_span]
188    pub span: Span,
189}
190
191#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            WrongFragmentKind<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    WrongFragmentKind {
                        span: __binding_0, kind: __binding_1, name: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-{$kind} macro in {$kind} position: {$name}")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.arg("name", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
192#[diag("non-{$kind} macro in {$kind} position: {$name}")]
193pub(crate) struct WrongFragmentKind<'a> {
194    #[primary_span]
195    pub span: Span,
196    pub kind: &'a str,
197    pub name: String,
198}
199
200#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsupportedKeyValue
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsupportedKeyValue { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("key-value macro attributes are not supported")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
201#[diag("key-value macro attributes are not supported")]
202pub(crate) struct UnsupportedKeyValue {
203    #[primary_span]
204    pub span: Span,
205}
206
207#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            IncompleteParse<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    IncompleteParse {
                        span: __binding_0,
                        descr: __binding_1,
                        label_span: __binding_2,
                        macro_path: __binding_3,
                        kind_name: __binding_4,
                        expands_to_match_arm: __binding_5,
                        add_semicolon: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro expansion ignores {$descr} and any tokens following")));
                        let __code_1 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(";"))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the usage of `{$macro_path}!` is likely invalid in {$kind_name} context")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.arg("macro_path", __binding_3);
                        diag.arg("kind_name", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("caused by the macro expansion here")));
                        if __binding_5 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macros cannot expand to match arms")));
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.span_suggestions_with_style(__binding_6,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might be missing a semicolon here")),
                                __code_1, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowAlways);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
208#[diag("macro expansion ignores {$descr} and any tokens following")]
209#[note("the usage of `{$macro_path}!` is likely invalid in {$kind_name} context")]
210pub(crate) struct IncompleteParse<'a> {
211    #[primary_span]
212    pub span: Span,
213    pub descr: String,
214    #[label("caused by the macro expansion here")]
215    pub label_span: Span,
216    pub macro_path: String,
217    pub kind_name: &'a str,
218    #[note("macros cannot expand to match arms")]
219    pub expands_to_match_arm: bool,
220
221    #[suggestion(
222        "you might be missing a semicolon here",
223        style = "verbose",
224        code = ";",
225        applicability = "maybe-incorrect"
226    )]
227    pub add_semicolon: Option<Span>,
228}
229
230#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ModuleCircular {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ModuleCircular { span: __binding_0, modules: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("circular modules: {$modules}")));
                        ;
                        diag.arg("modules", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
231#[diag("circular modules: {$modules}")]
232pub(crate) struct ModuleCircular {
233    #[primary_span]
234    pub span: Span,
235    pub modules: String,
236}
237
238#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ModuleInBlock {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ModuleInBlock { span: __binding_0, name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot declare a file module inside a block unless it has a path attribute")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("file modules are usually placed outside of blocks, at the top level of the file")));
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
239#[diag("cannot declare a file module inside a block unless it has a path attribute")]
240#[note("file modules are usually placed outside of blocks, at the top level of the file")]
241pub(crate) struct ModuleInBlock {
242    #[primary_span]
243    pub span: Span,
244    #[subdiagnostic]
245    pub name: Option<ModuleInBlockName>,
246}
247
248#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ModuleInBlockName {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ModuleInBlockName { span: __binding_0, name: __binding_1 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("maybe `use` the module `{$name}` instead of redeclaring it")),
                                &sub_args);
                        diag.span_help(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
249#[help("maybe `use` the module `{$name}` instead of redeclaring it")]
250pub(crate) struct ModuleInBlockName {
251    #[primary_span]
252    pub span: Span,
253    pub name: Ident,
254}
255
256#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ModuleFileNotFound {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ModuleFileNotFound {
                        span: __binding_0,
                        name: __binding_1,
                        default_path: __binding_2,
                        secondary_path: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("file not found for module `{$name}`")));
                        diag.code(E0583);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to create the module `{$name}`, create file \"{$default_path}\" or \"{$secondary_path}\"")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if there is a `mod {$name}` elsewhere in the crate already, import it with `use crate::...` instead")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("default_path", __binding_2);
                        diag.arg("secondary_path", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
257#[diag("file not found for module `{$name}`", code = E0583)]
258#[help("to create the module `{$name}`, create file \"{$default_path}\" or \"{$secondary_path}\"")]
259#[note(
260    "if there is a `mod {$name}` elsewhere in the crate already, import it with `use crate::...` instead"
261)]
262pub(crate) struct ModuleFileNotFound {
263    #[primary_span]
264    pub span: Span,
265    pub name: Ident,
266    pub default_path: String,
267    pub secondary_path: String,
268}
269
270#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ModuleMultipleCandidates {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ModuleMultipleCandidates {
                        span: __binding_0,
                        name: __binding_1,
                        default_path: __binding_2,
                        secondary_path: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("file for module `{$name}` found at both \"{$default_path}\" and \"{$secondary_path}\"")));
                        diag.code(E0761);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("delete or rename one of them to remove the ambiguity")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("default_path", __binding_2);
                        diag.arg("secondary_path", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
271#[diag("file for module `{$name}` found at both \"{$default_path}\" and \"{$secondary_path}\"", code = E0761)]
272#[help("delete or rename one of them to remove the ambiguity")]
273pub(crate) struct ModuleMultipleCandidates {
274    #[primary_span]
275    pub span: Span,
276    pub name: Ident,
277    pub default_path: String,
278    pub secondary_path: String,
279}
280
281#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TraceMacro {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TraceMacro { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trace_macro")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
282#[diag("trace_macro")]
283pub(crate) struct TraceMacro {
284    #[primary_span]
285    pub span: Span,
286}
287
288#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ProcMacroPanicked {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ProcMacroPanicked { span: __binding_0, message: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("proc macro panicked")));
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
289#[diag("proc macro panicked")]
290pub(crate) struct ProcMacroPanicked {
291    #[primary_span]
292    pub span: Span,
293    #[subdiagnostic]
294    pub message: Option<ProcMacroPanickedHelp>,
295}
296
297#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ProcMacroPanickedHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ProcMacroPanickedHelp { message: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("message: {$message}")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
298#[help("message: {$message}")]
299pub(crate) struct ProcMacroPanickedHelp {
300    pub message: String,
301}
302
303#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ProcMacroDerivePanicked {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ProcMacroDerivePanicked {
                        span: __binding_0, message: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("proc-macro derive panicked")));
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
304#[diag("proc-macro derive panicked")]
305pub(crate) struct ProcMacroDerivePanicked {
306    #[primary_span]
307    pub span: Span,
308    #[subdiagnostic]
309    pub message: Option<ProcMacroDerivePanickedHelp>,
310}
311
312#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ProcMacroDerivePanickedHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ProcMacroDerivePanickedHelp { message: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("message: {$message}")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
313#[help("message: {$message}")]
314pub(crate) struct ProcMacroDerivePanickedHelp {
315    pub message: String,
316}
317
318#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CustomAttributePanicked {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CustomAttributePanicked {
                        span: __binding_0, message: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("custom attribute panicked")));
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
319#[diag("custom attribute panicked")]
320pub(crate) struct CustomAttributePanicked {
321    #[primary_span]
322    pub span: Span,
323    #[subdiagnostic]
324    pub message: Option<CustomAttributePanickedHelp>,
325}
326
327#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CustomAttributePanickedHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    CustomAttributePanickedHelp { message: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("message".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("message: {$message}")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
328#[help("message: {$message}")]
329pub(crate) struct CustomAttributePanickedHelp {
330    pub message: String,
331}
332
333#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ProcMacroDeriveTokens {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ProcMacroDeriveTokens { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("proc-macro derive produced unparsable tokens")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
334#[diag("proc-macro derive produced unparsable tokens")]
335pub(crate) struct ProcMacroDeriveTokens {
336    #[primary_span]
337    pub span: Span,
338}
339
340#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DuplicateMatcherBinding {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DuplicateMatcherBinding {
                        span: __binding_0, prev: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate matcher binding")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate binding")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous binding")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
341#[diag("duplicate matcher binding")]
342pub(crate) struct DuplicateMatcherBinding {
343    #[primary_span]
344    #[label("duplicate binding")]
345    pub span: Span,
346    #[label("previous binding")]
347    pub prev: Span,
348}
349
350#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DuplicateMatcherBindingLint {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DuplicateMatcherBindingLint {
                        span: __binding_0, prev: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate matcher binding")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate binding")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous binding")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
351#[diag("duplicate matcher binding")]
352pub(crate) struct DuplicateMatcherBindingLint {
353    #[label("duplicate binding")]
354    pub span: Span,
355    #[label("previous binding")]
356    pub prev: Span,
357}
358
359#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MissingFragmentSpecifier {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingFragmentSpecifier {
                        span: __binding_0, add_span: __binding_1, valid: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing fragment specifier")));
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(":spec"))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("fragment specifiers must be provided")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$valid}")));
                        ;
                        diag.arg("valid", __binding_2);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding a specifier here")),
                            __code_2, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
360#[diag("missing fragment specifier")]
361#[note("fragment specifiers must be provided")]
362#[help("{$valid}")]
363pub(crate) struct MissingFragmentSpecifier {
364    #[primary_span]
365    pub span: Span,
366    #[suggestion(
367        "try adding a specifier here",
368        style = "verbose",
369        code = ":spec",
370        applicability = "maybe-incorrect"
371    )]
372    pub add_span: Span,
373    pub valid: &'static str,
374}
375
376#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidFragmentSpecifier {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidFragmentSpecifier {
                        span: __binding_0, fragment: __binding_1, help: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid fragment specifier `{$fragment}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$help}")));
                        ;
                        diag.arg("fragment", __binding_1);
                        diag.arg("help", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
377#[diag("invalid fragment specifier `{$fragment}`")]
378#[help("{$help}")]
379pub(crate) struct InvalidFragmentSpecifier {
380    #[primary_span]
381    pub span: Span,
382    pub fragment: Ident,
383    pub help: &'static str,
384}
385
386#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ExpectedParenOrBrace<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExpectedParenOrBrace { span: __binding_0, token: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected `(` or `{\"{\"}`, found `{$token}`")));
                        ;
                        diag.arg("token", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
387#[diag("expected `(` or `{\"{\"}`, found `{$token}`")]
388pub(crate) struct ExpectedParenOrBrace<'a> {
389    #[primary_span]
390    pub span: Span,
391    pub token: Cow<'a, str>,
392}
393
394#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptyDelegationMac {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EmptyDelegationMac { span: __binding_0, kind: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty {$kind} delegation is not supported")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
395#[diag("empty {$kind} delegation is not supported")]
396pub(crate) struct EmptyDelegationMac {
397    #[primary_span]
398    pub span: Span,
399    pub kind: String,
400}
401
402#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            GlobDelegationOutsideImpls {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    GlobDelegationOutsideImpls { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("glob delegation is only supported in impls")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
403#[diag("glob delegation is only supported in impls")]
404pub(crate) struct GlobDelegationOutsideImpls {
405    #[primary_span]
406    pub span: Span,
407}
408
409#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for CrateNameInCfgAttr {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CrateNameInCfgAttr { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `crate_name` attribute is forbidden within a `cfg_attr` attribute")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
410#[diag("the `crate_name` attribute is forbidden within a `cfg_attr` attribute")]
411pub(crate) struct CrateNameInCfgAttr {
412    #[primary_span]
413    pub span: Span,
414}
415
416#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for CrateTypeInCfgAttr {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CrateTypeInCfgAttr { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `crate_type` attribute is forbidden within a `cfg_attr` attribute")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
417#[diag("the `crate_type` attribute is forbidden within a `cfg_attr` attribute")]
418pub(crate) struct CrateTypeInCfgAttr {
419    #[primary_span]
420    pub span: Span,
421}
422
423#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            GlobDelegationTraitlessQpath {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    GlobDelegationTraitlessQpath { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("qualified path without a trait in glob delegation")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
424#[diag("qualified path without a trait in glob delegation")]
425pub(crate) struct GlobDelegationTraitlessQpath {
426    #[primary_span]
427    pub span: Span,
428}
429
430pub(crate) use metavar_exprs::*;
431mod metavar_exprs {
432    use super::*;
433
434    #[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MveExtraTokens {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MveExtraTokens {
                        span: __binding_0,
                        ident_span: __binding_1,
                        extra_count: __binding_2,
                        exact_args_note: __binding_3,
                        range_args_note: __binding_4,
                        min_or_exact_args: __binding_5,
                        max_args: __binding_6,
                        name: __binding_7 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected trailing tokens")));
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("extra_count", __binding_2);
                        diag.arg("min_or_exact_args", __binding_5);
                        diag.arg("max_args", __binding_6);
                        diag.arg("name", __binding_7);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try removing {$extra_count ->\n                [one] this token\n                *[other] these tokens\n            }")),
                            __code_3, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for this metavariable expression")));
                        if let Some(__binding_3) = __binding_3 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$name}` metavariable expression takes {$min_or_exact_args ->\n                [zero] no arguments\n                [one] a single argument\n                *[other] {$min_or_exact_args} arguments\n            }")));
                        }
                        if let Some(__binding_4) = __binding_4 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$name}` metavariable expression takes between {$min_or_exact_args} and {$max_args} arguments")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic, #[automatically_derived]impl ::core::default::Default for MveExtraTokens {
    #[inline]
    fn default() -> Self {
        MveExtraTokens {
            span: ::core::default::Default::default(),
            ident_span: ::core::default::Default::default(),
            extra_count: ::core::default::Default::default(),
            exact_args_note: ::core::default::Default::default(),
            range_args_note: ::core::default::Default::default(),
            min_or_exact_args: ::core::default::Default::default(),
            max_args: ::core::default::Default::default(),
            name: ::core::default::Default::default(),
        }
    }
}Default)]
435    #[diag("unexpected trailing tokens")]
436    pub(crate) struct MveExtraTokens {
437        #[primary_span]
438        #[suggestion(
439            "try removing {$extra_count ->
440                [one] this token
441                *[other] these tokens
442            }",
443            code = "",
444            applicability = "machine-applicable"
445        )]
446        pub span: Span,
447        #[label("for this metavariable expression")]
448        pub ident_span: Span,
449        pub extra_count: usize,
450
451        // The rest is only used for specific diagnostics and can be default if neither
452        // `note` is `Some`.
453        #[note(
454            "the `{$name}` metavariable expression takes {$min_or_exact_args ->
455                [zero] no arguments
456                [one] a single argument
457                *[other] {$min_or_exact_args} arguments
458            }"
459        )]
460        pub exact_args_note: Option<()>,
461        #[note(
462            "the `{$name}` metavariable expression takes between {$min_or_exact_args} and {$max_args} arguments"
463        )]
464        pub range_args_note: Option<()>,
465        pub min_or_exact_args: usize,
466        pub max_args: usize,
467        pub name: String,
468    }
469
470    #[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MveMissingParen {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MveMissingParen {
                        ident_span: __binding_0,
                        unexpected_span: __binding_1,
                        insert_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected `(`")));
                        let __code_4 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("( /* ... */ )"))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("metavariable expressions use function-like parentheses syntax")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for this this metavariable expression")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected token")));
                        }
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_suggestions_with_style(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding parentheses")),
                                __code_4, rustc_errors::Applicability::HasPlaceholders,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
471    #[note("metavariable expressions use function-like parentheses syntax")]
472    #[diag("expected `(`")]
473    pub(crate) struct MveMissingParen {
474        #[primary_span]
475        #[label("for this this metavariable expression")]
476        pub ident_span: Span,
477        #[label("unexpected token")]
478        pub unexpected_span: Option<Span>,
479        #[suggestion(
480            "try adding parentheses",
481            code = "( /* ... */ )",
482            applicability = "has-placeholders"
483        )]
484        pub insert_span: Option<Span>,
485    }
486
487    #[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MveUnrecognizedExpr
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MveUnrecognizedExpr {
                        span: __binding_0, valid_expr_list: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unrecognized metavariable expression")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("valid metavariable expressions are {$valid_expr_list}")));
                        ;
                        diag.arg("valid_expr_list", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a valid metavariable expression")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
488    #[note("valid metavariable expressions are {$valid_expr_list}")]
489    #[diag("unrecognized metavariable expression")]
490    pub(crate) struct MveUnrecognizedExpr {
491        #[primary_span]
492        #[label("not a valid metavariable expression")]
493        pub span: Span,
494        pub valid_expr_list: &'static str,
495    }
496
497    #[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MveUnrecognizedVar {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MveUnrecognizedVar { span: __binding_0, key: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable `{$key}` is not recognized in meta-variable expression")));
                        ;
                        diag.arg("key", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
498    #[diag("variable `{$key}` is not recognized in meta-variable expression")]
499    pub(crate) struct MveUnrecognizedVar {
500        #[primary_span]
501        pub span: Span,
502        pub key: MacroRulesNormalizedIdent,
503    }
504
505    #[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConcatInvalidIdent {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ConcatInvalidIdent { span: __binding_0, reason: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`${\"{\"}concat(..){\"}\"}` is not generating a valid identifier")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
506    #[diag(r#"`${"{"}concat(..){"}"}` is not generating a valid identifier"#)]
507    pub(crate) struct ConcatInvalidIdent {
508        #[primary_span]
509        pub span: Span,
510        #[subdiagnostic]
511        pub reason: InvalidIdentReason,
512    }
513
514    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidIdentReason {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvalidIdentReason::Empty => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `${\"{\"}concat(..){\"}\"}` invocation generated an empty ident")),
                                &sub_args);
                        diag.note(__message);
                    }
                    InvalidIdentReason::InvalidStart {
                        symbol: __binding_0, start: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("symbol".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("start".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `${\"{\"}concat(..){\"}\"}` invocation generated `{$symbol}`, but {$start} is neither '_' nor XID_Start")),
                                &sub_args);
                        diag.note(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/reference/identifiers.html> for the definition of valid identifiers")),
                                &sub_args);
                        diag.note(__message);
                    }
                    InvalidIdentReason::InvalidContinue {
                        symbol: __binding_0, not_continue: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("symbol".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("not_continue".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `${\"{\"}concat(..){\"}\"}` invocation generated `{$symbol}`, but {$not_continue} is not XID_Continue")),
                                &sub_args);
                        diag.note(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/reference/identifiers.html> for the definition of valid identifiers")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
515    pub(crate) enum InvalidIdentReason {
516        #[note(r#"this `${"{"}concat(..){"}"}` invocation generated an empty ident"#)]
517        Empty,
518        #[note(r#"this `${"{"}concat(..){"}"}` invocation generated `{$symbol}`, but {$start} is neither '_' nor XID_Start"#)]
519        #[note(
520            "see <https://doc.rust-lang.org/reference/identifiers.html> for the definition of valid identifiers"
521        )]
522        InvalidStart { symbol: Symbol, start: char },
523        #[note(r#"this `${"{"}concat(..){"}"}` invocation generated `{$symbol}`, but {$not_continue} is not XID_Continue"#)]
524        #[note(
525            "see <https://doc.rust-lang.org/reference/identifiers.html> for the definition of valid identifiers"
526        )]
527        InvalidContinue { symbol: Symbol, not_continue: char },
528    }
529
530    impl InvalidIdentReason {
531        pub(crate) fn new(symbol: Symbol) -> Self {
532            let mut chars = symbol.as_str().chars();
533            if let Some(start) = chars.next() {
534                if rustc_lexer::is_id_start(start) {
535                    let not_continue = chars
536                        .find(|c| !rustc_lexer::is_id_continue(*c))
537                        .expect("InvalidIdentReason: cannot find invalid ident reason");
538                    InvalidIdentReason::InvalidContinue { symbol, not_continue }
539                } else {
540                    InvalidIdentReason::InvalidStart { symbol, start }
541                }
542            } else {
543                InvalidIdentReason::Empty
544            }
545        }
546    }
547}
548
549#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MacroArgsBadDelim {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MacroArgsBadDelim {
                        span: __binding_0, sugg: __binding_1, rule_kw: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$rule_kw}` rule argument matchers require parentheses")));
                        ;
                        diag.arg("rule_kw", __binding_2);
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
550#[diag("`{$rule_kw}` rule argument matchers require parentheses")]
551pub(crate) struct MacroArgsBadDelim {
552    #[primary_span]
553    pub span: Span,
554    #[subdiagnostic]
555    pub sugg: MacroArgsBadDelimSugg,
556    pub rule_kw: Symbol,
557}
558
559#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MacroArgsBadDelimSugg {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    MacroArgsBadDelimSugg {
                        open: __binding_0, close: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_5 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_6 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_5));
                        suggestions.push((__binding_1, __code_6));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the delimiters should be `(` and `)`")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
560#[multipart_suggestion(
561    "the delimiters should be `(` and `)`",
562    applicability = "machine-applicable"
563)]
564pub(crate) struct MacroArgsBadDelimSugg {
565    #[suggestion_part(code = "(")]
566    pub open: Span,
567    #[suggestion_part(code = ")")]
568    pub close: Span,
569}
570
571#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MacroCallUnusedDocComment {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MacroCallUnusedDocComment { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused doc comment")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to document an item produced by a macro, the macro must produce the documentation as part of its expansion")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rustdoc does not generate documentation for macro invocations")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
572#[diag("unused doc comment")]
573#[help(
574    "to document an item produced by a macro, the macro must produce the documentation as part of its expansion"
575)]
576pub(crate) struct MacroCallUnusedDocComment {
577    #[label("rustdoc does not generate documentation for macro invocations")]
578    pub span: Span,
579}
580
581#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for OrPatternsBackCompat
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OrPatternsBackCompat {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro")));
                        let __code_7 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use pat_param to preserve semantics")),
                            __code_7, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
582#[diag(
583    "the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro"
584)]
585pub(crate) struct OrPatternsBackCompat {
586    #[suggestion(
587        "use pat_param to preserve semantics",
588        code = "{suggestion}",
589        applicability = "machine-applicable"
590    )]
591    pub span: Span,
592    pub suggestion: String,
593}
594
595#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TrailingMacro {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TrailingMacro { is_trailing: __binding_0, name: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trailing semicolon in macro used in expression position")));
                        ;
                        diag.arg("name", __binding_1);
                        if __binding_0 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro invocations at the end of a block are treated as expressions")));
                        }
                        if __binding_0 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to ignore the value produced by the macro, add a semicolon after the invocation of `{$name}`")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
596#[diag("trailing semicolon in macro used in expression position")]
597pub(crate) struct TrailingMacro {
598    #[note("macro invocations at the end of a block are treated as expressions")]
599    #[note(
600        "to ignore the value produced by the macro, add a semicolon after the invocation of `{$name}`"
601    )]
602    pub is_trailing: bool,
603    pub name: Ident,
604}
605
606#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnusedBuiltinAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedBuiltinAttribute {
                        invoc_span: __binding_0,
                        attr_name: __binding_1,
                        macro_name: __binding_2,
                        attr_span: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute `{$attr_name}`")));
                        let __code_8 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("attr_name", __binding_1);
                        diag.arg("macro_name", __binding_2);
                        diag.span_note(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the built-in attribute `{$attr_name}` will be ignored, since it's applied to the macro invocation `{$macro_name}`")));
                        diag.span_suggestions_with_style(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
                            __code_8, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
607#[diag("unused attribute `{$attr_name}`")]
608pub(crate) struct UnusedBuiltinAttribute {
609    #[note(
610        "the built-in attribute `{$attr_name}` will be ignored, since it's applied to the macro invocation `{$macro_name}`"
611    )]
612    pub invoc_span: Span,
613    pub attr_name: Symbol,
614    pub macro_name: String,
615    #[suggestion(
616        "remove the attribute",
617        code = "",
618        applicability = "machine-applicable",
619        style = "tool-only"
620    )]
621    pub attr_span: Span,
622}