Skip to main content

rustc_resolve/diagnostics/
mod.rs

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