Skip to main content

rustc_ast_passes/
diagnostics.rs

1//! Errors emitted by ast_passes.
2
3use rustc_abi::ExternAbi;
4use rustc_errors::codes::*;
5use rustc_errors::{Applicability, Diag, Subdiagnostic};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_span::{Ident, Span, Symbol};
8
9#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            VisibilityNotPermitted {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    VisibilityNotPermitted {
                        span: __binding_0,
                        note: __binding_1,
                        remove_qualifier_sugg: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("visibility qualifiers are not permitted here")));
                        let __code_0 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.code(E0449);
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag.span_suggestions_with_style(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the qualifier")),
                            __code_0, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
10#[diag("visibility qualifiers are not permitted here", code = E0449)]
11pub(crate) struct VisibilityNotPermitted {
12    #[primary_span]
13    pub span: Span,
14    #[subdiagnostic]
15    pub note: VisibilityNotPermittedNote,
16    #[suggestion("remove the qualifier", code = "", applicability = "machine-applicable")]
17    pub remove_qualifier_sugg: Span,
18}
19
20#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for VisibilityNotPermittedNote {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    VisibilityNotPermittedNote::EnumVariant => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("enum variants and their fields always share the visibility of the enum they are in")),
                                &sub_args);
                        diag.note(__message);
                    }
                    VisibilityNotPermittedNote::TraitImpl => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trait items always share the visibility of their trait")),
                                &sub_args);
                        diag.note(__message);
                    }
                    VisibilityNotPermittedNote::IndividualImplItems => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("place qualifiers on individual impl items instead")),
                                &sub_args);
                        diag.note(__message);
                    }
                    VisibilityNotPermittedNote::IndividualForeignItems => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("place qualifiers on individual foreign items instead")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
21pub(crate) enum VisibilityNotPermittedNote {
22    #[note("enum variants and their fields always share the visibility of the enum they are in")]
23    EnumVariant,
24    #[note("trait items always share the visibility of their trait")]
25    TraitImpl,
26    #[note("place qualifiers on individual impl items instead")]
27    IndividualImplItems,
28    #[note("place qualifiers on individual foreign items instead")]
29    IndividualForeignItems,
30}
31#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ImplFnConst {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ImplFnConst {
                        span: __binding_0, parent_constness: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("redundant `const` fn marker in const impl")));
                        let __code_1 =
                            [::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("remove the `const`")),
                            __code_1, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this declares all associated functions implicitly const")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
