Skip to main content

rustc_ast_passes/
errors.rs

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