Skip to main content

rustc_resolve/
errors.rs

1use rustc_errors::codes::*;
2use rustc_errors::{
3    Applicability, Diag, DiagCtxtHandle, DiagMessage, Diagnostic, ElidedLifetimeInPathSubdiag,
4    EmissionGuarantee, IntoDiagArg, Level, LintDiagnostic, MultiSpan, Subdiagnostic, msg,
5};
6use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
7use rustc_span::source_map::Spanned;
8use rustc_span::{Ident, Span, Symbol};
9
10use crate::Res;
11use crate::late::PatternSource;
12
13#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            GenericParamsFromOuterItem 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 {
                    GenericParamsFromOuterItem {
                        span: __binding_0,
                        label: __binding_1,
                        refer_to_type_directly: __binding_2,
                        sugg: __binding_3,
                        static_or_const: __binding_4,
                        is_self: __binding_5,
                        item: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't use {$is_self ->\n        [true] `Self`\n        *[false] generic parameters\n    } from outer item")));
                        diag.code(E0401);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nested items are independent from their parent item for everything except for privacy and name resolution")));
                        ;
                        diag.arg("is_self", __binding_5);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of {$is_self ->\n            [true] `Self`\n            *[false] generic parameter\n        } from outer item")));
                        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_6) = __binding_6 {
                            diag.subdiagnostic(__binding_6);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
14#[diag("can't use {$is_self ->
15        [true] `Self`
16        *[false] generic parameters
17    } from outer item", code = E0401)]
18#[note(
19    "nested items are independent from their parent item for everything except for privacy and name resolution"
20)]
21pub(crate) struct GenericParamsFromOuterItem {
22    #[primary_span]
23    #[label(
24        "use of {$is_self ->
25            [true] `Self`
26            *[false] generic parameter
27        } from outer item"
28    )]
29    pub(crate) span: Span,
30    #[subdiagnostic]
31    pub(crate) label: Option<GenericParamsFromOuterItemLabel>,
32    #[subdiagnostic]
33    pub(crate) refer_to_type_directly: Option<UseTypeDirectly>,
34    #[subdiagnostic]
35    pub(crate) sugg: Option<GenericParamsFromOuterItemSugg>,
36    #[subdiagnostic]
37    pub(crate) static_or_const: Option<GenericParamsFromOuterItemStaticOrConst>,
38    pub(crate) is_self: bool,
39    #[subdiagnostic]
40    pub(crate) item: Option<GenericParamsFromOuterItemInnerItem>,
41}
42
43#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            GenericParamsFromOuterItemInnerItem {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    GenericParamsFromOuterItemInnerItem {
                        span: __binding_0, descr: __binding_1 } => {
                        diag.store_args();
                        diag.arg("descr", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_self ->\n        [true] `Self`\n        *[false] generic parameter\n    } used in this inner {$descr}")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
44#[label(
45    "{$is_self ->
46        [true] `Self`
47        *[false] generic parameter
48    } used in this inner {$descr}"
49)]
50pub(crate) struct GenericParamsFromOuterItemInnerItem {
51    #[primary_span]
52    pub(crate) span: Span,
53    pub(crate) descr: String,
54}
55
56#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            GenericParamsFromOuterItemStaticOrConst {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    GenericParamsFromOuterItemStaticOrConst::Static => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a `static` is a separate item from the item that contains it")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    GenericParamsFromOuterItemStaticOrConst::Const => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a `const` is a separate item from the item that contains it")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
57pub(crate) enum GenericParamsFromOuterItemStaticOrConst {
58    #[note("a `static` is a separate item from the item that contains it")]
59    Static,
60    #[note("a `const` is a separate item from the item that contains it")]
61    Const,
62}
63
64#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for GenericParamsFromOuterItemLabel {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    GenericParamsFromOuterItemLabel::SelfTyParam(__binding_0) =>
                        {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't use `Self` here")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    GenericParamsFromOuterItemLabel::SelfTyAlias(__binding_0) =>
                        {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`Self` type implicitly declared here, by this `impl`")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    GenericParamsFromOuterItemLabel::TyParam(__binding_0) => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter from outer item")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    GenericParamsFromOuterItemLabel::ConstParam(__binding_0) =>
                        {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const parameter from outer item")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
65pub(crate) enum GenericParamsFromOuterItemLabel {
66    #[label("can't use `Self` here")]
67    SelfTyParam(#[primary_span] Span),
68    #[label("`Self` type implicitly declared here, by this `impl`")]
69    SelfTyAlias(#[primary_span] Span),
70    #[label("type parameter from outer item")]
71    TyParam(#[primary_span] Span),
72    #[label("const parameter from outer item")]
73    ConstParam(#[primary_span] Span),
74}
75
76#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for GenericParamsFromOuterItemSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    GenericParamsFromOuterItemSugg {
                        span: __binding_0, snippet: __binding_1 } => {
                        let __code_0 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("snippet", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try introducing a local generic parameter here")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_0, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
77#[suggestion(
78    "try introducing a local generic parameter here",
79    code = "{snippet}",
80    applicability = "maybe-incorrect",
81    style = "verbose"
82)]
83pub(crate) struct GenericParamsFromOuterItemSugg {
84    #[primary_span]
85    pub(crate) span: Span,
86    pub(crate) snippet: String,
87}
88#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UseTypeDirectly {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UseTypeDirectly { span: __binding_0, snippet: __binding_1 }
                        => {
                        let __code_1 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("snippet", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("refer to the type directly here instead")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_1, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
89#[suggestion(
90    "refer to the type directly here instead",
91    code = "{snippet}",
92    applicability = "maybe-incorrect",
93    style = "verbose"
94)]
95pub(crate) struct UseTypeDirectly {
96    #[primary_span]
97    pub(crate) span: Span,
98    pub(crate) snippet: String,
99}
100
101#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NameAlreadyUsedInParameterList 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 {
                    NameAlreadyUsedInParameterList {
                        span: __binding_0,
                        first_use_span: __binding_1,
                        name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the name `{$name}` is already used for a generic parameter in this item's generic parameters")));
                        diag.code(E0403);
                        ;
                        diag.arg("name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("already used")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first use of `{$name}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
102#[diag("the name `{$name}` is already used for a generic parameter in this item's generic parameters", code = E0403)]
103pub(crate) struct NameAlreadyUsedInParameterList {
104    #[primary_span]
105    #[label("already used")]
106    pub(crate) span: Span,
107    #[label("first use of `{$name}`")]
108    pub(crate) first_use_span: Span,
109    pub(crate) name: Ident,
110}
111
112#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MethodNotMemberOfTrait 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 {
                    MethodNotMemberOfTrait {
                        span: __binding_0,
                        method: __binding_1,
                        trait_: __binding_2,
                        sub: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("method `{$method}` is not a member of trait `{$trait_}`")));
                        diag.code(E0407);
                        ;
                        diag.arg("method", __binding_1);
                        diag.arg("trait_", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a member of trait `{$trait_}`")));
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
113#[diag("method `{$method}` is not a member of trait `{$trait_}`", code = E0407)]
114pub(crate) struct MethodNotMemberOfTrait {
115    #[primary_span]
116    #[label("not a member of trait `{$trait_}`")]
117    pub(crate) span: Span,
118    pub(crate) method: Ident,
119    pub(crate) trait_: String,
120    #[subdiagnostic]
121    pub(crate) sub: Option<AssociatedFnWithSimilarNameExists>,
122}
123
124#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for AssociatedFnWithSimilarNameExists
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AssociatedFnWithSimilarNameExists {
                        span: __binding_0, candidate: __binding_1 } => {
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("candidate", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is an associated function with a similar name")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_2, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
125#[suggestion(
126    "there is an associated function with a similar name",
127    code = "{candidate}",
128    applicability = "maybe-incorrect"
129)]
130pub(crate) struct AssociatedFnWithSimilarNameExists {
131    #[primary_span]
132    pub(crate) span: Span,
133    pub(crate) candidate: Symbol,
134}
135
136#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TypeNotMemberOfTrait 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 {
                    TypeNotMemberOfTrait {
                        span: __binding_0,
                        type_: __binding_1,
                        trait_: __binding_2,
                        sub: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type `{$type_}` is not a member of trait `{$trait_}`")));
                        diag.code(E0437);
                        ;
                        diag.arg("type_", __binding_1);
                        diag.arg("trait_", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a member of trait `{$trait_}`")));
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
137#[diag("type `{$type_}` is not a member of trait `{$trait_}`", code = E0437)]
138pub(crate) struct TypeNotMemberOfTrait {
139    #[primary_span]
140    #[label("not a member of trait `{$trait_}`")]
141    pub(crate) span: Span,
142    pub(crate) type_: Ident,
143    pub(crate) trait_: String,
144    #[subdiagnostic]
145    pub(crate) sub: Option<AssociatedTypeWithSimilarNameExists>,
146}
147
148#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            AssociatedTypeWithSimilarNameExists {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AssociatedTypeWithSimilarNameExists {
                        span: __binding_0, candidate: __binding_1 } => {
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("candidate", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is an associated type with a similar name")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_3, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
149#[suggestion(
150    "there is an associated type with a similar name",
151    code = "{candidate}",
152    applicability = "maybe-incorrect"
153)]
154pub(crate) struct AssociatedTypeWithSimilarNameExists {
155    #[primary_span]
156    pub(crate) span: Span,
157    pub(crate) candidate: Symbol,
158}
159
160#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstNotMemberOfTrait 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 {
                    ConstNotMemberOfTrait {
                        span: __binding_0,
                        const_: __binding_1,
                        trait_: __binding_2,
                        sub: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const `{$const_}` is not a member of trait `{$trait_}`")));
                        diag.code(E0438);
                        ;
                        diag.arg("const_", __binding_1);
                        diag.arg("trait_", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a member of trait `{$trait_}`")));
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
161#[diag("const `{$const_}` is not a member of trait `{$trait_}`", code = E0438)]
162pub(crate) struct ConstNotMemberOfTrait {
163    #[primary_span]
164    #[label("not a member of trait `{$trait_}`")]
165    pub(crate) span: Span,
166    pub(crate) const_: Ident,
167    pub(crate) trait_: String,
168    #[subdiagnostic]
169    pub(crate) sub: Option<AssociatedConstWithSimilarNameExists>,
170}
171
172#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            AssociatedConstWithSimilarNameExists {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AssociatedConstWithSimilarNameExists {
                        span: __binding_0, candidate: __binding_1 } => {
                        let __code_4 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("candidate", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is an associated constant with a similar name")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_4, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
173#[suggestion(
174    "there is an associated constant with a similar name",
175    code = "{candidate}",
176    applicability = "maybe-incorrect"
177)]
178pub(crate) struct AssociatedConstWithSimilarNameExists {
179    #[primary_span]
180    pub(crate) span: Span,
181    pub(crate) candidate: Symbol,
182}
183
184#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            VariableBoundWithDifferentMode 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 {
                    VariableBoundWithDifferentMode {
                        span: __binding_0,
                        first_binding_span: __binding_1,
                        variable_name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable `{$variable_name}` is bound inconsistently across alternatives separated by `|`")));
                        diag.code(E0409);
                        ;
                        diag.arg("variable_name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("bound in different ways")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first binding")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
185#[diag("variable `{$variable_name}` is bound inconsistently across alternatives separated by `|`", code = E0409)]
186pub(crate) struct VariableBoundWithDifferentMode {
187    #[primary_span]
188    #[label("bound in different ways")]
189    pub(crate) span: Span,
190    #[label("first binding")]
191    pub(crate) first_binding_span: Span,
192    pub(crate) variable_name: Ident,
193}
194
195#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IdentifierBoundMoreThanOnceInParameterList 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 {
                    IdentifierBoundMoreThanOnceInParameterList {
                        span: __binding_0, identifier: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("identifier `{$identifier}` is bound more than once in this parameter list")));
                        diag.code(E0415);
                        ;
                        diag.arg("identifier", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("used as parameter more than once")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
196#[diag("identifier `{$identifier}` is bound more than once in this parameter list", code = E0415)]
197pub(crate) struct IdentifierBoundMoreThanOnceInParameterList {
198    #[primary_span]
199    #[label("used as parameter more than once")]
200    pub(crate) span: Span,
201    pub(crate) identifier: Ident,
202}
203
204#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IdentifierBoundMoreThanOnceInSamePattern 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 {
                    IdentifierBoundMoreThanOnceInSamePattern {
                        span: __binding_0, identifier: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("identifier `{$identifier}` is bound more than once in the same pattern")));
                        diag.code(E0416);
                        ;
                        diag.arg("identifier", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("used in a pattern more than once")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
205#[diag("identifier `{$identifier}` is bound more than once in the same pattern", code = E0416)]
206pub(crate) struct IdentifierBoundMoreThanOnceInSamePattern {
207    #[primary_span]
208    #[label("used in a pattern more than once")]
209    pub(crate) span: Span,
210    pub(crate) identifier: Ident,
211}
212
213#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UndeclaredLabel 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 {
                    UndeclaredLabel {
                        span: __binding_0,
                        name: __binding_1,
                        sub_reachable: __binding_2,
                        sub_reachable_suggestion: __binding_3,
                        sub_unreachable: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of undeclared label `{$name}`")));
                        diag.code(E0426);
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("undeclared label `{$name}`")));
                        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);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
214#[diag("use of undeclared label `{$name}`", code = E0426)]
215pub(crate) struct UndeclaredLabel {
216    #[primary_span]
217    #[label("undeclared label `{$name}`")]
218    pub(crate) span: Span,
219    pub(crate) name: Symbol,
220    #[subdiagnostic]
221    pub(crate) sub_reachable: Option<LabelWithSimilarNameReachable>,
222    #[subdiagnostic]
223    pub(crate) sub_reachable_suggestion: Option<TryUsingSimilarlyNamedLabel>,
224    #[subdiagnostic]
225    pub(crate) sub_unreachable: Option<UnreachableLabelWithSimilarNameExists>,
226}
227
228#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for LabelWithSimilarNameReachable {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    LabelWithSimilarNameReachable(__binding_0) => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a label with a similar name is reachable")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
229#[label("a label with a similar name is reachable")]
230pub(crate) struct LabelWithSimilarNameReachable(#[primary_span] pub(crate) Span);
231
232#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for TryUsingSimilarlyNamedLabel {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    TryUsingSimilarlyNamedLabel {
                        span: __binding_0, ident_name: __binding_1 } => {
                        let __code_5 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("ident_name", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using similarly named label")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_5, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
233#[suggestion(
234    "try using similarly named label",
235    code = "{ident_name}",
236    applicability = "maybe-incorrect"
237)]
238pub(crate) struct TryUsingSimilarlyNamedLabel {
239    #[primary_span]
240    pub(crate) span: Span,
241    pub(crate) ident_name: Symbol,
242}
243
244#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            UnreachableLabelWithSimilarNameExists {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnreachableLabelWithSimilarNameExists {
                        ident_span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a label with a similar name exists but is unreachable")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
245#[label("a label with a similar name exists but is unreachable")]
246pub(crate) struct UnreachableLabelWithSimilarNameExists {
247    #[primary_span]
248    pub(crate) ident_span: Span,
249}
250
251#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotCaptureDynamicEnvironmentInFnItem 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 {
                    CannotCaptureDynamicEnvironmentInFnItem { span: __binding_0
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't capture dynamic environment in a fn item")));
                        diag.code(E0434);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the `|| {\"{\"} ... {\"}\"}` closure form instead")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
252#[diag("can't capture dynamic environment in a fn item", code = E0434)]
253#[help("use the `|| {\"{\"} ... {\"}\"}` closure form instead")]
254pub(crate) struct CannotCaptureDynamicEnvironmentInFnItem {
255    #[primary_span]
256    pub(crate) span: Span,
257}
258
259#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            AttemptToUseNonConstantValueInConstant<'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 {
                    AttemptToUseNonConstantValueInConstant {
                        span: __binding_0,
                        with: __binding_1,
                        with_label: __binding_2,
                        without: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attempt to use a non-constant value in a constant")));
                        diag.code(E0435);
                        ;
                        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);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
260#[diag("attempt to use a non-constant value in a constant", code = E0435)]
261pub(crate) struct AttemptToUseNonConstantValueInConstant<'a> {
262    #[primary_span]
263    pub(crate) span: Span,
264    #[subdiagnostic]
265    pub(crate) with: Option<AttemptToUseNonConstantValueInConstantWithSuggestion<'a>>,
266    #[subdiagnostic]
267    pub(crate) with_label: Option<AttemptToUseNonConstantValueInConstantLabelWithSuggestion>,
268    #[subdiagnostic]
269    pub(crate) without: Option<AttemptToUseNonConstantValueInConstantWithoutSuggestion<'a>>,
270}
271
272#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            AttemptToUseNonConstantValueInConstantWithSuggestion<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AttemptToUseNonConstantValueInConstantWithSuggestion {
                        span: __binding_0,
                        suggestion: __binding_1,
                        type_span: __binding_2,
                        current: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_6 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0} ", __binding_1))
                                });
                        let __code_7 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(": /* Type */"))
                                });
                        suggestions.push((__binding_0, __code_6));
                        if let Some(__binding_2) = __binding_2 {
                            suggestions.push((__binding_2, __code_7));
                        }
                        diag.store_args();
                        diag.arg("suggestion", __binding_1);
                        diag.arg("current", __binding_3);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using `{$suggestion}` instead of `{$current}`")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
273#[multipart_suggestion(
274    "consider using `{$suggestion}` instead of `{$current}`",
275    style = "verbose",
276    applicability = "has-placeholders"
277)]
278pub(crate) struct AttemptToUseNonConstantValueInConstantWithSuggestion<'a> {
279    // #[primary_span]
280    #[suggestion_part(code = "{suggestion} ")]
281    pub(crate) span: Span,
282    pub(crate) suggestion: &'a str,
283    #[suggestion_part(code = ": /* Type */")]
284    pub(crate) type_span: Option<Span>,
285    pub(crate) current: &'a str,
286}
287
288#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            AttemptToUseNonConstantValueInConstantLabelWithSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AttemptToUseNonConstantValueInConstantLabelWithSuggestion {
                        span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-constant value")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