32#[diag("redundant `const` fn marker in const impl")]
33pub(crate) struct ImplFnConst {
34    #[primary_span]
35    #[suggestion("remove the `const`", code = "", applicability = "machine-applicable")]
36    pub span: Span,
37    #[label("this declares all associated functions implicitly const")]
38    pub parent_constness: Span,
39}
40
41#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NextSolverDisabledForGenericConstExprs {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NextSolverDisabledForGenericConstExprs { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`feature(generic_const_exprs)` is not supported with the next-generation trait solver")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Znext-solver=globally` is currently enabled by default for testing")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reverted the setting to `-Znext-solver=coherence` for this crate")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the currently stable trait solver will be used for this crate")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
42#[diag("`feature(generic_const_exprs)` is not supported with the next-generation trait solver")]
43#[note("`-Znext-solver=globally` is currently enabled by default for testing")]
44#[note("reverted the setting to `-Znext-solver=coherence` for this crate")]
45#[note("the currently stable trait solver will be used for this crate")]
46#[note("see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information")]
47pub(crate) struct NextSolverDisabledForGenericConstExprs {
48    #[primary_span]
49    pub span: Span,
50}
51
52#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NextSolverDisabledForHigherRankedAssumptions {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NextSolverDisabledForHigherRankedAssumptions => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zhigher-ranked-assumptions` is not supported with the next-generation trait solver")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature flag will be superseded by `-Zassumptions-on-binders`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Znext-solver=globally` is currently enabled by default for testing")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reverted the setting to `-Znext-solver=coherence` for this crate")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the currently stable trait solver will be used for this crate")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
53#[diag("`-Zhigher-ranked-assumptions` is not supported with the next-generation trait solver")]
54#[note("the feature flag will be superseded by `-Zassumptions-on-binders`")]
55#[note("`-Znext-solver=globally` is currently enabled by default for testing")]
56#[note("reverted the setting to `-Znext-solver=coherence` for this crate")]
57#[note("the currently stable trait solver will be used for this crate")]
58#[note("see issues #160895 <https://github.com/rust-lang/rust/issues/160895> for more information")]
59pub(crate) struct NextSolverDisabledForHigherRankedAssumptions;
60
61#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TraitFnConst {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TraitFnConst {
                        span: __binding_0,
                        in_impl: __binding_1,
                        const_context_label: __binding_2,
                        remove_const_sugg: __binding_3,
                        requires_multiple_changes: __binding_4,
                        make_impl_const_sugg: __binding_5,
                        make_trait_const_sugg: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions in {$in_impl ->\n        [true] trait impls\n        *[false] traits\n    } cannot be declared const")));
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("const "))
                                            })].into_iter();
                        let __code_4 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("const "))
                                            })].into_iter();
                        diag.code(E0379);
                        ;
                        diag.arg("in_impl", __binding_1);
                        diag.arg("requires_multiple_changes", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions in {$in_impl ->\n            [true] trait impls\n            *[false] traits\n        } cannot be const")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_label(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this declares all associated functions implicitly const")));
                        }
                        diag.span_suggestions_with_style(__binding_3.0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `const`{$requires_multiple_changes ->\n            [true] {\" ...\"}\n            *[false] {\"\"}\n        }")),
                            __code_2, __binding_3.1,
                            rustc_errors::SuggestionStyle::ShowCode);
                        if let Some(__binding_5) = __binding_5 {
                            diag.span_suggestions_with_style(__binding_5,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("... and declare the impl to be const instead")),
                                __code_3, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.span_suggestions_with_style(__binding_6,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("... and declare the trait to be const instead")),
                                __code_4, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
62#[diag("functions in {$in_impl ->
63        [true] trait impls
64        *[false] traits
65    } cannot be declared const", code = E0379)]
66pub(crate) struct TraitFnConst {
67    #[primary_span]
68    #[label(
69        "functions in {$in_impl ->
70            [true] trait impls
71            *[false] traits
72        } cannot be const"
73    )]
74    pub span: Span,
75    pub in_impl: bool,
76    #[label("this declares all associated functions implicitly const")]
77    pub const_context_label: Option<Span>,
78    #[suggestion(
79        "remove the `const`{$requires_multiple_changes ->
80            [true] {\" ...\"}
81            *[false] {\"\"}
82        }",
83        code = ""
84    )]
85    pub remove_const_sugg: (Span, Applicability),
86    pub requires_multiple_changes: bool,
87    #[suggestion(
88        "... and declare the impl to be const instead",
89        code = "const ",
90        applicability = "maybe-incorrect"
91    )]
92    pub make_impl_const_sugg: Option<Span>,
93    #[suggestion(
94        "... and declare the trait to be const instead",
95        code = "const ",
96        applicability = "maybe-incorrect"
97    )]
98    pub make_trait_const_sugg: Option<Span>,
99}
100
101#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AsyncFnInConstTraitOrTraitImpl {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AsyncFnInConstTraitOrTraitImpl {
                        async_keyword: __binding_0,
                        context: __binding_1,
                        const_keyword: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("async functions are not allowed in `const` {$context ->\n        [trait_impl] trait impls\n        [impl] impls\n        *[trait] traits\n    }")));
                        ;
                        diag.arg("context", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated functions of `const` cannot be declared `async`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
102#[diag(
103    "async functions are not allowed in `const` {$context ->
104        [trait_impl] trait impls
105        [impl] impls
106        *[trait] traits
107    }"
108)]
109pub(crate) struct AsyncFnInConstTraitOrTraitImpl {
110    #[primary_span]
111    pub async_keyword: Span,
112    pub context: &'static str,
113    #[label("associated functions of `const` cannot be declared `async`")]
114    pub const_keyword: Span,
115}
116
117#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ForbiddenBound {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ForbiddenBound { spans: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("bounds cannot be used in this context")));
                        ;
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
118#[diag("bounds cannot be used in this context")]
119pub(crate) struct ForbiddenBound {
120    #[primary_span]
121    pub spans: Vec<Span>,
122}
123
124#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ForbiddenConstParam
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ForbiddenConstParam { const_param_spans: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("late-bound const parameters cannot be used currently")));
                        ;
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
125#[diag("late-bound const parameters cannot be used currently")]
126pub(crate) struct ForbiddenConstParam {
127    #[primary_span]
128    pub const_param_spans: Vec<Span>,
129}
130
131#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnParamTooMany {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FnParamTooMany {
                        span: __binding_0, max_num_args: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function can not have more than {$max_num_args} arguments")));
                        ;
                        diag.arg("max_num_args", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
132#[diag("function can not have more than {$max_num_args} arguments")]
133pub(crate) struct FnParamTooMany {
134    #[primary_span]
135    pub span: Span,
136    pub max_num_args: usize,
137}
138
139#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            FnParamCVarArgsNotLast {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FnParamCVarArgsNotLast { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` must be the last argument of a C-variadic function")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
140#[diag("`...` must be the last argument of a C-variadic function")]
141pub(crate) struct FnParamCVarArgsNotLast {
142    #[primary_span]
143    pub span: Span,
144}
145
146#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidSplattedArgs
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidSplattedArgs {
                        max_valid_splatted_arg_index: __binding_0,
                        first_invalid_splatted_arg_index: __binding_1,
                        spans: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_splat]` is only supported on argument index {$max_valid_splatted_arg_index} or less, this `#[rustc_splat]` is on index {$first_invalid_splatted_arg_index}")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]`, or use it on an argument closer to the start of the argument list")));
                        ;
                        diag.arg("max_valid_splatted_arg_index", __binding_0);
                        diag.arg("first_invalid_splatted_arg_index", __binding_1);
                        diag.span(__binding_2.clone());
                        for __binding_2 in __binding_2 {
                            diag.span_label(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_splat]` is not supported here")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
147#[diag(
148    "`#[rustc_splat]` is only supported on argument index {$max_valid_splatted_arg_index} or less, this `#[rustc_splat]` is on index {$first_invalid_splatted_arg_index}"
149)]
150#[help(
151    "remove `#[rustc_splat]`, or use it on an argument closer to the start of the argument list"
152)]
153pub(crate) struct InvalidSplattedArgs {
154    pub max_valid_splatted_arg_index: u16,
155
156    pub first_invalid_splatted_arg_index: u16,
157
158    #[primary_span]
159    #[label("`#[rustc_splat]` is not supported here")]
160    pub spans: Vec<Span>,
161}
162
163#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DuplicateSplattedArgs {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DuplicateSplattedArgs { spans: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `#[rustc_splat]`s are not allowed in the same function argument list")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]` from all but one argument")));
                        ;
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
164#[diag("multiple `#[rustc_splat]`s are not allowed in the same function argument list")]
165#[help("remove `#[rustc_splat]` from all but one argument")]
166pub(crate) struct DuplicateSplattedArgs {
167    #[primary_span]
168    pub spans: Vec<Span>,
169}
170
171#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for CVarArgsAndSplat {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CVarArgsAndSplat { spans: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` and `#[rustc_splat]` are not allowed in the same function argument list")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]` or remove `...`")));
                        ;
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
172#[diag("`...` and `#[rustc_splat]` are not allowed in the same function argument list")]
173#[help("remove `#[rustc_splat]` or remove `...`")]
174pub(crate) struct CVarArgsAndSplat {
175    #[primary_span]
176    pub spans: Vec<Span>,
177}
178
179#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            SplatNotAllowedOnClosures {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SplatNotAllowedOnClosures { spans: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_splat]` is not allowed on closure arguments")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]` or turn the closure into a function")));
                        ;
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
180#[diag("`#[rustc_splat]` is not allowed on closure arguments")]
181#[help("remove `#[rustc_splat]` or turn the closure into a function")]
182pub(crate) struct SplatNotAllowedOnClosures {
183    #[primary_span]
184    pub spans: Vec<Span>,
185}
186
187#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            SplatNotAllowedOnAbiCall {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SplatNotAllowedOnAbiCall {
                        spans: __binding_0, abi: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_splat]` is not allowed in the arguments of functions with the `{$abi}` ABI")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `#[rustc_splat]` or change the ABI")));
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
188#[diag("`#[rustc_splat]` is not allowed in the arguments of functions with the `{$abi}` ABI")]
189#[help("remove `#[rustc_splat]` or change the ABI")]
190pub(crate) struct SplatNotAllowedOnAbiCall {
191    #[primary_span]
192    pub spans: Vec<Span>,
193    pub abi: Symbol,
194}
195
196#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnParamDocComment {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FnParamDocComment { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("documentation comments cannot be applied to function parameters")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("doc comments are not allowed here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
197#[diag("documentation comments cannot be applied to function parameters")]
198pub(crate) struct FnParamDocComment {
199    #[primary_span]
200    #[label("doc comments are not allowed here")]
201    pub span: Span,
202}
203
204// FIXME(splat): add splat to the allowed built-in attributes when it is complete/stabilized
205#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnParamForbiddenAttr
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FnParamForbiddenAttr { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
206#[diag(
207    "allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters"
208)]
209pub(crate) struct FnParamForbiddenAttr {
210    #[primary_span]
211    pub span: Span,
212}
213
214#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            EiiImplAttributeNotSupported<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EiiImplAttributeNotSupported {
                        attr_span: __binding_0,
                        attr_name: __binding_1,
                        eii_name: __binding_2,
                        eii_span: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$eii_name}]` is not allowed to have `#[{$attr_name}]`")));
                        ;
                        diag.arg("attr_name", __binding_1);
                        diag.arg("eii_name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$eii_name}]` is not allowed to have `#[{$attr_name}]`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
215#[diag("`#[{$eii_name}]` is not allowed to have `#[{$attr_name}]`")]
216pub(crate) struct EiiImplAttributeNotSupported<'a> {
217    #[primary_span]
218    pub attr_span: Span,
219    pub attr_name: &'a str,
220    pub eii_name: String,
221    #[label("`#[{$eii_name}]` is not allowed to have `#[{$attr_name}]`")]
222    pub eii_span: Span,
223}
224
225#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnParamForbiddenSelf
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FnParamForbiddenSelf { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`self` parameter is only allowed in associated functions")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated functions are those in `impl` or `trait` definitions")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not semantically valid as function parameter")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
226#[diag("`self` parameter is only allowed in associated functions")]
227#[note("associated functions are those in `impl` or `trait` definitions")]
228pub(crate) struct FnParamForbiddenSelf {
229    #[primary_span]
230    #[label("not semantically valid as function parameter")]
231    pub span: Span,
232}
233
234#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidConstParam {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidConstParam { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const` parameter is only allowed in free/trait/impl functions")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not semantically valid as function parameter")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
235#[diag("`const` parameter is only allowed in free/trait/impl functions")]
236pub(crate) struct InvalidConstParam {
237    #[primary_span]
238    #[label("not semantically valid as function parameter")]
239    pub span: Span,
240}
241
242#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ForbiddenDefault {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ForbiddenDefault { span: __binding_0, def_span: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`default` is only allowed on items in trait impls")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`default` because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
243#[diag("`default` is only allowed on items in trait impls")]
244pub(crate) struct ForbiddenDefault {
245    #[primary_span]
246    pub span: Span,
247    #[label("`default` because of this")]
248    pub def_span: Span,
249}
250
251#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ForbiddenFinal {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ForbiddenFinal { span: __binding_0, def_span: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`final` is only allowed on associated functions in traits")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`final` because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
252#[diag("`final` is only allowed on associated functions in traits")]
253pub(crate) struct ForbiddenFinal {
254    #[primary_span]
255    pub span: Span,
256    #[label("`final` because of this")]
257    pub def_span: Span,
258}
259
260#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ForbiddenFinalWithoutBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ForbiddenFinalWithoutBody {
                        span: __binding_0, def_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`final` is only allowed on associated functions if they have a body")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`final` because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
261#[diag("`final` is only allowed on associated functions if they have a body")]
262pub(crate) struct ForbiddenFinalWithoutBody {
263    #[primary_span]
264    pub span: Span,
265    #[label("`final` because of this")]
266    pub def_span: Span,
267}
268
269#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AssocConstWithoutBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AssocConstWithoutBody {
                        span: __binding_0, replace_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated constant in `impl` without body")));
                        let __code_5 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" = <expr>;"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the constant")),
                            __code_5, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
270#[diag("associated constant in `impl` without body")]
271pub(crate) struct AssocConstWithoutBody {
272    #[primary_span]
273    pub span: Span,
274    #[suggestion(
275        "provide a definition for the constant",
276        code = " = <expr>;",
277        applicability = "has-placeholders"
278    )]
279    pub replace_span: Span,
280}
281
282#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AssocFnWithoutBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AssocFnWithoutBody {
                        span: __binding_0, replace_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated function in `impl` without body")));
                        let __code_6 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" {{ <body> }}"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the function")),
                            __code_6, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
283#[diag("associated function in `impl` without body")]
284pub(crate) struct AssocFnWithoutBody {
285    #[primary_span]
286    pub span: Span,
287    #[suggestion(
288        "provide a definition for the function",
289        code = " {{ <body> }}",
290        applicability = "has-placeholders"
291    )]
292    pub replace_span: Span,
293}
294
295#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AssocTypeWithoutBody
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AssocTypeWithoutBody {
                        span: __binding_0, replace_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated type in `impl` without body")));
                        let __code_7 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" = <type>;"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the type")),
                            __code_7, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
296#[diag("associated type in `impl` without body")]
297pub(crate) struct AssocTypeWithoutBody {
298    #[primary_span]
299    pub span: Span,
300    #[suggestion(
301        "provide a definition for the type",
302        code = " = <type>;",
303        applicability = "has-placeholders"
304    )]
305    pub replace_span: Span,
306}
307
308#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConstWithoutBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ConstWithoutBody {
                        span: __binding_0, replace_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("free constant item without body")));
                        let __code_8 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" = <expr>;"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the constant")),
                            __code_8, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
