Skip to main content

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