289#[label("non-constant value")]
290pub(crate) struct AttemptToUseNonConstantValueInConstantLabelWithSuggestion {
291    #[primary_span]
292    pub(crate) span: Span,
293}
294
295#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            AttemptToUseNonConstantValueInConstantWithoutSuggestion<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AttemptToUseNonConstantValueInConstantWithoutSuggestion {
                        ident_span: __binding_0, suggestion: __binding_1 } => {
                        diag.store_args();
                        diag.arg("suggestion", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this would need to be a `{$suggestion}`")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
296#[label("this would need to be a `{$suggestion}`")]
297pub(crate) struct AttemptToUseNonConstantValueInConstantWithoutSuggestion<'a> {
298    #[primary_span]
299    pub(crate) ident_span: Span,
300    pub(crate) suggestion: &'a str,
301}
302
303#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SelfImportsOnlyAllowedWithin 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 {
                    SelfImportsOnlyAllowedWithin {
                        span: __binding_0,
                        suggestion: __binding_1,
                        mpart_suggestion: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`self` imports are only allowed within a {\"{\"} {\"}\"} list")));
                        diag.code(E0429);
                        ;
                        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);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
304#[diag("`self` imports are only allowed within a {\"{\"} {\"}\"} list", code = E0429)]
305pub(crate) struct SelfImportsOnlyAllowedWithin {
306    #[primary_span]
307    pub(crate) span: Span,
308    #[subdiagnostic]
309    pub(crate) suggestion: Option<SelfImportsOnlyAllowedWithinSuggestion>,
310    #[subdiagnostic]
311    pub(crate) mpart_suggestion: Option<SelfImportsOnlyAllowedWithinMultipartSuggestion>,
312}
313
314#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            SelfImportsOnlyAllowedWithinSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    SelfImportsOnlyAllowedWithinSuggestion { span: __binding_0 }
                        => {
                        let __code_8 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider importing the module directly")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_8, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
315#[suggestion(
316    "consider importing the module directly",
317    code = "",
318    applicability = "machine-applicable"
319)]
320pub(crate) struct SelfImportsOnlyAllowedWithinSuggestion {
321    #[primary_span]
322    pub(crate) span: Span,
323}
324
325#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            SelfImportsOnlyAllowedWithinMultipartSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    SelfImportsOnlyAllowedWithinMultipartSuggestion {
                        multipart_start: __binding_0, multipart_end: __binding_1 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_9 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{{"))
                                });
                        let __code_10 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("}}"))
                                });
                        suggestions.push((__binding_0, __code_9));
                        suggestions.push((__binding_1, __code_10));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("alternatively, use the multi-path `use` syntax to import `self`")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
326#[multipart_suggestion(
327    "alternatively, use the multi-path `use` syntax to import `self`",
328    applicability = "machine-applicable"
329)]
330pub(crate) struct SelfImportsOnlyAllowedWithinMultipartSuggestion {
331    #[suggestion_part(code = "{{")]
332    pub(crate) multipart_start: Span,
333    #[suggestion_part(code = "}}")]
334    pub(crate) multipart_end: Span,
335}
336
337#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            BindingShadowsSomethingUnacceptable<'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 {
                    BindingShadowsSomethingUnacceptable {
                        span: __binding_0,
                        shadowing_binding: __binding_1,
                        shadowed_binding: __binding_2,
                        article: __binding_3,
                        sub_suggestion: __binding_4,
                        shadowed_binding_span: __binding_5,
                        participle: __binding_6,
                        name: __binding_7 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$shadowing_binding}s cannot shadow {$shadowed_binding}s")));
                        diag.code(E0530);
                        ;
                        diag.arg("shadowing_binding", __binding_1);
                        diag.arg("shadowed_binding", __binding_2);
                        diag.arg("article", __binding_3);
                        diag.arg("participle", __binding_6);
                        diag.arg("name", __binding_7);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot be named the same as {$article} {$shadowed_binding}")));
                        if let Some(__binding_4) = __binding_4 {
                            diag.subdiagnostic(__binding_4);
                        }
                        diag.span_label(__binding_5,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$shadowed_binding} `{$name}` is {$participle} here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
338#[diag("{$shadowing_binding}s cannot shadow {$shadowed_binding}s", code = E0530)]
339pub(crate) struct BindingShadowsSomethingUnacceptable<'a> {
340    #[primary_span]
341    #[label("cannot be named the same as {$article} {$shadowed_binding}")]
342    pub(crate) span: Span,
343    pub(crate) shadowing_binding: PatternSource,
344    pub(crate) shadowed_binding: Res,
345    pub(crate) article: &'a str,
346    #[subdiagnostic]
347    pub(crate) sub_suggestion: Option<BindingShadowsSomethingUnacceptableSuggestion>,
348    #[label("the {$shadowed_binding} `{$name}` is {$participle} here")]
349    pub(crate) shadowed_binding_span: Span,
350    pub(crate) participle: &'a str,
351    pub(crate) name: Symbol,
352}
353
354#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            BindingShadowsSomethingUnacceptableSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    BindingShadowsSomethingUnacceptableSuggestion {
                        span: __binding_0, name: __binding_1 } => {
                        let __code_11 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}(..)", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("name", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try specify the pattern arguments")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_11, rustc_errors::Applicability::Unspecified,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