309#[diag("free constant item without body")]
310pub(crate) struct ConstWithoutBody {
311    #[primary_span]
312    pub span: Span,
313    #[suggestion(
314        "provide a definition for the constant",
315        code = " = <expr>;",
316        applicability = "has-placeholders"
317    )]
318    pub replace_span: Span,
319}
320
321#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for StaticWithoutBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    StaticWithoutBody {
                        span: __binding_0, replace_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("free static item without body")));
                        let __code_9 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" = <expr>;"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the static")),
                            __code_9, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
322#[diag("free static item without body")]
323pub(crate) struct StaticWithoutBody {
324    #[primary_span]
325    pub span: Span,
326    #[suggestion(
327        "provide a definition for the static",
328        code = " = <expr>;",
329        applicability = "has-placeholders"
330    )]
331    pub replace_span: Span,
332}
333
334#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TyAliasWithoutBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TyAliasWithoutBody {
                        span: __binding_0, replace_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("free type alias without body")));
                        let __code_10 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" = <type>;"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the type")),
                            __code_10, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
335#[diag("free type alias without body")]
336pub(crate) struct TyAliasWithoutBody {
337    #[primary_span]
338    pub span: Span,
339    #[suggestion(
340        "provide a definition for the type",
341        code = " = <type>;",
342        applicability = "has-placeholders"
343    )]
344    pub replace_span: Span,
345}
346
347#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnWithoutBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FnWithoutBody {
                        span: __binding_0,
                        replace_span: __binding_1,
                        extern_block_suggestion: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("free function without a body")));
                        let __code_11 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" {{ <body> }}"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("provide a definition for the function")),
                            __code_11, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
348#[diag("free function without a body")]
349pub(crate) struct FnWithoutBody {
350    #[primary_span]
351    pub span: Span,
352    #[suggestion(
353        "provide a definition for the function",
354        code = " {{ <body> }}",
355        applicability = "has-placeholders"
356    )]
357    pub replace_span: Span,
358    #[subdiagnostic]
359    pub extern_block_suggestion: Option<ExternBlockSuggestion>,
360}
361
362#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExternBlockSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ExternBlockSuggestion::Implicit {
                        start_span: __binding_0, end_span: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_12 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("extern {{"))
                                });
                        let __code_13 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" }}"))
                                });
                        suggestions.push((__binding_0, __code_12));
                        suggestions.push((__binding_1, __code_13));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you meant to declare an externally defined function, use an `extern` block")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    ExternBlockSuggestion::Explicit {
                        start_span: __binding_0,
                        end_span: __binding_1,
                        abi: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_14 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("extern \"{0}\" {{",
                                            __binding_2))
                                });
                        let __code_15 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" }}"))
                                });
                        suggestions.push((__binding_0, __code_14));
                        suggestions.push((__binding_1, __code_15));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you meant to declare an externally defined function, use an `extern` block")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
363pub(crate) enum ExternBlockSuggestion {
364    #[multipart_suggestion(
365        "if you meant to declare an externally defined function, use an `extern` block",
366        applicability = "maybe-incorrect"
367    )]
368    Implicit {
369        #[suggestion_part(code = "extern {{")]
370        start_span: Span,
371        #[suggestion_part(code = " }}")]
372        end_span: Span,
373    },
374    #[multipart_suggestion(
375        "if you meant to declare an externally defined function, use an `extern` block",
376        applicability = "maybe-incorrect"
377    )]
378    Explicit {
379        #[suggestion_part(code = "extern \"{abi}\" {{")]
380        start_span: Span,
381        #[suggestion_part(code = " }}")]
382        end_span: Span,
383        abi: Symbol,
384    },
385}
386
387#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidSafetyOnExtern {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidSafetyOnExtern {
                        item_span: __binding_0, block: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items in `extern` blocks without an `unsafe` qualifier cannot have safety qualifiers")));
                        let __code_16 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("unsafe "))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_suggestions_with_style(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `unsafe` to this `extern` block")),
                                __code_16, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowAlways);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
388#[diag("items in `extern` blocks without an `unsafe` qualifier cannot have safety qualifiers")]
389pub(crate) struct InvalidSafetyOnExtern {
390    #[primary_span]
391    pub item_span: Span,
392    #[suggestion(
393        "add `unsafe` to this `extern` block",
394        code = "unsafe ",
395        applicability = "machine-applicable",
396        style = "verbose"
397    )]
398    pub block: Option<Span>,
399}
400
401#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidSafetyOnItem
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidSafetyOnItem { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items outside of `unsafe extern {\"{ }\"}` cannot be declared with `safe` safety qualifier")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
402#[diag(
403    "items outside of `unsafe extern {\"{ }\"}` cannot be declared with `safe` safety qualifier"
404)]
405pub(crate) struct InvalidSafetyOnItem {
406    #[primary_span]
407    pub span: Span,
408}
409
410#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidSafetyOnFnPtr
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidSafetyOnFnPtr {
                        span: __binding_0, safe_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function pointers cannot be declared with `safe` safety qualifier")));
                        let __code_17 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `safe` qualifier")),
                            __code_17, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
411#[diag("function pointers cannot be declared with `safe` safety qualifier")]
412pub(crate) struct InvalidSafetyOnFnPtr {
413    #[primary_span]
414    pub span: Span,
415    #[suggestion(
416        "remove the `safe` qualifier",
417        code = "",
418        applicability = "machine-applicable",
419        style = "verbose"
420    )]
421    pub safe_span: Span,
422}
423
424#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsafeStatic {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsafeStatic { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("static items cannot be declared with `unsafe` safety qualifier outside of `extern` block")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
425#[diag("static items cannot be declared with `unsafe` safety qualifier outside of `extern` block")]
426pub(crate) struct UnsafeStatic {
427    #[primary_span]
428    pub span: Span,
429}
430
431#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            BoundInContext<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BoundInContext { span: __binding_0, ctx: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("bounds on `type`s in {$ctx} have no effect")));
                        ;
                        diag.arg("ctx", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
432#[diag("bounds on `type`s in {$ctx} have no effect")]
433pub(crate) struct BoundInContext<'a> {
434    #[primary_span]
435    pub span: Span,
436    pub ctx: &'a str,
437}
438
439#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ExternTypesCannotHave<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExternTypesCannotHave {
                        span: __binding_0,
                        descr: __binding_1,
                        remove_descr: __binding_2,
                        block_span: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`type`s inside `extern` blocks cannot have {$descr}")));
                        let __code_18 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.arg("remove_descr", __binding_2);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the {$remove_descr}")),
                            __code_18, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` block begins here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
440#[diag("`type`s inside `extern` blocks cannot have {$descr}")]
441#[note("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")]
442pub(crate) struct ExternTypesCannotHave<'a> {
443    #[primary_span]
444    #[suggestion("remove the {$remove_descr}", code = "", applicability = "maybe-incorrect")]
445    pub span: Span,
446    pub descr: &'a str,
447    pub remove_descr: &'a str,
448    #[label("`extern` block begins here")]
449    pub block_span: Span,
450}
451
452#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for BodyInExtern<'a>
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BodyInExtern {
                        span: __binding_0,
                        body: __binding_1,
                        block: __binding_2,
                        kind: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect `{$kind}` inside `extern` block")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")));
                        ;
                        diag.arg("kind", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot have a body")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the invalid body")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` blocks define existing foreign {$kind}s and {$kind}s inside of them cannot have a body")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
