Skip to main content

rustc_expand/
errors.rs

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