355#[suggestion(
356    "try specify the pattern arguments",
357    code = "{name}(..)",
358    applicability = "unspecified"
359)]
360pub(crate) struct BindingShadowsSomethingUnacceptableSuggestion {
361    #[primary_span]
362    pub(crate) span: Span,
363    pub(crate) name: Symbol,
364}
365
366#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ForwardDeclaredGenericParam 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 {
                    ForwardDeclaredGenericParam {
                        span: __binding_0, param: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic parameter defaults cannot reference parameters before they are declared")));
                        diag.code(E0128);
                        ;
                        diag.arg("param", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot reference `{$param}` before it is declared")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
367#[diag("generic parameter defaults cannot reference parameters before they are declared", code = E0128)]
368pub(crate) struct ForwardDeclaredGenericParam {
369    #[primary_span]
370    #[label("cannot reference `{$param}` before it is declared")]
371    pub(crate) span: Span,
372    pub(crate) param: Symbol,
373}
374
375#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ForwardDeclaredGenericInConstParamTy 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 {
                    ForwardDeclaredGenericInConstParamTy {
                        span: __binding_0, param: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const parameter types cannot reference parameters before they are declared")));
                        ;
                        diag.arg("param", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const parameter type cannot reference `{$param}` before it is declared")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
376#[diag("const parameter types cannot reference parameters before they are declared")]
377pub(crate) struct ForwardDeclaredGenericInConstParamTy {
378    #[primary_span]
379    #[label("const parameter type cannot reference `{$param}` before it is declared")]
380    pub(crate) span: Span,
381    pub(crate) param: Symbol,
382}
383
384#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ParamInTyOfConstParam 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 {
                    ParamInTyOfConstParam { span: __binding_0, name: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the type of const parameters must not depend on other generic parameters")));
                        diag.code(E0770);
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the type must not depend on the parameter `{$name}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
385#[diag("the type of const parameters must not depend on other generic parameters", code = E0770)]
386pub(crate) struct ParamInTyOfConstParam {
387    #[primary_span]
388    #[label("the type must not depend on the parameter `{$name}`")]
389    pub(crate) span: Span,
390    pub(crate) name: Symbol,
391}
392
393#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SelfInGenericParamDefault 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 {
                    SelfInGenericParamDefault { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic parameters cannot use `Self` in their defaults")));
                        diag.code(E0735);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
394#[diag("generic parameters cannot use `Self` in their defaults", code = E0735)]
395pub(crate) struct SelfInGenericParamDefault {
396    #[primary_span]
397    pub(crate) span: Span,
398}
399
400#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SelfInConstGenericTy 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 {
                    SelfInConstGenericTy { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot use `Self` in const parameter type")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
401#[diag("cannot use `Self` in const parameter type")]
402pub(crate) struct SelfInConstGenericTy {
403    #[primary_span]
404    pub(crate) span: Span,
405}
406
407#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ParamInNonTrivialAnonConst 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 {
                    ParamInNonTrivialAnonConst {
                        span: __binding_0,
                        name: __binding_1,
                        param_kind: __binding_2,
                        help: __binding_3,
                        is_ogca: __binding_4,
                        help_ogca: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_ogca ->\n    [true] generic parameters in const blocks are only allowed as the direct value of a `type const`\n    *[false] generic parameters may not be used in const operations\n}")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("is_ogca", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot perform const operation using `{$name}`")));
                        diag.subdiagnostic(__binding_2);
                        if __binding_3 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(generic_const_exprs)]` to allow generic const expressions")));
                        }
                        if __binding_5 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider factoring the expression into a `type const` item and use it as the const argument instead")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
408#[diag(
409    "{$is_ogca ->
410    [true] generic parameters in const blocks are only allowed as the direct value of a `type const`
411    *[false] generic parameters may not be used in const operations
412}"
413)]
414pub(crate) struct ParamInNonTrivialAnonConst {
415    #[primary_span]
416    #[label("cannot perform const operation using `{$name}`")]
417    pub(crate) span: Span,
418    pub(crate) name: Symbol,
419    #[subdiagnostic]
420    pub(crate) param_kind: ParamKindInNonTrivialAnonConst,
421    #[help("add `#![feature(generic_const_exprs)]` to allow generic const expressions")]
422    pub(crate) help: bool,
423    pub(crate) is_ogca: bool,
424    #[help(
425        "consider factoring the expression into a `type const` item and use it as the const argument instead"
426    )]
427    pub(crate) help_ogca: bool,
428}
429
430#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ParamKindInNonTrivialAnonConst {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ParamKindInNonTrivialAnonConst::Type =>
                ::core::fmt::Formatter::write_str(f, "Type"),
            ParamKindInNonTrivialAnonConst::Const { name: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
                    "name", &__self_0),
            ParamKindInNonTrivialAnonConst::Lifetime =>
                ::core::fmt::Formatter::write_str(f, "Lifetime"),
        }
    }
}Debug)]
431#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ParamKindInNonTrivialAnonConst {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ParamKindInNonTrivialAnonConst::Type => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameters may not be used in const expressions")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    ParamKindInNonTrivialAnonConst::Const { name: __binding_0 }
                        => {
                        diag.store_args();
                        diag.arg("name", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const parameters may only be used as standalone arguments here, i.e. `{$name}`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                    ParamKindInNonTrivialAnonConst::Lifetime => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime parameters may not be used in const expressions")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
432pub(crate) enum ParamKindInNonTrivialAnonConst {
433    #[note("type parameters may not be used in const expressions")]
434    Type,
435    #[help("const parameters may only be used as standalone arguments here, i.e. `{$name}`")]
436    Const { name: Symbol },
437    #[note("lifetime parameters may not be used in const expressions")]
438    Lifetime,
439}
440
441#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnreachableLabel 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 {
                    UnreachableLabel {
                        span: __binding_0,
                        name: __binding_1,
                        definition_span: __binding_2,
                        sub_suggestion: __binding_3,
                        sub_suggestion_label: __binding_4,
                        sub_unreachable_label: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unreachable label `{$name}`")));
                        diag.code(E0767);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("labels are unreachable through functions, closures, async blocks and modules")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable label `{$name}`")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable label defined here")));
                        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)]
442#[diag("use of unreachable label `{$name}`", code = E0767)]
443#[note("labels are unreachable through functions, closures, async blocks and modules")]
444pub(crate) struct UnreachableLabel {
445    #[primary_span]
446    #[label("unreachable label `{$name}`")]
447    pub(crate) span: Span,
448    pub(crate) name: Symbol,
449    #[label("unreachable label defined here")]
450    pub(crate) definition_span: Span,
451    #[subdiagnostic]
452    pub(crate) sub_suggestion: Option<UnreachableLabelSubSuggestion>,
453    #[subdiagnostic]
454    pub(crate) sub_suggestion_label: Option<UnreachableLabelSubLabel>,
455    #[subdiagnostic]
456    pub(crate) sub_unreachable_label: Option<UnreachableLabelSubLabelUnreachable>,
457}
458
459#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnreachableLabelSubSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnreachableLabelSubSuggestion {
                        span: __binding_0, ident_name: __binding_1 } => {
                        let __code_12 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("ident_name", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using similarly named label")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_12, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
460#[suggestion(
461    "try using similarly named label",
462    code = "{ident_name}",
463    applicability = "maybe-incorrect"
464)]
465pub(crate) struct UnreachableLabelSubSuggestion {
466    #[primary_span]
467    pub(crate) span: Span,
468    pub(crate) ident_name: Symbol,
469}
470
471#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnreachableLabelSubLabel {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnreachableLabelSubLabel { ident_span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a label with a similar name is reachable")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
472#[label("a label with a similar name is reachable")]
473pub(crate) struct UnreachableLabelSubLabel {
474    #[primary_span]
475    pub(crate) ident_span: Span,
476}
477
478#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            UnreachableLabelSubLabelUnreachable {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnreachableLabelSubLabelUnreachable {
                        ident_span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a label with a similar name exists but is also unreachable")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
479#[label("a label with a similar name exists but is also unreachable")]
480pub(crate) struct UnreachableLabelSubLabelUnreachable {
481    #[primary_span]
482    pub(crate) ident_span: Span,
483}
484
485#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for InvalidAsmSym
            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 {
                    InvalidAsmSym { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid `sym` operand")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`sym` operands must refer to either a function or a static")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("is a local variable")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
486#[diag("invalid `sym` operand")]
487#[help("`sym` operands must refer to either a function or a static")]
488pub(crate) struct InvalidAsmSym {
489    #[primary_span]
490    #[label("is a local variable")]
491    pub(crate) span: Span,
492}
493
494#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LowercaseSelf
            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 {
                    LowercaseSelf { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attempt to use a non-constant value in a constant")));
                        let __code_13 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("Self"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using `Self`")),
                            __code_13, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
495#[diag("attempt to use a non-constant value in a constant")]
496pub(crate) struct LowercaseSelf {
497    #[primary_span]
498    #[suggestion(
499        "try using `Self`",
500        code = "Self",
501        applicability = "maybe-incorrect",
502        style = "short"
503    )]
504    pub(crate) span: Span,
505}
506
507#[derive(#[automatically_derived]
impl ::core::fmt::Debug for BindingInNeverPattern {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f,
            "BindingInNeverPattern", "span", &&self.span)
    }
}Debug)]
508#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BindingInNeverPattern 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 {
                    BindingInNeverPattern { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("never patterns cannot contain variable bindings")));
                        let __code_14 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("_"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use a wildcard `_` instead")),
                            __code_14, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
509#[diag("never patterns cannot contain variable bindings")]
510pub(crate) struct BindingInNeverPattern {
511    #[primary_span]
512    #[suggestion(
513        "use a wildcard `_` instead",
514        code = "_",
515        applicability = "machine-applicable",
516        style = "short"
517    )]
518    pub(crate) span: Span,
519}
520
521#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TraitImplDuplicate 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 {
                    TraitImplDuplicate {
                        span: __binding_0,
                        old_span: __binding_1,
                        trait_item_span: __binding_2,
                        name: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate definitions with name `{$name}`:")));
                        diag.code(E0201);
                        ;
                        diag.arg("name", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate definition")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous definition here")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("item in trait")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
522#[diag("duplicate definitions with name `{$name}`:", code = E0201)]
523pub(crate) struct TraitImplDuplicate {
524    #[primary_span]
525    #[label("duplicate definition")]
526    pub(crate) span: Span,
527    #[label("previous definition here")]
528    pub(crate) old_span: Span,
529    #[label("item in trait")]
530    pub(crate) trait_item_span: Span,
531    pub(crate) name: Ident,
532}
533
534#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for Relative2018
            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 {
                    Relative2018 {
                        span: __binding_0,
                        path_span: __binding_1,
                        path_str: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("relative paths are not supported in visibilities in 2018 edition or later")));
                        let __code_15 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("crate::{0}",
                                                        __binding_2))
                                            })].into_iter();
                        ;
                        diag.arg("path_str", __binding_2);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try")),
                            __code_15, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
535#[diag("relative paths are not supported in visibilities in 2018 edition or later")]
536pub(crate) struct Relative2018 {
537    #[primary_span]
538    pub(crate) span: Span,
539    #[suggestion("try", code = "crate::{path_str}", applicability = "maybe-incorrect")]
540    pub(crate) path_span: Span,
541    pub(crate) path_str: String,
542}
543
544#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for AncestorOnly
            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 {
                    AncestorOnly(__binding_0) => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("visibilities can only be restricted to ancestor modules")));
                        diag.code(E0742);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