453#[diag("incorrect `{$kind}` inside `extern` block")]
454#[note("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")]
455pub(crate) struct BodyInExtern<'a> {
456    #[primary_span]
457    #[label("cannot have a body")]
458    pub span: Span,
459    #[label("the invalid body")]
460    pub body: Span,
461    #[label(
462        "`extern` blocks define existing foreign {$kind}s and {$kind}s inside of them cannot have a body"
463    )]
464    pub block: Span,
465    pub kind: &'a str,
466}
467
468#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnBodyInExtern {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FnBodyInExtern {
                        span: __binding_0, body: __binding_1, block: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect function inside `extern` block")));
                        let __code_19 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(";"))
                                            })].into_iter();
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot have a body")));
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the invalid body")),
                            __code_19, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` blocks define existing foreign functions and functions inside of them cannot have a body")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
469#[diag("incorrect function inside `extern` block")]
470#[help(
471    "you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block"
472)]
473#[note("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html")]
474pub(crate) struct FnBodyInExtern {
475    #[primary_span]
476    #[label("cannot have a body")]
477    pub span: Span,
478    #[suggestion("remove the invalid body", code = ";", applicability = "maybe-incorrect")]
479    pub body: Span,
480    #[label(
481        "`extern` blocks define existing foreign functions and functions inside of them cannot have a body"
482    )]
483    pub block: Span,
484}
485
486#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FnQualifierInExtern
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FnQualifierInExtern {
                        span: __binding_0, block: __binding_1, kw: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions in `extern` blocks cannot have `{$kw}` qualifier")));
                        let __code_20 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("kw", __binding_2);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `{$kw}` qualifier")),
                            __code_20, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in this `extern` block")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
487#[diag("functions in `extern` blocks cannot have `{$kw}` qualifier")]
488pub(crate) struct FnQualifierInExtern {
489    #[primary_span]
490    #[suggestion("remove the `{$kw}` qualifier", code = "", applicability = "maybe-incorrect")]
491    pub span: Span,
492    #[label("in this `extern` block")]
493    pub block: Span,
494    pub kw: &'static str,
495}
496
497#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExternItemAscii {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExternItemAscii { span: __binding_0, block: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items in `extern` blocks cannot use non-ascii identifiers")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in this `extern` block")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
498#[diag("items in `extern` blocks cannot use non-ascii identifiers")]
499#[note(
500    "this limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information"
501)]
502pub(crate) struct ExternItemAscii {
503    #[primary_span]
504    pub span: Span,
505    #[label("in this `extern` block")]
506    pub block: Span,
507}
508
509#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for CVariadicNoExtern {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CVariadicNoExtern { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` is not supported for non-extern functions")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `extern \"C\"` and `extern \"C-unwind\"` functions may have a C variable argument list")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
510#[diag("`...` is not supported for non-extern functions")]
511#[help(
512    "only `extern \"C\"` and `extern \"C-unwind\"` functions may have a C variable argument list"
513)]
514pub(crate) struct CVariadicNoExtern {
515    #[primary_span]
516    pub span: Span,
517}
518
519#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CVariadicMustBeUnsafe {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CVariadicMustBeUnsafe {
                        span: __binding_0, unsafe_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with a C variable argument list must be unsafe")));
                        let __code_21 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("unsafe "))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add the `unsafe` keyword to this definition")),
                            __code_21, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
520#[diag("functions with a C variable argument list must be unsafe")]
521pub(crate) struct CVariadicMustBeUnsafe {
522    #[primary_span]
523    pub span: Span,
524
525    #[suggestion(
526        "add the `unsafe` keyword to this definition",
527        applicability = "maybe-incorrect",
528        code = "unsafe ",
529        style = "verbose"
530    )]
531    pub unsafe_span: Span,
532}
533
534#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for CVariadicBadExtern {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CVariadicBadExtern {
                        span: __binding_0,
                        abi: __binding_1,
                        extern_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` is not supported for `extern \"{$abi}\"` functions")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `extern \"C\"` and `extern \"C-unwind\"` functions may have a C variable argument list")));
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern \"{$abi}\"` because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
535#[diag("`...` is not supported for `extern \"{$abi}\"` functions")]
536#[help(
537    "only `extern \"C\"` and `extern \"C-unwind\"` functions may have a C variable argument list"
538)]
539pub(crate) struct CVariadicBadExtern {
540    #[primary_span]
541    pub span: Span,
542    pub abi: &'static str,
543    #[label("`extern \"{$abi}\"` because of this")]
544    pub extern_span: Span,
545}
546
547#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CVariadicBadNakedExtern {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CVariadicBadNakedExtern {
                        span: __binding_0,
                        abi: __binding_1,
                        extern_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`...` is not supported for `extern \"{$abi}\"` naked functions")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("C-variadic function must have a compatible calling convention")));
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern \"{$abi}\"` because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
548#[diag("`...` is not supported for `extern \"{$abi}\"` naked functions")]
549#[help("C-variadic function must have a compatible calling convention")]
550pub(crate) struct CVariadicBadNakedExtern {
551    #[primary_span]
552    pub span: Span,
553    pub abi: &'static str,
554    #[label("`extern \"{$abi}\"` because of this")]
555    pub extern_span: Span,
556}
557
558#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            ItemUnderscore<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ItemUnderscore { span: __binding_0, kind: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$kind}` items in this context need a name")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`_` is not a valid name for this `{$kind}` item")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
559#[diag("`{$kind}` items in this context need a name")]
560pub(crate) struct ItemUnderscore<'a> {
561    #[primary_span]
562    #[label("`_` is not a valid name for this `{$kind}` item")]
563    pub span: Span,
564    pub kind: &'a str,
565}
566
567#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NoMangleAscii {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NoMangleAscii { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[no_mangle]` requires ASCII identifier")));
                        diag.code(E0754);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
568#[diag("`#[no_mangle]` requires ASCII identifier", code = E0754)]
569pub(crate) struct NoMangleAscii {
570    #[primary_span]
571    pub span: Span,
572}
573
574#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ModuleNonAscii {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ModuleNonAscii { span: __binding_0, name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trying to load file for module `{$name}` with non-ascii identifier name")));
                        diag.code(E0754);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using the `#[path]` attribute to specify filesystem path")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
575#[diag("trying to load file for module `{$name}` with non-ascii identifier name", code = E0754)]
576#[help("consider using the `#[path]` attribute to specify filesystem path")]
577pub(crate) struct ModuleNonAscii {
578    #[primary_span]
579    pub span: Span,
580    pub name: Symbol,
581}
582
583#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AutoTraitGeneric {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AutoTraitGeneric { span: __binding_0, ident: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have generic parameters")));
                        let __code_22 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.code(E0567);
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the parameters")),
                            __code_22, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto trait cannot have generic parameters")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
584#[diag("auto traits cannot have generic parameters", code = E0567)]
585pub(crate) struct AutoTraitGeneric {
586    #[primary_span]
587    #[suggestion(
588        "remove the parameters",
589        code = "",
590        applicability = "machine-applicable",
591        style = "tool-only"
592    )]
593    pub span: Span,
594    #[label("auto trait cannot have generic parameters")]
595    pub ident: Span,
596}
597
598#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AutoTraitBounds {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AutoTraitBounds {
                        span: __binding_0, removal: __binding_1, ident: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have super traits or lifetime bounds")));
                        let __code_23 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.code(E0568);
                        ;
                        diag.span(__binding_0.clone());
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the super traits or lifetime bounds")),
                            __code_23, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have super traits or lifetime bounds")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
599#[diag("auto traits cannot have super traits or lifetime bounds", code = E0568)]
600pub(crate) struct AutoTraitBounds {
601    #[primary_span]
602    pub span: Vec<Span>,
603    #[suggestion(
604        "remove the super traits or lifetime bounds",
605        code = "",
606        applicability = "machine-applicable",
607        style = "tool-only"
608    )]
609    pub removal: Span,
610    #[label("auto traits cannot have super traits or lifetime bounds")]
611    pub ident: Span,
612}
613
614#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AutoTraitItems {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AutoTraitItems {
                        spans: __binding_0, total: __binding_1, ident: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have associated items")));
                        let __code_24 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.code(E0380);
                        ;
                        diag.span(__binding_0.clone());
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the associated items")),
                            __code_24, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot have associated items")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
615#[diag("auto traits cannot have associated items", code = E0380)]
616pub(crate) struct AutoTraitItems {
617    #[primary_span]
618    pub spans: Vec<Span>,
619    #[suggestion(
620        "remove the associated items",
621        code = "",
622        applicability = "machine-applicable",
623        style = "tool-only"
624    )]
625    pub total: Span,
626    #[label("auto traits cannot have associated items")]
627    pub ident: Span,
628}
629
630#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConstAutoTrait {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ConstAutoTrait { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("auto traits cannot be const")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `const` keyword")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
631#[diag("auto traits cannot be const")]
632#[help("remove the `const` keyword")]
633pub(crate) struct ConstAutoTrait {
634    #[primary_span]
635    pub span: Span,
636}
637
638#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ArgsBeforeConstraint
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ArgsBeforeConstraint {
                        arg_spans: __binding_0,
                        constraints: __binding_1,
                        args: __binding_2,
                        data: __binding_3,
                        suggestion: __binding_4,
                        constraint_len: __binding_5,
                        args_len: __binding_6,
                        constraint_spans: __binding_7,
                        arg_spans2: __binding_8 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic arguments must come before the first constraint")));
                        let __code_25 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_4))
                                            })].into_iter();
                        ;
                        diag.arg("constraint_len", __binding_5);
                        diag.arg("args_len", __binding_6);
                        diag.span(__binding_0.clone());
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$constraint_len ->\n            [one] constraint\n            *[other] constraints\n        }")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic {$args_len ->\n            [one] argument\n            *[other] arguments\n        }")));
                        diag.span_suggestions_with_style(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move the {$constraint_len ->\n            [one] constraint\n            *[other] constraints\n        } after the generic {$args_len ->\n            [one] argument\n            *[other] arguments\n        }")),
                            __code_25, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.subdiagnostic(__binding_7);
                        diag.subdiagnostic(__binding_8);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
639#[diag("generic arguments must come before the first constraint")]
640pub(crate) struct ArgsBeforeConstraint {
641    #[primary_span]
642    pub arg_spans: Vec<Span>,
643    #[label(
644        "{$constraint_len ->
645            [one] constraint
646            *[other] constraints
647        }"
648    )]
649    pub constraints: Span,
650    #[label(
651        "generic {$args_len ->
652            [one] argument
653            *[other] arguments
654        }"
655    )]
656    pub args: Span,
657    #[suggestion(
658        "move the {$constraint_len ->
659            [one] constraint
660            *[other] constraints
661        } after the generic {$args_len ->
662            [one] argument
663            *[other] arguments
664        }",
665        code = "{suggestion}",
666        applicability = "machine-applicable",
667        style = "verbose"
668    )]
669    pub data: Span,
670    pub suggestion: String,
671    pub constraint_len: usize,
672    pub args_len: usize,
673    #[subdiagnostic]
674    pub constraint_spans: EmptyLabelManySpans,
675    #[subdiagnostic]
676    pub arg_spans2: EmptyLabelManySpans,
677}
678
679pub(crate) struct EmptyLabelManySpans(pub Vec<Span>);
680
681// The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each
682impl Subdiagnostic for EmptyLabelManySpans {
683    fn add_to_diag(self, diag: &mut Diag<'_>) {
684        diag.span_labels(self.0, "");
685    }
686}
687
688#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for PatternFnPointer {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    PatternFnPointer { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in function pointer types")));
                        diag.code(E0561);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
