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