545#[diag("visibilities can only be restricted to ancestor modules", code = E0742)]
546pub(crate) struct AncestorOnly(#[primary_span] pub(crate) Span);
547
548#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExpectedModuleFound 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 {
                    ExpectedModuleFound {
                        span: __binding_0, res: __binding_1, path_str: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected module, found {$res} `{$path_str}`")));
                        diag.code(E0577);
                        ;
                        diag.arg("res", __binding_1);
                        diag.arg("path_str", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a module")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
549#[diag("expected module, found {$res} `{$path_str}`", code = E0577)]
550pub(crate) struct ExpectedModuleFound {
551    #[primary_span]
552    #[label("not a module")]
553    pub(crate) span: Span,
554    pub(crate) res: Res,
555    pub(crate) path_str: String,
556}
557
558#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for Indeterminate
            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 {
                    Indeterminate(__binding_0) => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot determine resolution for the visibility")));
                        diag.code(E0578);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
559#[diag("cannot determine resolution for the visibility", code = E0578)]
560pub(crate) struct Indeterminate(#[primary_span] pub(crate) Span);
561
562#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ToolModuleImported 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 {
                    ToolModuleImported { span: __binding_0, import: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot use a tool module through an import")));
                        ;
                        diag.span(__binding_0);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the tool module imported here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
563#[diag("cannot use a tool module through an import")]
564pub(crate) struct ToolModuleImported {
565    #[primary_span]
566    pub(crate) span: Span,
567    #[note("the tool module imported here")]
568    pub(crate) import: Span,
569}
570
571#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for ModuleOnly
            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 {
                    ModuleOnly(__binding_0) => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("visibility must resolve to a module")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
572#[diag("visibility must resolve to a module")]
573pub(crate) struct ModuleOnly(#[primary_span] pub(crate) Span);
574
575#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            MacroExpectedFound<'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 {
                    MacroExpectedFound {
                        span: __binding_0,
                        found: __binding_1,
                        article: __binding_2,
                        expected: __binding_3,
                        macro_path: __binding_4,
                        remove_surrounding_derive: __binding_5,
                        add_as_non_derive: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected {$expected}, found {$found} `{$macro_path}`")));
                        ;
                        diag.arg("found", __binding_1);
                        diag.arg("article", __binding_2);
                        diag.arg("expected", __binding_3);
                        diag.arg("macro_path", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not {$article} {$expected}")));
                        if let Some(__binding_5) = __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.subdiagnostic(__binding_6);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
576#[diag("expected {$expected}, found {$found} `{$macro_path}`")]
577pub(crate) struct MacroExpectedFound<'a> {
578    #[primary_span]
579    #[label("not {$article} {$expected}")]
580    pub(crate) span: Span,
581    pub(crate) found: &'a str,
582    pub(crate) article: &'static str,
583    pub(crate) expected: &'a str,
584    pub(crate) macro_path: &'a str,
585    #[subdiagnostic]
586    pub(crate) remove_surrounding_derive: Option<RemoveSurroundingDerive>,
587    #[subdiagnostic]
588    pub(crate) add_as_non_derive: Option<AddAsNonDerive<'a>>,
589}
590
591#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RemoveSurroundingDerive {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    RemoveSurroundingDerive { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove from the surrounding `derive()`")));
                        diag.span_help(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
592#[help("remove from the surrounding `derive()`")]
593pub(crate) struct RemoveSurroundingDerive {
594    #[primary_span]
595    pub(crate) span: Span,
596}
597
598#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for AddAsNonDerive<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AddAsNonDerive { macro_path: __binding_0 } => {
                        diag.store_args();
                        diag.arg("macro_path", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("\n    add as non-Derive macro\n    `#[{$macro_path}]`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
599#[help(
600    "
601    add as non-Derive macro
602    `#[{$macro_path}]`"
603)]
604pub(crate) struct AddAsNonDerive<'a> {
605    pub(crate) macro_path: &'a str,
606}
607
608#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ProcMacroSameCrate 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 {
                    ProcMacroSameCrate { span: __binding_0, is_test: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't use a procedural macro from the same crate that defines it")));
                        ;
                        diag.span(__binding_0);
                        if __binding_1 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you can define integration tests in a directory named `tests`")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
609#[diag("can't use a procedural macro from the same crate that defines it")]
610pub(crate) struct ProcMacroSameCrate {
611    #[primary_span]
612    pub(crate) span: Span,
613    #[help("you can define integration tests in a directory named `tests`")]
614    pub(crate) is_test: bool,
615}
616
617#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            ProcMacroDeriveResolutionFallback {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    ProcMacroDeriveResolutionFallback {
                        span: __binding_0, ns_descr: __binding_1, ident: __binding_2
                        } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot find {$ns_descr} `{$ident}` in this scope")));
                        ;
                        diag.arg("ns_descr", __binding_1);
                        diag.arg("ident", __binding_2);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("names from parent modules are not accessible without an explicit import")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
618#[diag("cannot find {$ns_descr} `{$ident}` in this scope")]
619pub(crate) struct ProcMacroDeriveResolutionFallback {
620    #[label("names from parent modules are not accessible without an explicit import")]
621    pub span: Span,
622    pub ns_descr: &'static str,
623    pub ident: Symbol,
624}
625
626#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            MacroExpandedMacroExportsAccessedByAbsolutePaths {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    MacroExpandedMacroExportsAccessedByAbsolutePaths {
                        definition: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths")));
                        ;
                        diag.span_note(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the macro is defined here")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
627#[diag(
628    "macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths"
629)]
630pub(crate) struct MacroExpandedMacroExportsAccessedByAbsolutePaths {
631    #[note("the macro is defined here")]
632    pub definition: Span,
633}
634
635#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MacroUseExternCrateSelf 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 {
                    MacroUseExternCrateSelf { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[macro_use]` is not supported on `extern crate self`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
636#[diag("`#[macro_use]` is not supported on `extern crate self`")]
637pub(crate) struct MacroUseExternCrateSelf {
638    #[primary_span]
639    pub(crate) span: Span,
640}
641
642#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CfgAccessibleUnsure 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 {
                    CfgAccessibleUnsure { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not sure whether the path is accessible or not")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the type may have associated items, but we are currently not checking them")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
643#[diag("not sure whether the path is accessible or not")]
644#[note("the type may have associated items, but we are currently not checking them")]
645pub(crate) struct CfgAccessibleUnsure {
646    #[primary_span]
647    pub(crate) span: Span,
648}
649
650#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ParamInEnumDiscriminant {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "ParamInEnumDiscriminant", "span", &self.span, "name", &self.name,
            "param_kind", &&self.param_kind)
    }
}Debug)]
651#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ParamInEnumDiscriminant 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 {
                    ParamInEnumDiscriminant {
                        span: __binding_0,
                        name: __binding_1,
                        param_kind: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic parameters may not be used in enum discriminant values")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot perform const operation using `{$name}`")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
652#[diag("generic parameters may not be used in enum discriminant values")]
653pub(crate) struct ParamInEnumDiscriminant {
654    #[primary_span]
655    #[label("cannot perform const operation using `{$name}`")]
656    pub(crate) span: Span,
657    pub(crate) name: Symbol,
658    #[subdiagnostic]
659    pub(crate) param_kind: ParamKindInEnumDiscriminant,
660}
661
662#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ParamKindInEnumDiscriminant {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                ParamKindInEnumDiscriminant::Type => "Type",
                ParamKindInEnumDiscriminant::Const => "Const",
                ParamKindInEnumDiscriminant::Lifetime => "Lifetime",
            })
    }
}Debug)]
663#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ParamKindInEnumDiscriminant {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ParamKindInEnumDiscriminant::Type => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameters may not be used in enum discriminant values")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    ParamKindInEnumDiscriminant::Const => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const parameters may not be used in enum discriminant values")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    ParamKindInEnumDiscriminant::Lifetime => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime parameters may not be used in enum discriminant values")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
664pub(crate) enum ParamKindInEnumDiscriminant {
665    #[note("type parameters may not be used in enum discriminant values")]
666    Type,
667    #[note("const parameters may not be used in enum discriminant values")]
668    Const,
669    #[note("lifetime parameters may not be used in enum discriminant values")]
670    Lifetime,
671}
672
673#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ChangeImportBinding {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ChangeImportBinding { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you can use `as` to change the binding name of the import")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
674#[label("you can use `as` to change the binding name of the import")]
675pub(crate) struct ChangeImportBinding {
676    #[primary_span]
677    pub(crate) span: Span,
678}
679
680#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ChangeImportBindingSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ChangeImportBindingSuggestion {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let __code_16 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("suggestion", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you can use `as` to change the binding name of the import")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_16, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
681#[suggestion(
682    "you can use `as` to change the binding name of the import",
683    code = "{suggestion}",
684    applicability = "maybe-incorrect"
685)]
686pub(crate) struct ChangeImportBindingSuggestion {
687    #[primary_span]
688    pub(crate) span: Span,
689    pub(crate) suggestion: String,
690}
691
692#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ImportsCannotReferTo<'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 {
                    ImportsCannotReferTo { span: __binding_0, what: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("imports cannot refer to {$what}")));
                        ;
                        diag.arg("what", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
693#[diag("imports cannot refer to {$what}")]
694pub(crate) struct ImportsCannotReferTo<'a> {
695    #[primary_span]
696    pub(crate) span: Span,
697    pub(crate) what: &'a str,
698}
699
700#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotFindIdentInThisScope<'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 {
                    CannotFindIdentInThisScope {
                        span: __binding_0, expected: __binding_1, ident: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot find {$expected} `{$ident}` in this scope")));
                        ;
                        diag.arg("expected", __binding_1);
                        diag.arg("ident", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
701#[diag("cannot find {$expected} `{$ident}` in this scope")]
702pub(crate) struct CannotFindIdentInThisScope<'a> {
703    #[primary_span]
704    pub(crate) span: Span,
705    pub(crate) expected: &'a str,
706    pub(crate) ident: Ident,
707}
708
709#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExplicitUnsafeTraits {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ExplicitUnsafeTraits { span: __binding_0, ident: __binding_1
                        } => {
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe traits like `{$ident}` should be implemented explicitly")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
710#[note("unsafe traits like `{$ident}` should be implemented explicitly")]
711pub(crate) struct ExplicitUnsafeTraits {
712    #[primary_span]
713    pub(crate) span: Span,
714    pub(crate) ident: Ident,
715}
716
717#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MacroDefinedLater {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MacroDefinedLater { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a macro with the same name exists, but it appears later")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
718#[note("a macro with the same name exists, but it appears later")]
719pub(crate) struct MacroDefinedLater {
720    #[primary_span]
721    pub(crate) span: Span,
722}
723
724#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MacroSuggMovePosition {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MacroSuggMovePosition {
                        span: __binding_0, ident: __binding_1 } => {
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider moving the definition of `{$ident}` before this call")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
725#[label("consider moving the definition of `{$ident}` before this call")]
726pub(crate) struct MacroSuggMovePosition {
727    #[primary_span]
728    pub(crate) span: Span,
729    pub(crate) ident: Ident,
730}
731
732#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MacroRulesNot {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MacroRulesNot::Func { span: __binding_0, ident: __binding_1
                        } => {
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` exists, but has no rules for function-like invocation")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    MacroRulesNot::Attr { span: __binding_0, ident: __binding_1
                        } => {
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` exists, but has no `attr` rules")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    MacroRulesNot::Derive {
                        span: __binding_0, ident: __binding_1 } => {
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` exists, but has no `derive` rules")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
733pub(crate) enum MacroRulesNot {
734    #[label("`{$ident}` exists, but has no rules for function-like invocation")]
735    Func {
736        #[primary_span]
737        span: Span,
738        ident: Ident,
739    },
740    #[label("`{$ident}` exists, but has no `attr` rules")]
741    Attr {
742        #[primary_span]
743        span: Span,
744        ident: Ident,
745    },
746    #[label("`{$ident}` exists, but has no `derive` rules")]
747    Derive {
748        #[primary_span]
749        span: Span,
750        ident: Ident,
751    },
752}
753
754#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MaybeMissingMacroRulesName {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MaybeMissingMacroRulesName { spans: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("maybe you have forgotten to define a name for this `macro_rules!`")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
755#[note("maybe you have forgotten to define a name for this `macro_rules!`")]
756pub(crate) struct MaybeMissingMacroRulesName {
757    #[primary_span]
758    pub(crate) spans: MultiSpan,
759}
760
761#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for AddedMacroUse {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AddedMacroUse => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("have you added the `#[macro_use]` on the module/import?")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
762#[help("have you added the `#[macro_use]` on the module/import?")]
763pub(crate) struct AddedMacroUse;
764
765#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ConsiderAddingADerive {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ConsiderAddingADerive {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let __code_17 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("suggestion", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider adding a derive")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_17, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
766#[suggestion("consider adding a derive", code = "{suggestion}", applicability = "maybe-incorrect")]
767pub(crate) struct ConsiderAddingADerive {
768    #[primary_span]
769    pub(crate) span: Span,
770    pub(crate) suggestion: String,
771}
772
773#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotDetermineImportResolution 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 {
                    CannotDetermineImportResolution { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot determine resolution for the import")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
774#[diag("cannot determine resolution for the import")]
775pub(crate) struct CannotDetermineImportResolution {
776    #[primary_span]
777    pub(crate) span: Span,
778}
779
780#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotDetermineMacroResolution 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 {
                    CannotDetermineMacroResolution {
                        span: __binding_0, kind: __binding_1, path: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot determine resolution for the {$kind} `{$path}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import resolution is stuck, try simplifying macro imports")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.arg("path", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
781#[diag("cannot determine resolution for the {$kind} `{$path}`")]
782#[note("import resolution is stuck, try simplifying macro imports")]
783pub(crate) struct CannotDetermineMacroResolution {
784    #[primary_span]
785    pub(crate) span: Span,
786    pub(crate) kind: &'static str,
787    pub(crate) path: String,
788}
789
790#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotBeReexportedPrivate 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 {
                    CannotBeReexportedPrivate {
                        span: __binding_0, ident: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` is private, and cannot be re-exported")));
                        diag.code(E0364);
                        ;
                        diag.arg("ident", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
791#[diag("`{$ident}` is private, and cannot be re-exported", code = E0364)]
792pub(crate) struct CannotBeReexportedPrivate {
793    #[primary_span]
794    pub(crate) span: Span,
795    pub(crate) ident: Ident,
796}
797
798#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotBeReexportedCratePublic 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 {
                    CannotBeReexportedCratePublic {
                        span: __binding_0, ident: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` is only public within the crate, and cannot be re-exported outside")));
                        diag.code(E0364);
                        ;
                        diag.arg("ident", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
799#[diag("`{$ident}` is only public within the crate, and cannot be re-exported outside", code = E0364)]
800pub(crate) struct CannotBeReexportedCratePublic {
801    #[primary_span]
802    pub(crate) span: Span,
803    pub(crate) ident: Ident,
804}
805
806#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotBeReexportedPrivateNS 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 {
                    CannotBeReexportedPrivateNS {
                        span: __binding_0, ident: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` is private, and cannot be re-exported")));
                        diag.code(E0365);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider declaring type or module `{$ident}` with `pub`")));
                        ;
                        diag.arg("ident", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("re-export of private `{$ident}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
807#[diag("`{$ident}` is private, and cannot be re-exported", code = E0365)]
808#[note("consider declaring type or module `{$ident}` with `pub`")]
809pub(crate) struct CannotBeReexportedPrivateNS {
810    #[primary_span]
811    #[label("re-export of private `{$ident}`")]
812    pub(crate) span: Span,
813    pub(crate) ident: Ident,
814}
815
816#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotBeReexportedCratePublicNS 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 {
                    CannotBeReexportedCratePublicNS {
                        span: __binding_0, ident: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` is only public within the crate, and cannot be re-exported outside")));
                        diag.code(E0365);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider declaring type or module `{$ident}` with `pub`")));
                        ;
                        diag.arg("ident", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("re-export of crate public `{$ident}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
817#[diag("`{$ident}` is only public within the crate, and cannot be re-exported outside", code = E0365)]
818#[note("consider declaring type or module `{$ident}` with `pub`")]
819pub(crate) struct CannotBeReexportedCratePublicNS {
820    #[primary_span]
821    #[label("re-export of crate public `{$ident}`")]
822    pub(crate) span: Span,
823    pub(crate) ident: Ident,
824}
825
826#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            PrivateExternCrateReexport {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    PrivateExternCrateReexport {
                        ident: __binding_0, sugg: __binding_1 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern crate `{$ident}` is private and cannot be re-exported")));
                        diag.code(E0365);
                        ;
                        let __code_18 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("pub "))
                                            })].into_iter();
                        diag.arg("ident", __binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider making the `extern crate` item publicly accessible")),
                            __code_18, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
827#[diag("extern crate `{$ident}` is private and cannot be re-exported", code = E0365)]
828pub(crate) struct PrivateExternCrateReexport {
829    pub ident: Ident,
830    #[suggestion(
831        "consider making the `extern crate` item publicly accessible",
832        code = "pub ",
833        style = "verbose",
834        applicability = "maybe-incorrect"
835    )]
836    pub sugg: Span,
837}
838
839#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ConsiderAddingMacroExport {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ConsiderAddingMacroExport { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider adding a `#[macro_export]` to the macro in the imported module")));
                        diag.span_help(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
840#[help("consider adding a `#[macro_export]` to the macro in the imported module")]
841pub(crate) struct ConsiderAddingMacroExport {
842    #[primary_span]
843    pub(crate) span: Span,
844}
845
846#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ConsiderMarkingAsPubCrate {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ConsiderMarkingAsPubCrate { vis_span: __binding_0 } => {
                        let __code_19 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("pub(crate)"))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in case you want to use the macro within this crate only, reduce the visibility to `pub(crate)`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_19, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
847#[suggestion(
848    "in case you want to use the macro within this crate only, reduce the visibility to `pub(crate)`",
849    code = "pub(crate)",
850    applicability = "maybe-incorrect"
851)]
852pub(crate) struct ConsiderMarkingAsPubCrate {
853    #[primary_span]
854    pub(crate) vis_span: Span,
855}
856
857#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ConsiderMarkingAsPub {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ConsiderMarkingAsPub { span: __binding_0, ident: __binding_1
                        } => {
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider marking `{$ident}` as `pub` in the imported module")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
858#[note("consider marking `{$ident}` as `pub` in the imported module")]
859pub(crate) struct ConsiderMarkingAsPub {
860    #[primary_span]
861    pub(crate) span: Span,
862    pub(crate) ident: Ident,
863}
864
865#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotGlobImportAllCrates 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 {
                    CannotGlobImportAllCrates { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot glob-import all possible crates")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
866#[diag("cannot glob-import all possible crates")]
867pub(crate) struct CannotGlobImportAllCrates {
868    #[primary_span]
869    pub(crate) span: Span,
870}
871
872#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            UnexpectedResChangeTyToConstParamSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnexpectedResChangeTyToConstParamSugg {
                        span: __binding_0, applicability: __binding_1 } => {
                        let __code_20 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("const "))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might have meant to write a const parameter here")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_20, __binding_1,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
873#[suggestion(
874    "you might have meant to write a const parameter here",
875    code = "const ",
876    style = "verbose"
877)]
878pub(crate) struct UnexpectedResChangeTyToConstParamSugg {
879    #[primary_span]
880    pub span: Span,
881    #[applicability]
882    pub applicability: Applicability,
883}
884
885#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            UnexpectedResChangeTyParamToConstParamSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnexpectedResChangeTyParamToConstParamSugg {
                        before: __binding_0, after: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_21 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("const "))
                                });
                        let __code_22 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(": /* Type */"))
                                });
                        suggestions.push((__binding_0, __code_21));
                        suggestions.push((__binding_1, __code_22));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might have meant to write a const parameter here")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