689#[diag("patterns aren't allowed in function pointer types", code = E0561)]
690pub(crate) struct PatternFnPointer {
691    #[primary_span]
692    pub span: Span,
693}
694
695#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            PatternParenthesizedArgList {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    PatternParenthesizedArgList { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in parenthesized argument lists")));
                        diag.code(E0561);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
696#[diag("patterns aren't allowed in parenthesized argument lists", code = E0561)]
697pub(crate) struct PatternParenthesizedArgList {
698    #[primary_span]
699    pub span: Span,
700}
701
702#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TraitObjectBound {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TraitObjectBound { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only a single explicit lifetime bound is permitted")));
                        diag.code(E0226);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
703#[diag("only a single explicit lifetime bound is permitted", code = E0226)]
704pub(crate) struct TraitObjectBound {
705    #[primary_span]
706    pub span: Span,
707}
708
709#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NestedImplTrait {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NestedImplTrait {
                        span: __binding_0, outer: __binding_1, inner: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nested `impl Trait` is not allowed")));
                        diag.code(E0666);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("outer `impl Trait`")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nested `impl Trait` here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
710#[diag("nested `impl Trait` is not allowed", code = E0666)]
711pub(crate) struct NestedImplTrait {
712    #[primary_span]
713    pub span: Span,
714    #[label("outer `impl Trait`")]
715    pub outer: Span,
716    #[label("nested `impl Trait` here")]
717    pub inner: Span,
718}
719
720#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AtLeastOneTrait {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AtLeastOneTrait { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("at least one trait must be specified")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
721#[diag("at least one trait must be specified")]
722pub(crate) struct AtLeastOneTrait {
723    #[primary_span]
724    pub span: Span,
725}
726
727#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            OutOfOrderParams<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OutOfOrderParams {
                        spans: __binding_0,
                        sugg_span: __binding_1,
                        param_ord: __binding_2,
                        max_param: __binding_3,
                        ordered_params: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$param_ord} parameters must be declared prior to {$max_param} parameters")));
                        let __code_26 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_4))
                                            })].into_iter();
                        ;
                        diag.arg("param_ord", __binding_2);
                        diag.arg("max_param", __binding_3);
                        diag.span(__binding_0.clone());
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reorder the parameters: lifetimes, then consts and types")),
                            __code_26, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
728#[diag("{$param_ord} parameters must be declared prior to {$max_param} parameters")]
729pub(crate) struct OutOfOrderParams<'a> {
730    #[primary_span]
731    pub spans: Vec<Span>,
732    #[suggestion(
733        "reorder the parameters: lifetimes, then consts and types",
734        code = "{ordered_params}",
735        applicability = "machine-applicable"
736    )]
737    pub sugg_span: Span,
738    pub param_ord: String,
739    pub max_param: String,
740    pub ordered_params: &'a str,
741}
742
743#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ObsoleteAuto {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ObsoleteAuto { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait for .. {\"{}\"}` is an obsolete syntax")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `auto trait Trait {\"{}\"}` instead")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
744#[diag("`impl Trait for .. {\"{}\"}` is an obsolete syntax")]
745#[help("use `auto trait Trait {\"{}\"}` instead")]
746pub(crate) struct ObsoleteAuto {
747    #[primary_span]
748    pub span: Span,
749}
750
751#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsafeNegativeImpl {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsafeNegativeImpl {
                        span: __binding_0,
                        negative: __binding_1,
                        r#unsafe: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative impls cannot be unsafe")));
                        diag.code(E0198);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative because of this")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
752#[diag("negative impls cannot be unsafe", code = E0198)]
753pub(crate) struct UnsafeNegativeImpl {
754    #[primary_span]
755    pub span: Span,
756    #[label("negative because of this")]
757    pub negative: Span,
758    #[label("unsafe because of this")]
759    pub r#unsafe: Span,
760}
761
762#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsafeItem {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsafeItem { span: __binding_0, kind: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind} cannot be declared unsafe")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
763#[diag("{$kind} cannot be declared unsafe")]
764pub(crate) struct UnsafeItem {
765    #[primary_span]
766    pub span: Span,
767    pub kind: &'static str,
768}
769
770#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MissingUnsafeOnExtern {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingUnsafeOnExtern {
                        span: __binding_0, unsafe_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern blocks must be unsafe")));
                        let __code_27 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("unsafe "))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("needs `unsafe` before the extern keyword")),
                            __code_27, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
771#[diag("extern blocks must be unsafe")]
772pub(crate) struct MissingUnsafeOnExtern {
773    #[primary_span]
774    pub span: Span,
775
776    #[suggestion(
777        "needs `unsafe` before the extern keyword",
778        code = "unsafe ",
779        applicability = "machine-applicable"
780    )]
781    pub unsafe_span: Span,
782}
783
784#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MissingUnsafeOnExternLint {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingUnsafeOnExternLint { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern blocks should be unsafe")));
                        let __code_28 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("unsafe "))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("needs `unsafe` before the extern keyword")),
                            __code_28, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
785#[diag("extern blocks should be unsafe")]
786pub(crate) struct MissingUnsafeOnExternLint {
787    #[suggestion(
788        "needs `unsafe` before the extern keyword",
789        code = "unsafe ",
790        applicability = "machine-applicable"
791    )]
792    pub suggestion: Span,
793}
794
795#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FieldlessUnion {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FieldlessUnion { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unions cannot have zero fields")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
796#[diag("unions cannot have zero fields")]
797pub(crate) struct FieldlessUnion {
798    #[primary_span]
799    pub span: Span,
800}
801
802#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            WhereClauseAfterTypeAlias {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    WhereClauseAfterTypeAlias {
                        span: __binding_0, help: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("where clauses are not allowed after the type for type aliases")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information")));
                        ;
                        diag.span(__binding_0);
                        if __binding_1 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(checked_type_aliases)]` to the crate attributes to enable")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
803#[diag("where clauses are not allowed after the type for type aliases")]
804#[note("see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information")]
805pub(crate) struct WhereClauseAfterTypeAlias {
806    #[primary_span]
807    pub span: Span,
808    #[help("add `#![feature(checked_type_aliases)]` to the crate attributes to enable")]
809    pub help: bool,
810}
811
812#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            WhereClauseBeforeTypeAlias {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    WhereClauseBeforeTypeAlias {
                        span: __binding_0, sugg: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("where clauses are not allowed before the type for type aliases")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
813#[diag("where clauses are not allowed before the type for type aliases")]
814#[note("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")]
815pub(crate) struct WhereClauseBeforeTypeAlias {
816    #[primary_span]
817    pub span: Span,
818    #[subdiagnostic]
819    pub sugg: WhereClauseBeforeTypeAliasSugg,
820}
821
822#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for WhereClauseBeforeTypeAliasSugg {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    WhereClauseBeforeTypeAliasSugg::Remove { span: __binding_0 }
                        => {
                        let __code_29 =
                            [::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 this `where`")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_29, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    WhereClauseBeforeTypeAliasSugg::Move {
                        left: __binding_0, snippet: __binding_1, right: __binding_2
                        } => {
                        let mut suggestions = Vec::new();
                        let __code_30 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        let __code_31 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                });
                        suggestions.push((__binding_0, __code_30));
                        suggestions.push((__binding_2, __code_31));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move it to the end of the type declaration")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
823pub(crate) enum WhereClauseBeforeTypeAliasSugg {
824    #[suggestion("remove this `where`", applicability = "machine-applicable", code = "")]
825    Remove {
826        #[primary_span]
827        span: Span,
828    },
829    #[multipart_suggestion(
830        "move it to the end of the type declaration",
831        applicability = "machine-applicable",
832        style = "verbose"
833    )]
834    Move {
835        #[suggestion_part(code = "")]
836        left: Span,
837        snippet: String,
838        #[suggestion_part(code = "{snippet}")]
839        right: Span,
840    },
841}
842
843#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            GenericDefaultTrailing {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    GenericDefaultTrailing { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic parameters with a default must be trailing")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
844#[diag("generic parameters with a default must be trailing")]
845pub(crate) struct GenericDefaultTrailing {
846    #[primary_span]
847    pub span: Span,
848}
849
850#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NestedLifetimes {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NestedLifetimes { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nested quantification of lifetimes")));
                        diag.code(E0316);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
851#[diag("nested quantification of lifetimes", code = E0316)]
852pub(crate) struct NestedLifetimes {
853    #[primary_span]
854    pub span: Span,
855}
856
857#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ConstBoundTraitObject {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ConstBoundTraitObject { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const trait bounds are not allowed in trait object types")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
858#[diag("const trait bounds are not allowed in trait object types")]
859pub(crate) struct ConstBoundTraitObject {
860    #[primary_span]
861    pub span: Span,
862}
863
864// FIXME(const_trait_impl): Consider making the note/reason the message of the diagnostic.
865// FIXME(const_trait_impl): Provide structured suggestions (e.g., add `const` here).
866#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for TildeConstDisallowed
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TildeConstDisallowed {
                        span: __binding_0, reason: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`[const]` is not allowed here")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
867#[diag("`[const]` is not allowed here")]
868pub(crate) struct TildeConstDisallowed {
869    #[primary_span]
870    pub span: Span,
871    #[subdiagnostic]
872    pub reason: TildeConstReason,
873}
874
875#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for TildeConstReason {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    TildeConstReason::Closure => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("closures cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.note(__message);
                    }
                    TildeConstReason::Function { ident: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function is not `const`, so it cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::Trait { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this trait is not `const`, so it cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::TraitImpl { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this impl is not `const`, so it cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::Impl { 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("inherent impls cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::TraitAssocTy { 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("associated types in non-`const` traits cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::TraitImplAssocTy { 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("associated types in non-const impls cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::InherentAssocTy { 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("inherent associated types cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::Struct { 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("structs cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::Enum { 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("enums cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::Union { 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("unions cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::AnonConst { 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("anonymous constants cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                    TildeConstReason::TraitObject => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trait objects cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.note(__message);
                    }
                    TildeConstReason::Item => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this item cannot have `[const]` trait bounds")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic, #[automatically_derived]
impl ::core::marker::Copy for TildeConstReason { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for TildeConstReason { }
#[automatically_derived]
impl ::core::clone::Clone for TildeConstReason {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone)]
876pub(crate) enum TildeConstReason {
877    #[note("closures cannot have `[const]` trait bounds")]
878    Closure,
879    #[note("this function is not `const`, so it cannot have `[const]` trait bounds")]
880    Function {
881        #[primary_span]
882        ident: Span,
883    },
884    #[note("this trait is not `const`, so it cannot have `[const]` trait bounds")]
885    Trait {
886        #[primary_span]
887        span: Span,
888    },
889    #[note("this impl is not `const`, so it cannot have `[const]` trait bounds")]
890    TraitImpl {
891        #[primary_span]
892        span: Span,
893    },
894    #[note("inherent impls cannot have `[const]` trait bounds")]
895    Impl {
896        #[primary_span]
897        span: Span,
898    },
899    #[note("associated types in non-`const` traits cannot have `[const]` trait bounds")]
900    TraitAssocTy {
901        #[primary_span]
902        span: Span,
903    },
904    #[note("associated types in non-const impls cannot have `[const]` trait bounds")]
905    TraitImplAssocTy {
906        #[primary_span]
907        span: Span,
908    },
909    #[note("inherent associated types cannot have `[const]` trait bounds")]
910    InherentAssocTy {
911        #[primary_span]
912        span: Span,
913    },
914    #[note("structs cannot have `[const]` trait bounds")]
915    Struct {
916        #[primary_span]
917        span: Span,
918    },
919    #[note("enums cannot have `[const]` trait bounds")]
920    Enum {
921        #[primary_span]
922        span: Span,
923    },
924    #[note("unions cannot have `[const]` trait bounds")]
925    Union {
926        #[primary_span]
927        span: Span,
928    },
929    #[note("anonymous constants cannot have `[const]` trait bounds")]
930    AnonConst {
931        #[primary_span]
932        span: Span,
933    },
934    #[note("trait objects cannot have `[const]` trait bounds")]
935    TraitObject,
936    #[note("this item cannot have `[const]` trait bounds")]
937    Item,
938}
939
940#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ConstAndCoroutine {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ConstAndCoroutine {
                        spans: __binding_0,
                        const_span: __binding_1,
                        coroutine_span: __binding_2,
                        span: __binding_3,
                        coroutine_kind: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions cannot be both `const` and `{$coroutine_kind}`")));
                        ;
                        diag.arg("coroutine_kind", __binding_4);
                        diag.span(__binding_0.clone());
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const` because of this")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$coroutine_kind}` because of this")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{\"\"}")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
941#[diag("functions cannot be both `const` and `{$coroutine_kind}`")]
942pub(crate) struct ConstAndCoroutine {
943    #[primary_span]
944    pub spans: Vec<Span>,
945    #[label("`const` because of this")]
946    pub const_span: Span,
947    #[label("`{$coroutine_kind}` because of this")]
948    pub coroutine_span: Span,
949    #[label("{\"\"}")]
950    pub span: Span,
951    pub coroutine_kind: &'static str,
952}
953
954#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CoroutineAndCVariadic {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CoroutineAndCVariadic {
                        spans: __binding_0,
                        coroutine_kind: __binding_1,
                        coroutine_span: __binding_2,
                        variadic_span: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions cannot be both `{$coroutine_kind}` and C-variadic")));
                        ;
                        diag.arg("coroutine_kind", __binding_1);
                        diag.span(__binding_0.clone());
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$coroutine_kind}` because of this")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("C-variadic because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
955#[diag("functions cannot be both `{$coroutine_kind}` and C-variadic")]
956pub(crate) struct CoroutineAndCVariadic {
957    #[primary_span]
958    pub spans: Vec<Span>,
959    pub coroutine_kind: &'static str,
960    #[label("`{$coroutine_kind}` because of this")]
961    pub coroutine_span: Span,
962    #[label("C-variadic because of this")]
963    pub variadic_span: Span,
964}
965
966#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            CVariadicNotSupported<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CVariadicNotSupported {
                        variadic_span: __binding_0, target: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$target}` target does not support c-variadic functions")));
                        ;
                        diag.arg("target", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
967#[diag("the `{$target}` target does not support c-variadic functions")]
968pub(crate) struct CVariadicNotSupported<'a> {
969    #[primary_span]
970    pub variadic_span: Span,
971    pub target: &'a str,
972}
973
974#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for PatternInForeign {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    PatternInForeign { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in foreign function declarations")));
                        diag.code(E0130);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("pattern not allowed in foreign function")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
975#[diag("patterns aren't allowed in foreign function declarations", code = E0130)]
976// FIXME: deduplicate with rustc_lint (`BuiltinLintDiag::PatternsInFnsWithoutBody`)
977pub(crate) struct PatternInForeign {
978    #[primary_span]
979    #[label("pattern not allowed in foreign function")]
980    pub span: Span,
981}
982
983#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for PatternInBodiless {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    PatternInBodiless { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in functions without bodies")));
                        diag.code(E0642);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("pattern not allowed in function without body")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
984#[diag("patterns aren't allowed in functions without bodies", code = E0642)]
985// FIXME: deduplicate with rustc_lint (`BuiltinLintDiag::PatternsInFnsWithoutBody`)
986pub(crate) struct PatternInBodiless {
987    #[primary_span]
988    #[label("pattern not allowed in function without body")]
989    pub span: Span,
990}
991
992#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FeatureOnNonNightly
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FeatureOnNonNightly {
                        span: __binding_0,
                        channel: __binding_1,
                        stable_features: __binding_2,
                        sugg: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![feature]` may not be used on the {$channel} release channel")));
                        let __code_32 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.code(E0554);
                        ;
                        diag.arg("channel", __binding_1);
                        diag.span(__binding_0);
                        for __binding_2 in __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        if let Some(__binding_3) = __binding_3 {
                            diag.span_suggestions_with_style(__binding_3,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
                                __code_32, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowCode);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
993#[diag("`#![feature]` may not be used on the {$channel} release channel", code = E0554)]
994pub(crate) struct FeatureOnNonNightly {
995    #[primary_span]
996    pub span: Span,
997    pub channel: &'static str,
998    #[subdiagnostic]
999    pub stable_features: Vec<StableFeature>,
1000    #[suggestion("remove the attribute", code = "", applicability = "machine-applicable")]
1001    pub sugg: Option<Span>,
1002}
1003
1004#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for StableFeature {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    StableFeature { name: __binding_0, since: __binding_1 } => {
                        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));
                        sub_args.insert("since".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 feature `{$name}` has been stable since `{$since}` and no longer requires an attribute to enable")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1005#[help(
1006    "the feature `{$name}` has been stable since `{$since}` and no longer requires an attribute to enable"
1007)]
1008pub(crate) struct StableFeature {
1009    pub name: Symbol,
1010    pub since: Symbol,
1011}
1012
1013#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for IncompatibleFeatures
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    IncompatibleFeatures {
                        spans: __binding_0, f1: __binding_1, f2: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$f1}` and `{$f2}` are incompatible, using them at the same time is not allowed")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove one of these features")));
                        ;
                        diag.arg("f1", __binding_1);
                        diag.arg("f2", __binding_2);
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1014#[diag("`{$f1}` and `{$f2}` are incompatible, using them at the same time is not allowed")]
1015#[help("remove one of these features")]
1016pub(crate) struct IncompatibleFeatures {
1017    #[primary_span]
1018    pub spans: Vec<Span>,
1019    pub f1: Symbol,
1020    pub f2: Symbol,
1021}
1022
1023#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MissingDependentFeatures {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingDependentFeatures {
                        parent_span: __binding_0,
                        parent: __binding_1,
                        missing: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$parent}` requires {$missing} to be enabled")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("enable all of these features")));
                        ;
                        diag.arg("parent", __binding_1);
                        diag.arg("missing", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1024#[diag("`{$parent}` requires {$missing} to be enabled")]
1025#[help("enable all of these features")]
1026pub(crate) struct MissingDependentFeatures {
1027    #[primary_span]
1028    pub parent_span: Span,
1029    pub parent: Symbol,
1030    pub missing: String,
1031}
1032
1033#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NegativeBoundUnsupported {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NegativeBoundUnsupported { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative bounds are not supported")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1034#[diag("negative bounds are not supported")]
1035pub(crate) struct NegativeBoundUnsupported {
1036    #[primary_span]
1037    pub span: Span,
1038}
1039
1040#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ConstraintOnNegativeBound {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ConstraintOnNegativeBound { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated type constraints not allowed on negative bounds")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1041#[diag("associated type constraints not allowed on negative bounds")]
1042pub(crate) struct ConstraintOnNegativeBound {
1043    #[primary_span]
1044    pub span: Span,
1045}
1046
1047#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NegativeBoundWithParentheticalNotation {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NegativeBoundWithParentheticalNotation { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parenthetical notation may not be used for negative bounds")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1048#[diag("parenthetical notation may not be used for negative bounds")]
1049pub(crate) struct NegativeBoundWithParentheticalNotation {
1050    #[primary_span]
1051    pub span: Span,
1052}
1053
1054#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MatchArmWithNoBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MatchArmWithNoBody {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`match` arm with no body")));
                        let __code_33 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" => {{ todo!() }}"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add a body after the pattern")),
                            __code_33, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1055#[diag("`match` arm with no body")]
1056pub(crate) struct MatchArmWithNoBody {
1057    #[primary_span]
1058    pub span: Span,
1059    // We include the braces around `todo!()` so that a comma is optional, and we don't have to have
1060    // any logic looking at the arm being replaced if there was a comma already or not for the
1061    // resulting code to be correct.
1062    #[suggestion(
1063        "add a body after the pattern",
1064        // ignore-tidy-todo
1065        code = " => {{ todo!() }}",
1066        applicability = "has-placeholders",
1067        style = "verbose"
1068    )]
1069    pub suggestion: Span,
1070}
1071
1072#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            PreciseCapturingNotAllowedHere {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    PreciseCapturingNotAllowedHere {
                        span: __binding_0, loc: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`use<...>` precise capturing syntax not allowed in {$loc}")));
                        ;
                        diag.arg("loc", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1073#[diag("`use<...>` precise capturing syntax not allowed in {$loc}")]
1074pub(crate) struct PreciseCapturingNotAllowedHere {
1075    #[primary_span]
1076    pub span: Span,
1077    pub loc: &'static str,
1078}
1079
1080#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DuplicatePreciseCapturing {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DuplicatePreciseCapturing {
                        bound1: __binding_0, bound2: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate `use<...>` precise capturing syntax")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("second `use<...>` here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1081#[diag("duplicate `use<...>` precise capturing syntax")]
1082pub(crate) struct DuplicatePreciseCapturing {
1083    #[primary_span]
1084    pub bound1: Span,
1085    #[label("second `use<...>` here")]
1086    pub bound2: Span,
1087}
1088
1089#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingAbi {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingAbi { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` declarations without an explicit ABI are disallowed")));
                        let __code_34 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("extern \"<abi>\""))
                                            })].into_iter();
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("prior to Rust 2024, a default ABI was inferred")));
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("specify an ABI")),
                            __code_34, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1090#[diag("`extern` declarations without an explicit ABI are disallowed")]