886#[multipart_suggestion(
887    "you might have meant to write a const parameter here",
888    applicability = "has-placeholders",
889    style = "verbose"
890)]
891pub(crate) struct UnexpectedResChangeTyParamToConstParamSugg {
892    #[suggestion_part(code = "const ")]
893    pub before: Span,
894    #[suggestion_part(code = ": /* Type */")]
895    pub after: Span,
896}
897
898#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            UnexpectedResUseAtOpInSlicePatWithRangeSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnexpectedResUseAtOpInSlicePatWithRangeSugg {
                        span: __binding_0, ident: __binding_1, snippet: __binding_2
                        } => {
                        let __code_23 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        diag.arg("snippet", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you meant to collect the rest of the slice in `{$ident}`, use the at operator")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_23, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
899#[suggestion(
900    "if you meant to collect the rest of the slice in `{$ident}`, use the at operator",
901    code = "{snippet}",
902    applicability = "maybe-incorrect",
903    style = "verbose"
904)]
905pub(crate) struct UnexpectedResUseAtOpInSlicePatWithRangeSugg {
906    #[primary_span]
907    pub span: Span,
908    pub ident: Ident,
909    pub snippet: String,
910}
911
912#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExternCrateLoadingMacroNotAtCrateRoot 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 {
                    ExternCrateLoadingMacroNotAtCrateRoot { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an `extern crate` loading macros must be at the crate root")));
                        diag.code(E0468);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
913#[diag("an `extern crate` loading macros must be at the crate root", code = E0468)]
914pub(crate) struct ExternCrateLoadingMacroNotAtCrateRoot {
915    #[primary_span]
916    pub(crate) span: Span,
917}
918
919#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExternCrateSelfRequiresRenaming 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 {
                    ExternCrateSelfRequiresRenaming { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern crate self;` requires renaming")));
                        let __code_24 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("extern crate self as name;"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rename the `self` crate to be able to import it")),
                            __code_24, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
920#[diag("`extern crate self;` requires renaming")]
921pub(crate) struct ExternCrateSelfRequiresRenaming {
922    #[primary_span]
923    #[suggestion(
924        "rename the `self` crate to be able to import it",
925        code = "extern crate self as name;",
926        applicability = "has-placeholders"
927    )]
928    pub(crate) span: Span,
929}
930
931#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MacroUseNameAlreadyInUse 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 {
                    MacroUseNameAlreadyInUse {
                        span: __binding_0, name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` is already in scope")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560)")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
932#[diag("`{$name}` is already in scope")]
933#[note("macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560)")]
934pub(crate) struct MacroUseNameAlreadyInUse {
935    #[primary_span]
936    pub(crate) span: Span,
937    pub(crate) name: Symbol,
938}
939
940#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ImportedMacroNotFound 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 {
                    ImportedMacroNotFound { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("imported macro not found")));
                        diag.code(E0469);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