1091#[help("prior to Rust 2024, a default ABI was inferred")]
1092pub(crate) struct MissingAbi {
1093    #[primary_span]
1094    #[suggestion("specify an ABI", code = "extern \"<abi>\"", applicability = "has-placeholders")]
1095    pub span: Span,
1096}
1097
1098#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingAbiSugg {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingAbiSugg { span: __binding_0, default_abi: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern` declarations without an explicit ABI are deprecated")));
                        let __code_35 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("extern {0}",
                                                        __binding_1))
                                            })].into_iter();
                        ;
                        diag.arg("default_abi", __binding_1);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("explicitly specify the {$default_abi} ABI")),
                            __code_35, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1099#[diag("`extern` declarations without an explicit ABI are deprecated")]
1100pub(crate) struct MissingAbiSugg {
1101    #[suggestion(
1102        "explicitly specify the {$default_abi} ABI",
1103        code = "extern {default_abi}",
1104        applicability = "machine-applicable"
1105    )]
1106    pub span: Span,
1107    pub default_abi: ExternAbi,
1108}
1109
1110#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AbiCustomSafeForeignFunction {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AbiCustomSafeForeignFunction {
                        span: __binding_0, safe_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("foreign functions with the \"custom\" ABI cannot be safe")));
                        let __code_36 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `safe` keyword from this definition")),
                            __code_36, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1111#[diag("foreign functions with the \"custom\" ABI cannot be safe")]
1112pub(crate) struct AbiCustomSafeForeignFunction {
1113    #[primary_span]
1114    pub span: Span,
1115
1116    #[suggestion(
1117        "remove the `safe` keyword from this definition",
1118        applicability = "maybe-incorrect",
1119        code = "",
1120        style = "verbose"
1121    )]
1122    pub safe_span: Span,
1123}
1124
1125#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AbiCustomSafeFunction {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AbiCustomSafeFunction {
                        span: __binding_0,
                        abi: __binding_1,
                        unsafe_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the \"custom\" ABI must be unsafe")));
                        let __code_37 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("unsafe "))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add the `unsafe` keyword to this definition")),
                            __code_37, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1126#[diag("functions with the \"custom\" ABI must be unsafe")]