941#[diag("imported macro not found", code = E0469)]
942pub(crate) struct ImportedMacroNotFound {
943    #[primary_span]
944    pub(crate) span: Span,
945}
946
947#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MacroExternDeprecated 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 {
                    MacroExternDeprecated {
                        span: __binding_0, inner_attribute: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[macro_escape]` is a deprecated synonym for `#[macro_use]`")));
                        ;
                        diag.span(__binding_0);
                        if __binding_1 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try an outer attribute: `#[macro_use]`")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
948#[diag("`#[macro_escape]` is a deprecated synonym for `#[macro_use]`")]
949pub(crate) struct MacroExternDeprecated {
950    #[primary_span]
951    pub(crate) span: Span,
952    #[help("try an outer attribute: `#[macro_use]`")]
953    pub inner_attribute: bool,
954}
955
956#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ArgumentsMacroUseNotAllowed 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 {
                    ArgumentsMacroUseNotAllowed { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("arguments to `macro_use` are not allowed here")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
957#[diag("arguments to `macro_use` are not allowed here")]
958pub(crate) struct ArgumentsMacroUseNotAllowed {
959    #[primary_span]
960    pub(crate) span: Span,
961}
962
963#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnnamedImportSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnnamedImportSugg { span: __binding_0, ident: __binding_1 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_25 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0} as name",
                                            __binding_1))
                                });
                        suggestions.push((__binding_0, __code_25));
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try renaming it with a name")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
964#[multipart_suggestion(
965    "try renaming it with a name",
966    applicability = "maybe-incorrect",
967    style = "verbose"
968)]
969pub(crate) struct UnnamedImportSugg {
970    #[suggestion_part(code = "{ident} as name")]
971    pub(crate) span: Span,
972    pub(crate) ident: Ident,
973}
974
975#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for UnnamedImport
            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 {
                    UnnamedImport { span: __binding_0, sugg: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("imports need to be explicitly named")));
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
976#[diag("imports need to be explicitly named")]
977pub(crate) struct UnnamedImport {
978    #[primary_span]
979    pub(crate) span: Span,
980    #[subdiagnostic]
981    pub(crate) sugg: Option<UnnamedImportSugg>,
982}
983
984#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MacroExpandedExternCrateCannotShadowExternArguments 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 {
                    MacroExpandedExternCrateCannotShadowExternArguments {
                        span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro-expanded `extern crate` items cannot shadow names passed with `--extern`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
985#[diag("macro-expanded `extern crate` items cannot shadow names passed with `--extern`")]
986pub(crate) struct MacroExpandedExternCrateCannotShadowExternArguments {
987    #[primary_span]
988    pub(crate) span: Span,
989}
990
991#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ElidedAnonymousLifetimeReportError 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 {
                    ElidedAnonymousLifetimeReportError {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`&` without an explicit lifetime name cannot be used here")));
                        diag.code(E0637);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("explicit lifetime name needed here")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
992#[diag("`&` without an explicit lifetime name cannot be used here", code = E0637)]
993pub(crate) struct ElidedAnonymousLifetimeReportError {
994    #[primary_span]
995    #[label("explicit lifetime name needed here")]
996    pub(crate) span: Span,
997    #[subdiagnostic]
998    pub(crate) suggestion: Option<ElidedAnonymousLifetimeReportErrorSuggestion>,
999}
1000
1001#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LendingIteratorReportError 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 {
                    LendingIteratorReportError {
                        lifetime: __binding_0, ty: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated type `Iterator::Item` is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type")));
                        ;
                        diag.span(__binding_0);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1002#[diag(
1003    "associated type `Iterator::Item` is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type"
1004)]
1005pub(crate) struct LendingIteratorReportError {
1006    #[primary_span]
1007    pub(crate) lifetime: Span,
1008    #[note(
1009        "you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type"
1010    )]
1011    pub(crate) ty: Span,
1012}
1013
1014#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AnonymousLifetimeNonGatReportError 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 {
                    AnonymousLifetimeNonGatReportError {
                        lifetime: __binding_0, decl: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing lifetime in associated type")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this lifetime must come from the implemented type")));
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in the trait the associated type is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1015#[diag("missing lifetime in associated type")]
1016pub(crate) struct AnonymousLifetimeNonGatReportError {
1017    #[primary_span]
1018    #[label("this lifetime must come from the implemented type")]
1019    pub(crate) lifetime: Span,
1020    #[note(
1021        "in the trait the associated type is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type"
1022    )]
1023    pub(crate) decl: MultiSpan,
1024}
1025
1026#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            ElidedAnonymousLifetimeReportErrorSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ElidedAnonymousLifetimeReportErrorSuggestion {
                        lo: __binding_0, hi: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_26 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("for<\'a> "))
                                });
                        let __code_27 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("\'a "))
                                });
                        suggestions.push((__binding_0, __code_26));
                        suggestions.push((__binding_1, __code_27));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider introducing a higher-ranked lifetime here")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1027#[multipart_suggestion(
1028    "consider introducing a higher-ranked lifetime here",
1029    applicability = "machine-applicable"
1030)]
1031pub(crate) struct ElidedAnonymousLifetimeReportErrorSuggestion {
1032    #[suggestion_part(code = "for<'a> ")]
1033    pub(crate) lo: Span,
1034    #[suggestion_part(code = "'a ")]
1035    pub(crate) hi: Span,
1036}
1037
1038#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExplicitAnonymousLifetimeReportError 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 {
                    ExplicitAnonymousLifetimeReportError { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`'_` cannot be used here")));
                        diag.code(E0637);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`'_` is a reserved lifetime name")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1039#[diag("`'_` cannot be used here", code = E0637)]
1040pub(crate) struct ExplicitAnonymousLifetimeReportError {
1041    #[primary_span]
1042    #[label("`'_` is a reserved lifetime name")]
1043    pub(crate) span: Span,
1044}
1045
1046#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ImplicitElidedLifetimeNotAllowedHere 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 {
                    ImplicitElidedLifetimeNotAllowedHere {
                        span: __binding_0, subdiag: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implicit elided lifetime not allowed here")));
                        diag.code(E0726);
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1047#[diag("implicit elided lifetime not allowed here", code = E0726)]
1048pub(crate) struct ImplicitElidedLifetimeNotAllowedHere {
1049    #[primary_span]
1050    pub(crate) span: Span,
1051    #[subdiagnostic]
1052    pub(crate) subdiag: ElidedLifetimeInPathSubdiag,
1053}
1054
1055#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnderscoreLifetimeIsReserved 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 {
                    UnderscoreLifetimeIsReserved { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`'_` cannot be used here")));
                        diag.code(E0637);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use another lifetime specifier")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`'_` is a reserved lifetime name")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1056#[diag("`'_` cannot be used here", code = E0637)]
1057#[help("use another lifetime specifier")]
1058pub(crate) struct UnderscoreLifetimeIsReserved {
1059    #[primary_span]
1060    #[label("`'_` is a reserved lifetime name")]
1061    pub(crate) span: Span,
1062}
1063
1064#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            StaticLifetimeIsReserved 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 {
                    StaticLifetimeIsReserved {
                        span: __binding_0, lifetime: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid lifetime parameter name: `{$lifetime}`")));
                        diag.code(E0262);
                        ;
                        diag.arg("lifetime", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("'static is a reserved lifetime name")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1065#[diag("invalid lifetime parameter name: `{$lifetime}`", code = E0262)]
1066pub(crate) struct StaticLifetimeIsReserved {
1067    #[primary_span]
1068    #[label("'static is a reserved lifetime name")]
1069    pub(crate) span: Span,
1070    pub(crate) lifetime: Ident,
1071}
1072
1073#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            VariableIsNotBoundInAllPatterns 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 {
                    VariableIsNotBoundInAllPatterns {
                        multispan: __binding_0, name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable `{$name}` is not bound in all patterns")));
                        diag.code(E0408);
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1074#[diag("variable `{$name}` is not bound in all patterns", code = E0408)]
1075pub(crate) struct VariableIsNotBoundInAllPatterns {
1076    #[primary_span]
1077    pub(crate) multispan: MultiSpan,
1078    pub(crate) name: Ident,
1079}
1080
1081#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for PatternDoesntBindName {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    PatternDoesntBindName { 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("pattern doesn't bind `{$name}`")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic, #[automatically_derived]
impl ::core::fmt::Debug for PatternDoesntBindName {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "PatternDoesntBindName", "span", &self.span, "name", &&self.name)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for PatternDoesntBindName {
    #[inline]
    fn clone(&self) -> PatternDoesntBindName {
        PatternDoesntBindName {
            span: ::core::clone::Clone::clone(&self.span),
            name: ::core::clone::Clone::clone(&self.name),
        }
    }
}Clone)]
1082#[label("pattern doesn't bind `{$name}`")]
1083pub(crate) struct PatternDoesntBindName {
1084    #[primary_span]
1085    pub(crate) span: Span,
1086    pub(crate) name: Ident,
1087}
1088
1089#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for VariableNotInAllPatterns {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    VariableNotInAllPatterns { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variable not in all patterns")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic, #[automatically_derived]
impl ::core::fmt::Debug for VariableNotInAllPatterns {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f,
            "VariableNotInAllPatterns", "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for VariableNotInAllPatterns {
    #[inline]
    fn clone(&self) -> VariableNotInAllPatterns {
        VariableNotInAllPatterns {
            span: ::core::clone::Clone::clone(&self.span),
        }
    }
}Clone)]
1090#[label("variable not in all patterns")]
1091pub(crate) struct VariableNotInAllPatterns {
1092    #[primary_span]
1093    pub(crate) span: Span,
1094}
1095
1096#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for PatternBindingTypo {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    PatternBindingTypo { spans: __binding_0, typo: __binding_1 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_28 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                });
                        for __binding_0 in __binding_0 {
                            suggestions.push((__binding_0, __code_28.clone()));
                        }
                        diag.store_args();
                        diag.arg("typo", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might have meant to use the similarly named previously used binding `{$typo}`")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1097#[multipart_suggestion(
1098    "you might have meant to use the similarly named previously used binding `{$typo}`",
1099    applicability = "maybe-incorrect",
1100    style = "verbose"
1101)]
1102pub(crate) struct PatternBindingTypo {
1103    #[suggestion_part(code = "{typo}")]
1104    pub(crate) spans: Vec<Span>,
1105    pub(crate) typo: Symbol,
1106}
1107
1108#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NameDefinedMultipleTime 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 {
                    NameDefinedMultipleTime {
                        span: __binding_0,
                        name: __binding_1,
                        descr: __binding_2,
                        container: __binding_3,
                        label: __binding_4,
                        old_binding_label: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the name `{$name}` is defined multiple times")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` must be defined only once in the {$descr} namespace of this {$container}")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("descr", __binding_2);
                        diag.arg("container", __binding_3);
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_4);
                        if let Some(__binding_5) = __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1109#[diag("the name `{$name}` is defined multiple times")]
1110#[note("`{$name}` must be defined only once in the {$descr} namespace of this {$container}")]
1111pub(crate) struct NameDefinedMultipleTime {
1112    #[primary_span]
1113    pub(crate) span: Span,
1114    pub(crate) name: Symbol,
1115    pub(crate) descr: &'static str,
1116    pub(crate) container: &'static str,
1117    #[subdiagnostic]
1118    pub(crate) label: NameDefinedMultipleTimeLabel,
1119    #[subdiagnostic]
1120    pub(crate) old_binding_label: Option<NameDefinedMultipleTimeOldBindingLabel>,
1121}
1122
1123#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for NameDefinedMultipleTimeLabel {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    NameDefinedMultipleTimeLabel::Reimported { span: __binding_0
                        } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` reimported here")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    NameDefinedMultipleTimeLabel::Redefined { span: __binding_0
                        } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` redefined here")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1124pub(crate) enum NameDefinedMultipleTimeLabel {
1125    #[label("`{$name}` reimported here")]
1126    Reimported {
1127        #[primary_span]
1128        span: Span,
1129    },
1130    #[label("`{$name}` redefined here")]
1131    Redefined {
1132        #[primary_span]
1133        span: Span,
1134    },
1135}
1136
1137#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            NameDefinedMultipleTimeOldBindingLabel {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    NameDefinedMultipleTimeOldBindingLabel::Import {
                        span: __binding_0, old_kind: __binding_1 } => {
                        diag.store_args();
                        diag.arg("old_kind", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous import of the {$old_kind} `{$name}` here")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    NameDefinedMultipleTimeOldBindingLabel::Definition {
                        span: __binding_0, old_kind: __binding_1 } => {
                        diag.store_args();
                        diag.arg("old_kind", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous definition of the {$old_kind} `{$name}` here")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1138pub(crate) enum NameDefinedMultipleTimeOldBindingLabel {
1139    #[label("previous import of the {$old_kind} `{$name}` here")]
1140    Import {
1141        #[primary_span]
1142        span: Span,
1143        old_kind: &'static str,
1144    },
1145    #[label("previous definition of the {$old_kind} `{$name}` here")]
1146    Definition {
1147        #[primary_span]
1148        span: Span,
1149        old_kind: &'static str,
1150    },
1151}
1152
1153#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            IsPrivate<'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 {
                    IsPrivate {
                        span: __binding_0,
                        ident_descr: __binding_1,
                        ident: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$ident_descr} `{$ident}` is private")));
                        diag.code(E0603);
                        ;
                        diag.arg("ident_descr", __binding_1);
                        diag.arg("ident", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("private {$ident_descr}")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1154#[diag("{$ident_descr} `{$ident}` is private", code = E0603)]
1155pub(crate) struct IsPrivate<'a> {
1156    #[primary_span]
1157    #[label("private {$ident_descr}")]
1158    pub(crate) span: Span,
1159    pub(crate) ident_descr: &'a str,
1160    pub(crate) ident: Ident,
1161}
1162
1163#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            GenericArgumentsInMacroPath 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 {
                    GenericArgumentsInMacroPath { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic arguments in macro path")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1164#[diag("generic arguments in macro path")]
1165pub(crate) struct GenericArgumentsInMacroPath {
1166    #[primary_span]
1167    pub(crate) span: Span,
1168}
1169
1170#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AttributesStartingWithRustcAreReserved 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 {
                    AttributesStartingWithRustcAreReserved { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attributes starting with `rustc` are reserved for use by the `rustc` compiler")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1171#[diag("attributes starting with `rustc` are reserved for use by the `rustc` compiler")]
1172pub(crate) struct AttributesStartingWithRustcAreReserved {
1173    #[primary_span]
1174    pub(crate) span: Span,
1175}
1176
1177#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotUseThroughAnImport 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 {
                    CannotUseThroughAnImport {
                        span: __binding_0,
                        article: __binding_1,
                        descr: __binding_2,
                        binding_span: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot use {$article} {$descr} through an import")));
                        ;
                        diag.arg("article", __binding_1);
                        diag.arg("descr", __binding_2);
                        diag.span(__binding_0);
                        if let Some(__binding_3) = __binding_3 {
                            diag.span_note(__binding_3,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$descr} imported here")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1178#[diag("cannot use {$article} {$descr} through an import")]
1179pub(crate) struct CannotUseThroughAnImport {
1180    #[primary_span]
1181    pub(crate) span: Span,
1182    pub(crate) article: &'static str,
1183    pub(crate) descr: &'static str,
1184    #[note("the {$descr} imported here")]
1185    pub(crate) binding_span: Option<Span>,
1186}
1187
1188#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NameReservedInAttributeNamespace 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 {
                    NameReservedInAttributeNamespace {
                        span: __binding_0, ident: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("name `{$ident}` is reserved in attribute namespace")));
                        ;
                        diag.arg("ident", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1189#[diag("name `{$ident}` is reserved in attribute namespace")]
1190pub(crate) struct NameReservedInAttributeNamespace {
1191    #[primary_span]
1192    pub(crate) span: Span,
1193    pub(crate) ident: Symbol,
1194}
1195
1196#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotFindBuiltinMacroWithName 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 {
                    CannotFindBuiltinMacroWithName {
                        span: __binding_0, ident: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot find a built-in macro with name `{$ident}`")));
                        ;
                        diag.arg("ident", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1197#[diag("cannot find a built-in macro with name `{$ident}`")]
1198pub(crate) struct CannotFindBuiltinMacroWithName {
1199    #[primary_span]
1200    pub(crate) span: Span,
1201    pub(crate) ident: Ident,
1202}
1203
1204#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ToolWasAlreadyRegistered 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 {
                    ToolWasAlreadyRegistered {
                        span: __binding_0,
                        tool: __binding_1,
                        old_ident_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("tool `{$tool}` was already registered")));
                        ;
                        diag.arg("tool", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("already registered here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1205#[diag("tool `{$tool}` was already registered")]
1206pub(crate) struct ToolWasAlreadyRegistered {
1207    #[primary_span]
1208    pub(crate) span: Span,
1209    pub(crate) tool: Ident,
1210    #[label("already registered here")]
1211    pub(crate) old_ident_span: Span,
1212}
1213
1214#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for DefinedHere {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    DefinedHere::SimilarlyNamed {
                        span: __binding_0,
                        candidate_descr: __binding_1,
                        candidate: __binding_2 } => {
                        diag.store_args();
                        diag.arg("candidate_descr", __binding_1);
                        diag.arg("candidate", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("similarly named {$candidate_descr} `{$candidate}` defined here")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    DefinedHere::SingleItem {
                        span: __binding_0,
                        candidate_descr: __binding_1,
                        candidate: __binding_2 } => {
                        diag.store_args();
                        diag.arg("candidate_descr", __binding_1);
                        diag.arg("candidate", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$candidate_descr} `{$candidate}` defined here")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1215pub(crate) enum DefinedHere {
1216    #[label("similarly named {$candidate_descr} `{$candidate}` defined here")]
1217    SimilarlyNamed {
1218        #[primary_span]
1219        span: Span,
1220        candidate_descr: &'static str,
1221        candidate: Symbol,
1222    },
1223    #[label("{$candidate_descr} `{$candidate}` defined here")]
1224    SingleItem {
1225        #[primary_span]
1226        span: Span,
1227        candidate_descr: &'static str,
1228        candidate: Symbol,
1229    },
1230}
1231
1232#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for OuterIdentIsNotPubliclyReexported
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OuterIdentIsNotPubliclyReexported {
                        span: __binding_0,
                        outer_ident_descr: __binding_1,
                        outer_ident: __binding_2 } => {
                        diag.store_args();
                        diag.arg("outer_ident_descr", __binding_1);
                        diag.arg("outer_ident", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$outer_ident_descr} `{$outer_ident}` is not publicly re-exported")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1233#[label("{$outer_ident_descr} `{$outer_ident}` is not publicly re-exported")]
1234pub(crate) struct OuterIdentIsNotPubliclyReexported {
1235    #[primary_span]
1236    pub(crate) span: Span,
1237    pub(crate) outer_ident_descr: &'static str,
1238    pub(crate) outer_ident: Ident,
1239}
1240
1241#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            ConstructorPrivateIfAnyFieldPrivate {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ConstructorPrivateIfAnyFieldPrivate { span: __binding_0 } =>
                        {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a constructor is private if any of the fields is private")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1242#[label("a constructor is private if any of the fields is private")]
1243pub(crate) struct ConstructorPrivateIfAnyFieldPrivate {
1244    #[primary_span]
1245    pub(crate) span: Span,
1246}
1247
1248#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ConsiderMakingTheFieldPublic {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ConsiderMakingTheFieldPublic {
                        spans: __binding_0, number_of_fields: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_29 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("pub "))
                                });
                        for __binding_0 in __binding_0 {
                            suggestions.push((__binding_0, __code_29.clone()));
                        }
                        diag.store_args();
                        diag.arg("number_of_fields", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{ $number_of_fields ->\n        [one] consider making the field publicly accessible\n        *[other] consider making the fields publicly accessible\n    }")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1249#[multipart_suggestion(
1250    "{ $number_of_fields ->
1251        [one] consider making the field publicly accessible
1252        *[other] consider making the fields publicly accessible
1253    }",
1254    applicability = "maybe-incorrect",
1255    style = "verbose"
1256)]
1257pub(crate) struct ConsiderMakingTheFieldPublic {
1258    #[suggestion_part(code = "pub ")]
1259    pub(crate) spans: Vec<Span>,
1260    pub(crate) number_of_fields: usize,
1261}
1262
1263#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ImportIdent {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ImportIdent::ThroughReExport {
                        span: __binding_0, ident: __binding_1, path: __binding_2 }
                        => {
                        let __code_30 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        diag.arg("path", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import `{$ident}` through the re-export")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_30, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    ImportIdent::Directly {
                        span: __binding_0, ident: __binding_1, path: __binding_2 }
                        => {
                        let __code_31 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("ident", __binding_1);
                        diag.arg("path", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import `{$ident}` directly")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_31, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1264pub(crate) enum ImportIdent {
1265    #[suggestion(
1266        "import `{$ident}` through the re-export",
1267        code = "{path}",
1268        applicability = "machine-applicable",
1269        style = "verbose"
1270    )]
1271    ThroughReExport {
1272        #[primary_span]
1273        span: Span,
1274        ident: Ident,
1275        path: String,
1276    },
1277    #[suggestion(
1278        "import `{$ident}` directly",
1279        code = "{path}",
1280        applicability = "machine-applicable",
1281        style = "verbose"
1282    )]
1283    Directly {
1284        #[primary_span]
1285        span: Span,
1286        ident: Ident,
1287        path: String,
1288    },
1289}
1290
1291#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            NoteAndRefersToTheItemDefinedHere<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    NoteAndRefersToTheItemDefinedHere {
                        span: __binding_0,
                        binding_descr: __binding_1,
                        binding_name: __binding_2,
                        first: __binding_3,
                        dots: __binding_4 } => {
                        diag.store_args();
                        diag.arg("binding_descr", __binding_1);
                        diag.arg("binding_name", __binding_2);
                        diag.arg("first", __binding_3);
                        diag.arg("dots", __binding_4);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$first ->\n        [true] {$dots ->\n            [true] the {$binding_descr} `{$binding_name}` is defined here...\n            *[false] the {$binding_descr} `{$binding_name}` is defined here\n        }\n        *[false] {$dots ->\n            [true] ...and refers to the {$binding_descr} `{$binding_name}` which is defined here...\n            *[false] ...and refers to the {$binding_descr} `{$binding_name}` which is defined here\n        }\n    }")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1292#[note(
1293    "{$first ->
1294        [true] {$dots ->
1295            [true] the {$binding_descr} `{$binding_name}` is defined here...
1296            *[false] the {$binding_descr} `{$binding_name}` is defined here
1297        }
1298        *[false] {$dots ->
1299            [true] ...and refers to the {$binding_descr} `{$binding_name}` which is defined here...
1300            *[false] ...and refers to the {$binding_descr} `{$binding_name}` which is defined here
1301        }
1302    }"
1303)]
1304pub(crate) struct NoteAndRefersToTheItemDefinedHere<'a> {
1305    #[primary_span]
1306    pub(crate) span: MultiSpan,
1307    pub(crate) binding_descr: &'a str,
1308    pub(crate) binding_name: Ident,
1309    pub(crate) first: bool,
1310    pub(crate) dots: bool,
1311}
1312
1313#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RemoveUnnecessaryImport {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    RemoveUnnecessaryImport { span: __binding_0 } => {
                        let __code_32 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove unnecessary import")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_32, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1314#[suggestion("remove unnecessary import", code = "", applicability = "maybe-incorrect")]
1315pub(crate) struct RemoveUnnecessaryImport {
1316    #[primary_span]
1317    pub(crate) span: Span,
1318}
1319
1320#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ToolOnlyRemoveUnnecessaryImport {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ToolOnlyRemoveUnnecessaryImport { span: __binding_0 } => {
                        let __code_33 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove unnecessary import")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_33, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1321#[suggestion(