1127pub(crate) struct AbiCustomSafeFunction {
1128    #[primary_span]
1129    pub span: Span,
1130    pub abi: ExternAbi,
1131
1132    #[suggestion(
1133        "add the `unsafe` keyword to this definition",
1134        applicability = "maybe-incorrect",
1135        code = "unsafe ",
1136        style = "verbose"
1137    )]
1138    pub unsafe_span: Span,
1139}
1140
1141#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AbiCannotBeCoroutine
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AbiCannotBeCoroutine {
                        span: __binding_0,
                        abi: __binding_1,
                        coroutine_kind_span: __binding_2,
                        coroutine_kind_str: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the {$abi} ABI cannot be `{$coroutine_kind_str}`")));
                        let __code_38 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("abi", __binding_1);
                        diag.arg("coroutine_kind_str", __binding_3);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `{$coroutine_kind_str}` keyword from this definition")),
                            __code_38, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1142#[diag("functions with the {$abi} ABI cannot be `{$coroutine_kind_str}`")]
1143pub(crate) struct AbiCannotBeCoroutine {
1144    #[primary_span]
1145    pub span: Span,
1146    pub abi: ExternAbi,
1147
1148    #[suggestion(
1149        "remove the `{$coroutine_kind_str}` keyword from this definition",
1150        applicability = "maybe-incorrect",
1151        code = "",
1152        style = "verbose"
1153    )]
1154    pub coroutine_kind_span: Span,
1155    pub coroutine_kind_str: &'static str,
1156}
1157
1158#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AbiMustNotHaveParametersOrReturnType {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AbiMustNotHaveParametersOrReturnType {
                        spans: __binding_0,
                        abi: __binding_1,
                        suggestion_span: __binding_2,
                        symbol: __binding_3,
                        padding: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid signature for `extern {$abi}` function")));
                        let __code_39 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}fn{1}()", __binding_4,
                                                        __binding_3))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the {$abi} ABI cannot have any parameters or return type")));
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0.clone());
                        diag.span_suggestions_with_style(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the parameters and return type")),
                            __code_39, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1159#[diag("invalid signature for `extern {$abi}` function")]
1160#[note("functions with the {$abi} ABI cannot have any parameters or return type")]
1161pub(crate) struct AbiMustNotHaveParametersOrReturnType {
1162    #[primary_span]
1163    pub spans: Vec<Span>,
1164    pub abi: ExternAbi,
1165
1166    #[suggestion(
1167        "remove the parameters and return type",
1168        applicability = "maybe-incorrect",
1169        code = "{padding}fn{symbol}()",
1170        style = "verbose"
1171    )]
1172    pub suggestion_span: Span,
1173    pub symbol: String,
1174    pub padding: &'static str,
1175}
1176
1177#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AbiMustNotHaveReturnType {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AbiMustNotHaveReturnType {
                        span: __binding_0, abi: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid signature for `extern {$abi}` function")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the {$abi} ABI cannot have a return type")));
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0);
                        diag.span_help(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the return type")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1178#[diag("invalid signature for `extern {$abi}` function")]
1179#[note("functions with the {$abi} ABI cannot have a return type")]
1180pub(crate) struct AbiMustNotHaveReturnType {
1181    #[primary_span]
1182    #[help("remove the return type")]
1183    pub span: Span,
1184    pub abi: ExternAbi,
1185}
1186
1187#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AbiX86Interrupt {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AbiX86Interrupt {
                        spans: __binding_0, param_count: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid signature for `extern \"x86-interrupt\"` function")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the \"x86-interrupt\" ABI must be have either 1 or 2 parameters (but found {$param_count})")));
                        ;
                        diag.arg("param_count", __binding_1);
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1188#[diag("invalid signature for `extern \"x86-interrupt\"` function")]
1189#[note(
1190    "functions with the \"x86-interrupt\" ABI must be have either 1 or 2 parameters (but found {$param_count})"
1191)]
1192pub(crate) struct AbiX86Interrupt {
1193    #[primary_span]
1194    pub spans: Vec<Span>,
1195    pub param_count: usize,
1196}
1197
1198#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ScalableVectorNotTupleStruct {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ScalableVectorNotTupleStruct { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("scalable vectors must be tuple structs")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1199#[diag("scalable vectors must be tuple structs")]
1200pub(crate) struct ScalableVectorNotTupleStruct {
1201    #[primary_span]
1202    pub span: Span,
1203}
1204
1205#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ScalableVectorBadArch {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ScalableVectorBadArch { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("scalable vectors are not supported on this architecture")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1206#[diag("scalable vectors are not supported on this architecture")]
1207pub(crate) struct ScalableVectorBadArch {
1208    #[primary_span]
1209    pub span: Span,
1210}
1211
1212#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for RequiresRustAbi {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RequiresRustAbi {
                        track_caller_span: __binding_0, extern_abi_span: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[track_caller]` can only be used with the Rust ABI")));
                        diag.code(E0737);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using `#[track_caller]` here")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not using the Rust ABI because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1213#[diag("`#[track_caller]` can only be used with the Rust ABI", code = E0737)]
1214pub(crate) struct RequiresRustAbi {
1215    #[primary_span]
1216    #[label("using `#[track_caller]` here")]
1217    pub track_caller_span: Span,
1218    #[label("not using the Rust ABI because of this")]
1219    pub extern_abi_span: Span,
1220}
1221
1222#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnusedVisibility {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedVisibility { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("visibility qualifiers have no effect on `const _` declarations")));
                        let __code_40 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const _` does not declare a name, so there is nothing for the qualifier to apply to")));
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the qualifier")),
                            __code_40, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1223#[diag("visibility qualifiers have no effect on `const _` declarations")]
1224#[note("`const _` does not declare a name, so there is nothing for the qualifier to apply to")]
1225pub(crate) struct UnusedVisibility {
1226    #[suggestion(
1227        "remove the qualifier",
1228        style = "short",
1229        code = "",
1230        applicability = "machine-applicable"
1231    )]
1232    pub span: Span,
1233}
1234
1235#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for PatternsInFnsWithoutBodySub {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    PatternsInFnsWithoutBodySub {
                        span: __binding_0, ident: __binding_1 } => {
                        let __code_41 =
                            [::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("remove `mut` from the parameter")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_41, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1236#[suggestion(
1237    "remove `mut` from the parameter",
1238    code = "{ident}",
1239    applicability = "machine-applicable"
1240)]
1241pub(crate) struct PatternsInFnsWithoutBodySub {
1242    #[primary_span]
1243    pub span: Span,
1244
1245    pub ident: Ident,
1246}
1247
1248#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            PatternsInFnsWithoutBody {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    PatternsInFnsWithoutBody::Foreign { sub: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in foreign function declarations")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                    PatternsInFnsWithoutBody::Bodiless { sub: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("patterns aren't allowed in functions without bodies")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1249pub(crate) enum PatternsInFnsWithoutBody {
1250    #[diag("patterns aren't allowed in foreign function declarations")]
1251    Foreign {
1252        #[subdiagnostic]
1253        sub: PatternsInFnsWithoutBodySub,
1254    },
1255    #[diag("patterns aren't allowed in functions without bodies")]
1256    Bodiless {
1257        #[subdiagnostic]
1258        sub: PatternsInFnsWithoutBodySub,
1259    },
1260}
1261
1262#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DeprecatedWhereClauseLocation {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DeprecatedWhereClauseLocation { suggestion: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("where clause not allowed here")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1263#[diag("where clause not allowed here")]
1264#[note("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information")]
1265pub(crate) struct DeprecatedWhereClauseLocation {
1266    #[subdiagnostic]
1267    pub suggestion: DeprecatedWhereClauseLocationSugg,
1268}
1269
1270#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for DeprecatedWhereClauseLocationSugg
            {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    DeprecatedWhereClauseLocationSugg::MoveToEnd {
                        left: __binding_0, right: __binding_1, sugg: __binding_2 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_42 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        let __code_43 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                });
                        suggestions.push((__binding_0, __code_42));
                        suggestions.push((__binding_1, __code_43));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("move it to the end of the type declaration")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    DeprecatedWhereClauseLocationSugg::RemoveWhere {
                        span: __binding_0 } => {
                        let __code_44 =
                            [::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 this `where`")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_44, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1271pub(crate) enum DeprecatedWhereClauseLocationSugg {
1272    #[multipart_suggestion(
1273        "move it to the end of the type declaration",
1274        applicability = "machine-applicable"
1275    )]
1276    MoveToEnd {
1277        #[suggestion_part(code = "")]
1278        left: Span,
1279        #[suggestion_part(code = "{sugg}")]
1280        right: Span,
1281
1282        sugg: String,
1283    },
1284    #[suggestion("remove this `where`", code = "", applicability = "machine-applicable")]
1285    RemoveWhere {
1286        #[primary_span]
1287        span: Span,
1288    },
1289}
1290
1291#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            VarargsWithoutPattern {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    VarargsWithoutPattern { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing pattern for `...` argument")));
                        let __code_45 =
                            [::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("add a pattern for this argument")),
                            __code_45, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1292#[diag("missing pattern for `...` argument")]
1293pub(crate) struct VarargsWithoutPattern {
1294    #[suggestion(
1295        "add a pattern for this argument",
1296        applicability = "machine-applicable",
1297        code = "_: ..."
1298    )]
1299    #[primary_span]
1300    pub span: Span,
1301}
1302
1303#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AbiCustomMustBeNaked
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AbiCustomMustBeNaked {
                        span: __binding_0, naked_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an `extern \"custom\"` function can only be declared externally or defined via naked functions")));
                        let __code_46 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("#[unsafe(naked)]\n"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert this to an `#[unsafe(naked)]` function")),
                            __code_46, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1304#[diag(
1305    "an `extern \"custom\"` function can only be declared externally or defined via naked functions"
1306)]
1307pub(crate) struct AbiCustomMustBeNaked {
1308    #[primary_span]
1309    pub span: Span,
1310    #[suggestion(
1311        "convert this to an `#[unsafe(naked)]` function",
1312        applicability = "maybe-incorrect",
1313        code = "#[unsafe(naked)]\n",
1314        style = "short"
1315    )]
1316    pub naked_span: Span,
1317}
1318
1319#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AbiCustomCannotBeCold {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AbiCustomCannotBeCold {
                        span: __binding_0,
                        cold_span: __binding_1,
                        abi_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an `extern \"custom\"` function cannot be marked `#[cold]`")));
                        let __code_47 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `#[cold]` attribute")),
                            __code_47, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern \"custom\"` because of this")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1320#[diag("an `extern \"custom\"` function cannot be marked `#[cold]`")]
1321pub(crate) struct AbiCustomCannotBeCold {
1322    #[primary_span]
1323    pub span: Span,
1324
1325    #[suggestion(
1326        "remove the `#[cold]` attribute",
1327        applicability = "maybe-incorrect",
1328        code = "",
1329        style = "short"
1330    )]
1331    pub cold_span: Span,
1332
1333    #[label("`extern \"custom\"` because of this")]
1334    pub abi_span: Span,
1335}
1336
1337#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ShowSpan {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ShowSpan { span: __binding_0, kind: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("showing the spans of the {$kind}")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1338#[diag("showing the spans of the {$kind}")]
1339pub(crate) struct ShowSpan {
1340    #[primary_span]
1341    pub span: Span,
1342    pub kind: &'static str,
1343}