1322    "remove unnecessary import",
1323    code = "",
1324    applicability = "maybe-incorrect",
1325    style = "tool-only"
1326)]
1327pub(crate) struct ToolOnlyRemoveUnnecessaryImport {
1328    #[primary_span]
1329    pub(crate) span: Span,
1330}
1331
1332#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            IdentImporterHereButItIsDesc<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    IdentImporterHereButItIsDesc {
                        span: __binding_0,
                        imported_ident: __binding_1,
                        imported_ident_desc: __binding_2 } => {
                        diag.store_args();
                        diag.arg("imported_ident", __binding_1);
                        diag.arg("imported_ident_desc", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$imported_ident}` is imported here, but it is {$imported_ident_desc}")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1333#[note("`{$imported_ident}` is imported here, but it is {$imported_ident_desc}")]
1334pub(crate) struct IdentImporterHereButItIsDesc<'a> {
1335    #[primary_span]
1336    pub(crate) span: Span,
1337    pub(crate) imported_ident: Ident,
1338    pub(crate) imported_ident_desc: &'a str,
1339}
1340
1341#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for IdentInScopeButItIsDesc<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    IdentInScopeButItIsDesc {
                        imported_ident: __binding_0,
                        imported_ident_desc: __binding_1 } => {
                        diag.store_args();
                        diag.arg("imported_ident", __binding_0);
                        diag.arg("imported_ident_desc", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$imported_ident}` is in scope, but it is {$imported_ident_desc}")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1342#[note("`{$imported_ident}` is in scope, but it is {$imported_ident_desc}")]
1343pub(crate) struct IdentInScopeButItIsDesc<'a> {
1344    pub(crate) imported_ident: Ident,
1345    pub(crate) imported_ident_desc: &'a str,
1346}
1347
1348pub(crate) struct FoundItemConfigureOut {
1349    pub(crate) span: Span,
1350    pub(crate) item_was: ItemWas,
1351}
1352
1353pub(crate) enum ItemWas {
1354    BehindFeature { feature: Symbol, span: Span },
1355    CfgOut { span: Span },
1356}
1357
1358impl Subdiagnostic for FoundItemConfigureOut {
1359    fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
1360        let mut multispan: MultiSpan = self.span.into();
1361        match self.item_was {
1362            ItemWas::BehindFeature { feature, span } => {
1363                let key = "feature".into();
1364                let value = feature.into_diag_arg(&mut None);
1365                let msg = diag.dcx.eagerly_translate_to_string(
1366                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the item is gated behind the `{$feature}` feature"))msg!("the item is gated behind the `{$feature}` feature"),
1367                    [(&key, &value)].into_iter(),
1368                );
1369                multispan.push_span_label(span, msg);
1370            }
1371            ItemWas::CfgOut { span } => {
1372                multispan.push_span_label(span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the item is gated here"))msg!("the item is gated here"));
1373            }
1374        }
1375        diag.span_note(multispan, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found an item that was configured out"))msg!("found an item that was configured out"));
1376    }
1377}
1378
1379#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TraitImplMismatch 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 {
                    TraitImplMismatch {
                        span: __binding_0,
                        name: __binding_1,
                        kind: __binding_2,
                        trait_path: __binding_3,
                        trait_item_span: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("item `{$name}` is an associated {$kind}, which doesn't match its trait `{$trait_path}`")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("kind", __binding_2);
                        diag.arg("trait_path", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("does not match trait")));
                        diag.span_label(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("item in trait")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1380#[diag("item `{$name}` is an associated {$kind}, which doesn't match its trait `{$trait_path}`")]
1381pub(crate) struct TraitImplMismatch {
1382    #[primary_span]
1383    #[label("does not match trait")]
1384    pub(crate) span: Span,
1385    pub(crate) name: Ident,
1386    pub(crate) kind: &'static str,
1387    pub(crate) trait_path: String,
1388    #[label("item in trait")]
1389    pub(crate) trait_item_span: Span,
1390}
1391
1392#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            LegacyDeriveHelpers {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    LegacyDeriveHelpers { span: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("derive helper attribute is used before it is introduced")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the attribute is introduced here")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1393#[diag("derive helper attribute is used before it is introduced")]
1394pub(crate) struct LegacyDeriveHelpers {
1395    #[label("the attribute is introduced here")]
1396    pub span: Span,
1397}
1398
1399#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnusedExternCrate {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedExternCrate {
                        span: __binding_0, removal_span: __binding_1 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused extern crate")));
                        ;
                        let __code_34 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused")));
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the unused `extern crate`")),
                            __code_34, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1400#[diag("unused extern crate")]
1401pub(crate) struct UnusedExternCrate {
1402    #[label("unused")]
1403    pub span: Span,
1404    #[suggestion(
1405        "remove the unused `extern crate`",
1406        code = "",
1407        applicability = "machine-applicable",
1408        style = "verbose"
1409    )]
1410    pub removal_span: Span,
1411}
1412
1413#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            ReexportPrivateDependency {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    ReexportPrivateDependency {
                        name: __binding_0, kind: __binding_1, krate: __binding_2 }
                        => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind} `{$name}` from private dependency '{$krate}' is re-exported")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.arg("kind", __binding_1);
                        diag.arg("krate", __binding_2);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1414#[diag("{$kind} `{$name}` from private dependency '{$krate}' is re-exported")]
1415pub(crate) struct ReexportPrivateDependency {
1416    pub name: Symbol,
1417    pub kind: &'static str,
1418    pub krate: Symbol,
1419}
1420
1421#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for UnusedLabel {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedLabel => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused label")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1422#[diag("unused label")]
1423pub(crate) struct UnusedLabel;
1424
1425#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for UnusedMacroUse {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedMacroUse => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused `#[macro_use]` import")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1426#[diag("unused `#[macro_use]` import")]
1427pub(crate) struct UnusedMacroUse;
1428
1429#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            MacroUseDeprecated {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    MacroUseDeprecated => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("applying the `#[macro_use]` attribute to an `extern crate` item is deprecated")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove it and import macros at use sites with a `use` item instead")));
                        ;
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1430#[diag("applying the `#[macro_use]` attribute to an `extern crate` item is deprecated")]
1431#[help("remove it and import macros at use sites with a `use` item instead")]
1432pub(crate) struct MacroUseDeprecated;
1433
1434#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for MacroIsPrivate {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    MacroIsPrivate { ident: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("macro `{$ident}` is private")));
                        ;
                        diag.arg("ident", __binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1435#[diag("macro `{$ident}` is private")]
1436pub(crate) struct MacroIsPrivate {
1437    pub ident: Ident,
1438}
1439
1440#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnusedMacroDefinition {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnusedMacroDefinition { name: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused macro definition: `{$name}`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1441#[diag("unused macro definition: `{$name}`")]
1442pub(crate) struct UnusedMacroDefinition {
1443    pub name: Symbol,
1444}
1445
1446#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            MacroRuleNeverUsed {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    MacroRuleNeverUsed { n: __binding_0, name: __binding_1 } =>
                        {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rule #{$n} of macro `{$name}` is never used")));
                        ;
                        diag.arg("n", __binding_0);
                        diag.arg("name", __binding_1);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1447#[diag("rule #{$n} of macro `{$name}` is never used")]
1448pub(crate) struct MacroRuleNeverUsed {
1449    pub n: usize,
1450    pub name: Symbol,
1451}
1452
1453pub(crate) struct UnstableFeature {
1454    pub msg: DiagMessage,
1455}
1456
1457impl<'a> LintDiagnostic<'a, ()> for UnstableFeature {
1458    fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) {
1459        diag.primary_message(self.msg);
1460    }
1461}
1462
1463#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            ExternCrateNotIdiomatic {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    ExternCrateNotIdiomatic {
                        span: __binding_0, code: __binding_1 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern crate` is not idiomatic in the new edition")));
                        ;
                        let __code_35 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.arg("code", __binding_1);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert it to a `use`")),
                            __code_35, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1464#[diag("`extern crate` is not idiomatic in the new edition")]
1465pub(crate) struct ExternCrateNotIdiomatic {
1466    #[suggestion(
1467        "convert it to a `use`",
1468        style = "verbose",
1469        code = "{code}",
1470        applicability = "machine-applicable"
1471    )]
1472    pub span: Span,
1473    pub code: &'static str,
1474}
1475
1476#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            OutOfScopeMacroCalls {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    OutOfScopeMacroCalls {
                        span: __binding_0, path: __binding_1, location: __binding_2
                        } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot find macro `{$path}` in the current scope when looking from {$location}")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import `macro_rules` with `use` to make it callable above its definition")));
                        ;
                        diag.arg("path", __binding_1);
                        diag.arg("location", __binding_2);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not found from {$location}")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1477#[diag("cannot find macro `{$path}` in the current scope when looking from {$location}")]
1478#[help("import `macro_rules` with `use` to make it callable above its definition")]
1479pub(crate) struct OutOfScopeMacroCalls {
1480    #[label("not found from {$location}")]
1481    pub span: Span,
1482    pub path: String,
1483    pub location: String,
1484}
1485
1486#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            RedundantImportVisibility {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    RedundantImportVisibility {
                        span: __binding_0,
                        help: __binding_1,
                        import_vis: __binding_2,
                        max_vis: __binding_3 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("glob import doesn't reexport anything with visibility `{$import_vis}` because no imported item is public enough")));
                        ;
                        diag.arg("import_vis", __binding_2);
                        diag.arg("max_vis", __binding_3);
                        diag.span_note(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the most public imported item is `{$max_vis}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reduce the glob import's visibility or increase visibility of imported items")));
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1487#[diag(
1488    "glob import doesn't reexport anything with visibility `{$import_vis}` because no imported item is public enough"
1489)]
1490pub(crate) struct RedundantImportVisibility {
1491    #[note("the most public imported item is `{$max_vis}`")]
1492    pub span: Span,
1493    #[help("reduce the glob import's visibility or increase visibility of imported items")]
1494    pub help: (),
1495    pub import_vis: String,
1496    pub max_vis: String,
1497}
1498
1499#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnknownDiagnosticAttribute {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnknownDiagnosticAttribute { typo: __binding_0 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown diagnostic attribute")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
1500#[diag("unknown diagnostic attribute")]
1501pub(crate) struct UnknownDiagnosticAttribute {
1502    #[subdiagnostic]
1503    pub typo: Option<UnknownDiagnosticAttributeTypoSugg>,
1504}
1505
1506#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            UnknownDiagnosticAttributeTypoSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnknownDiagnosticAttributeTypoSugg {
                        span: __binding_0, typo_name: __binding_1 } => {
                        let __code_36 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("typo_name", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an attribute with a similar name exists")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_36, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1507#[suggestion(
1508    "an attribute with a similar name exists",
1509    style = "verbose",
1510    code = "{typo_name}",
1511    applicability = "machine-applicable"
1512)]
1513pub(crate) struct UnknownDiagnosticAttributeTypoSugg {
1514    #[primary_span]
1515    pub span: Span,
1516    pub typo_name: Symbol,
1517}
1518
1519// FIXME: Make this properly translatable.
1520pub(crate) struct Ambiguity {
1521    pub ident: Ident,
1522    pub ambig_vis: Option<String>,
1523    pub kind: &'static str,
1524    pub help: Option<&'static [&'static str]>,
1525    pub b1_note: Spanned<String>,
1526    pub b1_help_msgs: Vec<String>,
1527    pub b2_note: Spanned<String>,
1528    pub b2_help_msgs: Vec<String>,
1529}
1530
1531impl Ambiguity {
1532    fn decorate<'a>(self, diag: &mut Diag<'a, impl EmissionGuarantee>) {
1533        if let Some(ambig_vis) = self.ambig_vis {
1534            diag.primary_message(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("ambiguous import visibility: {0}",
                ambig_vis))
    })format!("ambiguous import visibility: {ambig_vis}"));
1535        } else {
1536            diag.primary_message(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("`{0}` is ambiguous", self.ident))
    })format!("`{}` is ambiguous", self.ident));
1537            diag.span_label(self.ident.span, "ambiguous name");
1538        }
1539        diag.note(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("ambiguous because of {0}",
                self.kind))
    })format!("ambiguous because of {}", self.kind));
1540        diag.span_note(self.b1_note.span, self.b1_note.node);
1541        if let Some(help) = self.help {
1542            for help in help {
1543                diag.help(*help);
1544            }
1545        }
1546        for help_msg in self.b1_help_msgs {
1547            diag.help(help_msg);
1548        }
1549        diag.span_note(self.b2_note.span, self.b2_note.node);
1550        for help_msg in self.b2_help_msgs {
1551            diag.help(help_msg);
1552        }
1553    }
1554}
1555
1556impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for Ambiguity {
1557    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
1558        let mut diag = Diag::new(dcx, level, "").with_span(self.ident.span).with_code(E0659);
1559        self.decorate(&mut diag);
1560        diag
1561    }
1562}
1563
1564impl<'a> LintDiagnostic<'a, ()> for Ambiguity {
1565    fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) {
1566        self.decorate(diag);
1567    }
1568}