Skip to main content

rustc_hir_analysis/
errors.rs

1//! Errors emitted by `rustc_hir_analysis`.
2
3use rustc_abi::ExternAbi;
4use rustc_errors::codes::*;
5use rustc_errors::{
6    Applicability, Diag, DiagCtxtHandle, DiagSymbolList, Diagnostic, EmissionGuarantee, Level,
7    MultiSpan, listify, msg,
8};
9use rustc_hir::limit::Limit;
10use rustc_macros::{Diagnostic, Subdiagnostic};
11use rustc_middle::ty::{self, Ty};
12use rustc_span::{Ident, Span, Symbol};
13pub(crate) mod wrong_number_of_generic_args;
14
15mod precise_captures;
16pub(crate) use precise_captures::*;
17
18#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            AmbiguousAssocItem<'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 {
                    AmbiguousAssocItem {
                        span: __binding_0,
                        assoc_kind: __binding_1,
                        assoc_ident: __binding_2,
                        qself: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ambiguous associated {$assoc_kind} `{$assoc_ident}` in bounds of `{$qself}`")));
                        ;
                        diag.arg("assoc_kind", __binding_1);
                        diag.arg("assoc_ident", __binding_2);
                        diag.arg("qself", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ambiguous associated {$assoc_kind} `{$assoc_ident}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
19#[diag("ambiguous associated {$assoc_kind} `{$assoc_ident}` in bounds of `{$qself}`")]
20pub(crate) struct AmbiguousAssocItem<'a> {
21    #[primary_span]
22    #[label("ambiguous associated {$assoc_kind} `{$assoc_ident}`")]
23    pub span: Span,
24    pub assoc_kind: &'static str,
25    pub assoc_ident: Ident,
26    pub qself: &'a str,
27}
28
29#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AssocKindMismatch where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AssocKindMismatch {
                        span: __binding_0,
                        expected: __binding_1,
                        got: __binding_2,
                        expected_because_label: __binding_3,
                        assoc_kind: __binding_4,
                        def_span: __binding_5,
                        bound_on_assoc_const_label: __binding_6,
                        wrap_in_braces_sugg: __binding_7 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected {$expected}, found {$got}")));
                        ;
                        diag.arg("expected", __binding_1);
                        diag.arg("got", __binding_2);
                        diag.arg("assoc_kind", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected {$got}")));
                        if let Some(__binding_3) = __binding_3 {
                            diag.span_label(__binding_3,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a {$expected} because of this associated {$expected}")));
                        }
                        diag.span_note(__binding_5,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the associated {$assoc_kind} is defined here")));
                        if let Some(__binding_6) = __binding_6 {
                            diag.span_label(__binding_6,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("bounds are not allowed on associated constants")));
                        }
                        if let Some(__binding_7) = __binding_7 {
                            diag.subdiagnostic(__binding_7);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
30#[diag("expected {$expected}, found {$got}")]
31pub(crate) struct AssocKindMismatch {
32    #[primary_span]
33    #[label("unexpected {$got}")]
34    pub span: Span,
35    pub expected: &'static str,
36    pub got: &'static str,
37    #[label("expected a {$expected} because of this associated {$expected}")]
38    pub expected_because_label: Option<Span>,
39    pub assoc_kind: &'static str,
40    #[note("the associated {$assoc_kind} is defined here")]
41    pub def_span: Span,
42    #[label("bounds are not allowed on associated constants")]
43    pub bound_on_assoc_const_label: Option<Span>,
44    #[subdiagnostic]
45    pub wrap_in_braces_sugg: Option<AssocKindMismatchWrapInBracesSugg>,
46}
47
48#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for AssocKindMismatchWrapInBracesSugg
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AssocKindMismatchWrapInBracesSugg {
                        lo: __binding_0, hi: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_0 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{{ "))
                                });
                        let __code_1 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" }}"))
                                });
                        suggestions.push((__binding_0, __code_0));
                        suggestions.push((__binding_1, __code_1));
                        diag.store_args();
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider adding braces here")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
49#[multipart_suggestion("consider adding braces here", applicability = "maybe-incorrect")]
50pub(crate) struct AssocKindMismatchWrapInBracesSugg {
51    #[suggestion_part(code = "{{ ")]
52    pub lo: Span,
53    #[suggestion_part(code = " }}")]
54    pub hi: Span,
55}
56
57#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AssocItemIsPrivate where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AssocItemIsPrivate {
                        span: __binding_0,
                        kind: __binding_1,
                        name: __binding_2,
                        defined_here_label: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind} `{$name}` is private")));
                        diag.code(E0624);
                        ;
                        diag.arg("kind", __binding_1);
                        diag.arg("name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("private {$kind}")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$kind} is defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
58#[diag("{$kind} `{$name}` is private", code = E0624)]
59pub(crate) struct AssocItemIsPrivate {
60    #[primary_span]
61    #[label("private {$kind}")]
62    pub span: Span,
63    pub kind: &'static str,
64    pub name: Ident,
65    #[label("the {$kind} is defined here")]
66    pub defined_here_label: Span,
67}
68
69#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            AssocItemNotFound<'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 {
                    AssocItemNotFound {
                        span: __binding_0,
                        assoc_ident: __binding_1,
                        assoc_kind: __binding_2,
                        qself: __binding_3,
                        label: __binding_4,
                        sugg: __binding_5,
                        within_macro_span: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated {$assoc_kind} `{$assoc_ident}` not found for `{$qself}`")));
                        diag.code(E0220);
                        ;
                        diag.arg("assoc_ident", __binding_1);
                        diag.arg("assoc_kind", __binding_2);
                        diag.arg("qself", __binding_3);
                        diag.span(__binding_0);
                        if let Some(__binding_4) = __binding_4 {
                            diag.subdiagnostic(__binding_4);
                        }
                        if let Some(__binding_5) = __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.span_label(__binding_6,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("due to this macro variable")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
70#[diag("associated {$assoc_kind} `{$assoc_ident}` not found for `{$qself}`", code = E0220)]
71pub(crate) struct AssocItemNotFound<'a> {
72    #[primary_span]
73    pub span: Span,
74    pub assoc_ident: Ident,
75    pub assoc_kind: &'static str,
76    pub qself: &'a str,
77    #[subdiagnostic]
78    pub label: Option<AssocItemNotFoundLabel<'a>>,
79    #[subdiagnostic]
80    pub sugg: Option<AssocItemNotFoundSugg<'a>>,
81    #[label("due to this macro variable")]
82    pub within_macro_span: Option<Span>,
83}
84
85#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for AssocItemNotFoundLabel<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AssocItemNotFoundLabel::NotFound {
                        span: __binding_0,
                        assoc_ident: __binding_1,
                        assoc_kind: __binding_2 } => {
                        diag.store_args();
                        diag.arg("assoc_ident", __binding_1);
                        diag.arg("assoc_kind", __binding_2);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated {$assoc_kind} `{$assoc_ident}` not found")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                    AssocItemNotFoundLabel::FoundInOtherTrait {
                        span: __binding_0,
                        assoc_kind: __binding_1,
                        trait_name: __binding_2,
                        suggested_name: __binding_3,
                        identically_named: __binding_4 } => {
                        diag.store_args();
                        diag.arg("assoc_kind", __binding_1);
                        diag.arg("trait_name", __binding_2);
                        diag.arg("suggested_name", __binding_3);
                        diag.arg("identically_named", __binding_4);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is {$identically_named ->\n            [true] an\n            *[false] a similarly named\n            } associated {$assoc_kind} `{$suggested_name}` in the trait `{$trait_name}`")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
86pub(crate) enum AssocItemNotFoundLabel<'a> {
87    #[label("associated {$assoc_kind} `{$assoc_ident}` not found")]
88    NotFound {
89        #[primary_span]
90        span: Span,
91        assoc_ident: Ident,
92        assoc_kind: &'static str,
93    },
94    #[label(
95        "there is {$identically_named ->
96            [true] an
97            *[false] a similarly named
98            } associated {$assoc_kind} `{$suggested_name}` in the trait `{$trait_name}`"
99    )]
100    FoundInOtherTrait {
101        #[primary_span]
102        span: Span,
103        assoc_kind: &'static str,
104        trait_name: &'a str,
105        suggested_name: Symbol,
106        identically_named: bool,
107    },
108}
109
110#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for AssocItemNotFoundSugg<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AssocItemNotFoundSugg::Similar {
                        span: __binding_0,
                        assoc_kind: __binding_1,
                        suggested_name: __binding_2 } => {
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("assoc_kind", __binding_1);
                        diag.arg("suggested_name", __binding_2);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is an associated {$assoc_kind} with a similar name")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_2, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    AssocItemNotFoundSugg::SimilarInOtherTrait {
                        span: __binding_0,
                        trait_name: __binding_1,
                        assoc_kind: __binding_2,
                        suggested_name: __binding_3 } => {
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_3))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("trait_name", __binding_1);
                        diag.arg("assoc_kind", __binding_2);
                        diag.arg("suggested_name", __binding_3);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("change the associated {$assoc_kind} name to use `{$suggested_name}` from `{$trait_name}`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_3, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    AssocItemNotFoundSugg::SimilarInOtherTraitQPath {
                        lo: __binding_0,
                        mi: __binding_1,
                        hi: __binding_2,
                        trait_ref: __binding_3,
                        suggested_name: __binding_4,
                        identically_named: __binding_5,
                        assoc_kind: __binding_6,
                        applicability: __binding_7 } => {
                        let mut suggestions = Vec::new();
                        let __code_4 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("<"))
                                });
                        let __code_5 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(" as {0}>", __binding_3))
                                });
                        let __code_6 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_4))
                                });
                        suggestions.push((__binding_0, __code_4));
                        suggestions.push((__binding_1, __code_5));
                        if let Some(__binding_2) = __binding_2 {
                            suggestions.push((__binding_2, __code_6));
                        }
                        diag.store_args();
                        diag.arg("trait_ref", __binding_3);
                        diag.arg("suggested_name", __binding_4);
                        diag.arg("identically_named", __binding_5);
                        diag.arg("assoc_kind", __binding_6);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider fully qualifying{$identically_named ->\n            [true] {\"\"}\n            *[false] {\" \"}and renaming\n        } the associated {$assoc_kind}")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            __binding_7, rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                    AssocItemNotFoundSugg::Other {
                        span: __binding_0,
                        qself: __binding_1,
                        assoc_kind: __binding_2,
                        suggested_name: __binding_3 } => {
                        let __code_7 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_3))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("qself", __binding_1);
                        diag.arg("assoc_kind", __binding_2);
                        diag.arg("suggested_name", __binding_3);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$qself}` has the following associated {$assoc_kind}")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_7, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
111
112pub(crate) enum AssocItemNotFoundSugg<'a> {
113    #[suggestion(
114        "there is an associated {$assoc_kind} with a similar name",
115        code = "{suggested_name}",
116        applicability = "maybe-incorrect"
117    )]
118    Similar {
119        #[primary_span]
120        span: Span,
121        assoc_kind: &'static str,
122        suggested_name: Symbol,
123    },
124    #[suggestion(
125        "change the associated {$assoc_kind} name to use `{$suggested_name}` from `{$trait_name}`",
126        code = "{suggested_name}",
127        style = "verbose",
128        applicability = "maybe-incorrect"
129    )]
130    SimilarInOtherTrait {
131        #[primary_span]
132        span: Span,
133        trait_name: &'a str,
134        assoc_kind: &'static str,
135        suggested_name: Symbol,
136    },
137    #[multipart_suggestion(
138        "consider fully qualifying{$identically_named ->
139            [true] {\"\"}
140            *[false] {\" \"}and renaming
141        } the associated {$assoc_kind}",
142        style = "verbose"
143    )]
144    SimilarInOtherTraitQPath {
145        #[suggestion_part(code = "<")]
146        lo: Span,
147        #[suggestion_part(code = " as {trait_ref}>")]
148        mi: Span,
149        #[suggestion_part(code = "{suggested_name}")]
150        hi: Option<Span>,
151        trait_ref: String,
152        suggested_name: Symbol,
153        identically_named: bool,
154        assoc_kind: &'static str,
155        #[applicability]
156        applicability: Applicability,
157    },
158    #[suggestion(
159        "`{$qself}` has the following associated {$assoc_kind}",
160        code = "{suggested_name}",
161        applicability = "maybe-incorrect"
162    )]
163    Other {
164        #[primary_span]
165        span: Span,
166        qself: &'a str,
167        assoc_kind: &'static str,
168        suggested_name: Symbol,
169    },
170}
171
172#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            WrongNumberOfGenericArgumentsToIntrinsic<'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 {
                    WrongNumberOfGenericArgumentsToIntrinsic {
                        span: __binding_0,
                        found: __binding_1,
                        expected: __binding_2,
                        descr: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("intrinsic has wrong number of {$descr} parameters: found {$found}, expected {$expected}")));
                        diag.code(E0094);
                        ;
                        diag.arg("found", __binding_1);
                        diag.arg("expected", __binding_2);
                        diag.arg("descr", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected {$expected} {$descr} {$expected ->\n            [one] parameter\n            *[other] parameters\n        }")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
173#[diag("intrinsic has wrong number of {$descr} parameters: found {$found}, expected {$expected}", code = E0094)]
174pub(crate) struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
175    #[primary_span]
176    #[label(
177        "expected {$expected} {$descr} {$expected ->
178            [one] parameter
179            *[other] parameters
180        }"
181    )]
182    pub span: Span,
183    pub found: usize,
184    pub expected: usize,
185    pub descr: &'a str,
186}
187
188#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnrecognizedIntrinsicFunction where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnrecognizedIntrinsicFunction {
                        span: __binding_0, name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unrecognized intrinsic function: `{$name}`")));
                        diag.code(E0093);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you're adding an intrinsic, be sure to update `check_intrinsic_type`")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unrecognized intrinsic")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
189#[diag("unrecognized intrinsic function: `{$name}`", code = E0093)]
190#[help("if you're adding an intrinsic, be sure to update `check_intrinsic_type`")]
191pub(crate) struct UnrecognizedIntrinsicFunction {
192    #[primary_span]
193    #[label("unrecognized intrinsic")]
194    pub span: Span,
195    pub name: Symbol,
196}
197
198#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LifetimesOrBoundsMismatchOnTrait where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LifetimesOrBoundsMismatchOnTrait {
                        span: __binding_0,
                        generics_span: __binding_1,
                        where_span: __binding_2,
                        bounds_span: __binding_3,
                        item_kind: __binding_4,
                        ident: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime parameters or bounds on {$item_kind} `{$ident}` do not match the trait declaration")));
                        diag.code(E0195);
                        ;
                        diag.arg("item_kind", __binding_4);
                        diag.arg("ident", __binding_5);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetimes do not match {$item_kind} in trait")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetimes in impl do not match this {$item_kind} in trait")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_label(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `where` clause might not match the one in the trait")));
                        }
                        for __binding_3 in __binding_3 {
                            diag.span_label(__binding_3,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this bound might be missing in the impl")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
199#[diag("lifetime parameters or bounds on {$item_kind} `{$ident}` do not match the trait declaration", code = E0195)]
200pub(crate) struct LifetimesOrBoundsMismatchOnTrait {
201    #[primary_span]
202    #[label("lifetimes do not match {$item_kind} in trait")]
203    pub span: Span,
204    #[label("lifetimes in impl do not match this {$item_kind} in trait")]
205    pub generics_span: Span,
206    #[label("this `where` clause might not match the one in the trait")]
207    pub where_span: Option<Span>,
208    #[label("this bound might be missing in the impl")]
209    pub bounds_span: Vec<Span>,
210    pub item_kind: &'static str,
211    pub ident: Ident,
212}
213
214#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DropImplOnWrongItem where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DropImplOnWrongItem { span: __binding_0, trait_: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$trait_}` trait may only be implemented for local structs, enums, and unions")));
                        diag.code(E0120);
                        ;
                        diag.arg("trait_", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("must be a struct, enum, or union in the current crate")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
215#[diag("the `{$trait_}` trait may only be implemented for local structs, enums, and unions", code = E0120)]
216pub(crate) struct DropImplOnWrongItem {
217    #[primary_span]
218    #[label("must be a struct, enum, or union in the current crate")]
219    pub span: Span,
220    pub trait_: Symbol,
221}
222
223#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FieldAlreadyDeclared where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FieldAlreadyDeclared::NotNested {
                        field_name: __binding_0,
                        span: __binding_1,
                        prev_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` is already declared")));
                        diag.code(E0124);
                        ;
                        diag.arg("field_name", __binding_0);
                        diag.span(__binding_1);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field already declared")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$field_name}` first declared here")));
                        diag
                    }
                    FieldAlreadyDeclared::CurrentNested {
                        field_name: __binding_0,
                        span: __binding_1,
                        nested_field_span: __binding_2,
                        help: __binding_3,
                        prev_span: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` is already declared")));
                        ;
                        diag.arg("field_name", __binding_0);
                        diag.span(__binding_1);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` declared in this unnamed field")));
                        diag.span_note(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` declared here")));
                        diag.subdiagnostic(__binding_3);
                        diag.span_label(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$field_name}` first declared here")));
                        diag
                    }
                    FieldAlreadyDeclared::PreviousNested {
                        field_name: __binding_0,
                        span: __binding_1,
                        prev_span: __binding_2,
                        prev_nested_field_span: __binding_3,
                        prev_help: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` is already declared")));
                        ;
                        diag.arg("field_name", __binding_0);
                        diag.span(__binding_1);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field already declared")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$field_name}` first declared here in this unnamed field")));
                        diag.span_note(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` first declared here")));
                        diag.subdiagnostic(__binding_4);
                        diag
                    }
                    FieldAlreadyDeclared::BothNested {
                        field_name: __binding_0,
                        span: __binding_1,
                        nested_field_span: __binding_2,
                        help: __binding_3,
                        prev_span: __binding_4,
                        prev_nested_field_span: __binding_5,
                        prev_help: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` is already declared")));
                        ;
                        diag.arg("field_name", __binding_0);
                        diag.span(__binding_1);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` declared in this unnamed field")));
                        diag.span_note(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` declared here")));
                        diag.subdiagnostic(__binding_3);
                        diag.span_label(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$field_name}` first declared here in this unnamed field")));
                        diag.span_note(__binding_5,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field `{$field_name}` first declared here")));
                        diag.subdiagnostic(__binding_6);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
224pub(crate) enum FieldAlreadyDeclared {
225    #[diag("field `{$field_name}` is already declared", code = E0124)]
226    NotNested {
227        field_name: Ident,
228        #[primary_span]
229        #[label("field already declared")]
230        span: Span,
231        #[label("`{$field_name}` first declared here")]
232        prev_span: Span,
233    },
234    #[diag("field `{$field_name}` is already declared")]
235    CurrentNested {
236        field_name: Ident,
237        #[primary_span]
238        #[label("field `{$field_name}` declared in this unnamed field")]
239        span: Span,
240        #[note("field `{$field_name}` declared here")]
241        nested_field_span: Span,
242        #[subdiagnostic]
243        help: FieldAlreadyDeclaredNestedHelp,
244        #[label("`{$field_name}` first declared here")]
245        prev_span: Span,
246    },
247    #[diag("field `{$field_name}` is already declared")]
248    PreviousNested {
249        field_name: Ident,
250        #[primary_span]
251        #[label("field already declared")]
252        span: Span,
253        #[label("`{$field_name}` first declared here in this unnamed field")]
254        prev_span: Span,
255        #[note("field `{$field_name}` first declared here")]
256        prev_nested_field_span: Span,
257        #[subdiagnostic]
258        prev_help: FieldAlreadyDeclaredNestedHelp,
259    },
260    #[diag("field `{$field_name}` is already declared")]
261    BothNested {
262        field_name: Ident,
263        #[primary_span]
264        #[label("field `{$field_name}` declared in this unnamed field")]
265        span: Span,
266        #[note("field `{$field_name}` declared here")]
267        nested_field_span: Span,
268        #[subdiagnostic]
269        help: FieldAlreadyDeclaredNestedHelp,
270        #[label("`{$field_name}` first declared here in this unnamed field")]
271        prev_span: Span,
272        #[note("field `{$field_name}` first declared here")]
273        prev_nested_field_span: Span,
274        #[subdiagnostic]
275        prev_help: FieldAlreadyDeclaredNestedHelp,
276    },
277}
278
279#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for FieldAlreadyDeclaredNestedHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    FieldAlreadyDeclaredNestedHelp { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("fields from the type of this unnamed field are considered fields of the outer type")));
                        diag.span_help(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
280#[help("fields from the type of this unnamed field are considered fields of the outer type")]
281pub(crate) struct FieldAlreadyDeclaredNestedHelp {
282    #[primary_span]
283    pub span: Span,
284}
285
286#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CopyImplOnTypeWithDtor where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CopyImplOnTypeWithDtor {
                        span: __binding_0, impl_: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the trait `Copy` cannot be implemented for this type; the type has a destructor")));
                        diag.code(E0184);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`Copy` not allowed on types with destructors")));
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("destructor declared here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
287#[diag("the trait `Copy` cannot be implemented for this type; the type has a destructor", code = E0184)]
288pub(crate) struct CopyImplOnTypeWithDtor {
289    #[primary_span]
290    #[label("`Copy` not allowed on types with destructors")]
291    pub span: Span,
292    #[note("destructor declared here")]
293    pub impl_: Span,
294}
295
296#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CopyImplOnNonAdt where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CopyImplOnNonAdt { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the trait `Copy` cannot be implemented for this type")));
                        diag.code(E0206);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type is not a structure or enumeration")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
297#[diag("the trait `Copy` cannot be implemented for this type", code = E0206)]
298pub(crate) struct CopyImplOnNonAdt {
299    #[primary_span]
300    #[label("type is not a structure or enumeration")]
301    pub span: Span,
302}
303
304#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstParamTyImplOnUnsized where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstParamTyImplOnUnsized { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the trait `ConstParamTy` may not be implemented for this type")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type is not `Sized`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
305#[diag("the trait `ConstParamTy` may not be implemented for this type")]
306pub(crate) struct ConstParamTyImplOnUnsized {
307    #[primary_span]
308    #[label("type is not `Sized`")]
309    pub span: Span,
310}
311
312#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstParamTyImplOnNonAdt where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstParamTyImplOnNonAdt { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the trait `ConstParamTy` may not be implemented for this type")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type is not a structure or enumeration")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
313#[diag("the trait `ConstParamTy` may not be implemented for this type")]
314pub(crate) struct ConstParamTyImplOnNonAdt {
315    #[primary_span]
316    #[label("type is not a structure or enumeration")]
317    pub span: Span,
318}
319
320#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TraitObjectDeclaredWithNoTraits where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TraitObjectDeclaredWithNoTraits {
                        span: __binding_0, trait_alias_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("at least one trait is required for an object type")));
                        diag.code(E0224);
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this alias does not contain a trait")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
321#[diag("at least one trait is required for an object type", code = E0224)]
322pub(crate) struct TraitObjectDeclaredWithNoTraits {
323    #[primary_span]
324    pub span: Span,
325    #[label("this alias does not contain a trait")]
326    pub trait_alias_span: Option<Span>,
327}
328
329#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AmbiguousLifetimeBound where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AmbiguousLifetimeBound { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ambiguous lifetime bound, explicit lifetime bound required")));
                        diag.code(E0227);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
330#[diag("ambiguous lifetime bound, explicit lifetime bound required", code = E0227)]
331pub(crate) struct AmbiguousLifetimeBound {
332    #[primary_span]
333    pub span: Span,
334}
335
336#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AssocItemConstraintsNotAllowedHere where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AssocItemConstraintsNotAllowedHere {
                        span: __binding_0, fn_trait_expansion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated item constraints are not allowed here")));
                        diag.code(E0229);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("associated item constraint not allowed here")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
337#[diag("associated item constraints are not allowed here", code = E0229)]
338pub(crate) struct AssocItemConstraintsNotAllowedHere {
339    #[primary_span]
340    #[label("associated item constraint not allowed here")]
341    pub span: Span,
342
343    #[subdiagnostic]
344    pub fn_trait_expansion: Option<ParenthesizedFnTraitExpansion>,
345}
346
347#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            ParamInTyOfAssocConstBinding<'tcx> where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ParamInTyOfAssocConstBinding {
                        span: __binding_0,
                        assoc_const: __binding_1,
                        param_name: __binding_2,
                        param_def_kind: __binding_3,
                        param_category: __binding_4,
                        param_defined_here_label: __binding_5,
                        ty_note: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the type of the associated constant `{$assoc_const}` must not depend on {$param_category ->\n        [self] `Self`\n        [synthetic] `impl Trait`\n        *[normal] generic parameters\n    }")));
                        ;
                        diag.arg("assoc_const", __binding_1);
                        diag.arg("param_name", __binding_2);
                        diag.arg("param_def_kind", __binding_3);
                        diag.arg("param_category", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("its type must not depend on {$param_category ->\n            [self] `Self`\n            [synthetic] `impl Trait`\n            *[normal] the {$param_def_kind} `{$param_name}`\n        }")));
                        if let Some(__binding_5) = __binding_5 {
                            diag.span_label(__binding_5,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$param_category ->\n            [synthetic] the `impl Trait` is specified here\n            *[normal] the {$param_def_kind} `{$param_name}` is defined here\n        }")));
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.subdiagnostic(__binding_6);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
348#[diag(
349    "the type of the associated constant `{$assoc_const}` must not depend on {$param_category ->
350        [self] `Self`
351        [synthetic] `impl Trait`
352        *[normal] generic parameters
353    }"
354)]
355pub(crate) struct ParamInTyOfAssocConstBinding<'tcx> {
356    #[primary_span]
357    #[label(
358        "its type must not depend on {$param_category ->
359            [self] `Self`
360            [synthetic] `impl Trait`
361            *[normal] the {$param_def_kind} `{$param_name}`
362        }"
363    )]
364    pub span: Span,
365    pub assoc_const: Ident,
366    pub param_name: Symbol,
367    pub param_def_kind: &'static str,
368    pub param_category: &'static str,
369    #[label(
370        "{$param_category ->
371            [synthetic] the `impl Trait` is specified here
372            *[normal] the {$param_def_kind} `{$param_name}` is defined here
373        }"
374    )]
375    pub param_defined_here_label: Option<Span>,
376    #[subdiagnostic]
377    pub ty_note: Option<TyOfAssocConstBindingNote<'tcx>>,
378}
379
380#[derive(const _: () =
    {
        impl<'tcx> rustc_errors::Subdiagnostic for
            TyOfAssocConstBindingNote<'tcx> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    TyOfAssocConstBindingNote {
                        assoc_const: __binding_0, ty: __binding_1 } => {
                        diag.store_args();
                        diag.arg("assoc_const", __binding_0);
                        diag.arg("ty", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$assoc_const}` has type `{$ty}`")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic, #[automatically_derived]
impl<'tcx> ::core::clone::Clone for TyOfAssocConstBindingNote<'tcx> {
    #[inline]
    fn clone(&self) -> TyOfAssocConstBindingNote<'tcx> {
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::marker::Copy for TyOfAssocConstBindingNote<'tcx> { }Copy)]
381#[note("`{$assoc_const}` has type `{$ty}`")]
382pub(crate) struct TyOfAssocConstBindingNote<'tcx> {
383    pub assoc_const: Ident,
384    pub ty: Ty<'tcx>,
385}
386
387#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            EscapingBoundVarInTyOfAssocConstBinding<'tcx> where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EscapingBoundVarInTyOfAssocConstBinding {
                        span: __binding_0,
                        assoc_const: __binding_1,
                        var_name: __binding_2,
                        var_def_kind: __binding_3,
                        var_defined_here_label: __binding_4,
                        ty_note: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the type of the associated constant `{$assoc_const}` cannot capture late-bound generic parameters")));
                        ;
                        diag.arg("assoc_const", __binding_1);
                        diag.arg("var_name", __binding_2);
                        diag.arg("var_def_kind", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("its type cannot capture the late-bound {$var_def_kind} `{$var_name}`")));
                        diag.span_label(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the late-bound {$var_def_kind} `{$var_name}` is defined here")));
                        if let Some(__binding_5) = __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
388#[diag(
389    "the type of the associated constant `{$assoc_const}` cannot capture late-bound generic parameters"
390)]
391pub(crate) struct EscapingBoundVarInTyOfAssocConstBinding<'tcx> {
392    #[primary_span]
393    #[label("its type cannot capture the late-bound {$var_def_kind} `{$var_name}`")]
394    pub span: Span,
395    pub assoc_const: Ident,
396    pub var_name: Symbol,
397    pub var_def_kind: &'static str,
398    #[label("the late-bound {$var_def_kind} `{$var_name}` is defined here")]
399    pub var_defined_here_label: Span,
400    #[subdiagnostic]
401    pub ty_note: Option<TyOfAssocConstBindingNote<'tcx>>,
402}
403
404#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ParenthesizedFnTraitExpansion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ParenthesizedFnTraitExpansion {
                        span: __binding_0, expanded_type: __binding_1 } => {
                        diag.store_args();
                        diag.arg("expanded_type", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parenthesized trait syntax expands to `{$expanded_type}`")));
                        diag.span_help(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
405#[help("parenthesized trait syntax expands to `{$expanded_type}`")]
406pub(crate) struct ParenthesizedFnTraitExpansion {
407    #[primary_span]
408    pub span: Span,
409
410    pub expanded_type: String,
411}
412
413#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ValueOfAssociatedStructAlreadySpecified where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ValueOfAssociatedStructAlreadySpecified {
                        span: __binding_0,
                        prev_span: __binding_1,
                        item_name: __binding_2,
                        def_path: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the value of the associated type `{$item_name}` in trait `{$def_path}` is already specified")));
                        diag.code(E0719);
                        ;
                        diag.arg("item_name", __binding_2);
                        diag.arg("def_path", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("re-bound here")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$item_name}` bound here first")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
414#[diag("the value of the associated type `{$item_name}` in trait `{$def_path}` is already specified", code = E0719)]
415pub(crate) struct ValueOfAssociatedStructAlreadySpecified {
416    #[primary_span]
417    #[label("re-bound here")]
418    pub span: Span,
419    #[label("`{$item_name}` bound here first")]
420    pub prev_span: Span,
421    pub item_name: Ident,
422    pub def_path: String,
423}
424
425#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnconstrainedOpaqueType where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnconstrainedOpaqueType {
                        span: __binding_0, name: __binding_1, what: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unconstrained opaque type")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` must be used in combination with a concrete type within the same {$what}")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("what", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
426#[diag("unconstrained opaque type")]
427#[note("`{$name}` must be used in combination with a concrete type within the same {$what}")]
428pub(crate) struct UnconstrainedOpaqueType {
429    #[primary_span]
430    pub span: Span,
431    pub name: Ident,
432    pub what: &'static str,
433}
434
435pub(crate) struct MissingGenericParams {
436    pub span: Span,
437    pub def_span: Span,
438    pub span_snippet: Option<String>,
439    pub missing_generic_params: Vec<(Symbol, ty::GenericParamDefKind)>,
440    pub empty_generic_args: bool,
441}
442
443// FIXME: This doesn't need to be a manual impl!
444impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for MissingGenericParams {
445    #[track_caller]
446    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
447        let mut err = Diag::new(
448            dcx,
449            level,
450            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$descr} {$parameterCount ->\n                    [one] parameter\n                    *[other] parameters\n                } {$parameters} must be explicitly specified"))msg!(
451                "the {$descr} {$parameterCount ->
452                    [one] parameter
453                    *[other] parameters
454                } {$parameters} must be explicitly specified"
455            ),
456        );
457        err.span(self.span);
458        err.code(E0393);
459        err.span_label(
460            self.def_span,
461            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$descr} {$parameterCount ->\n                    [one] parameter\n                    *[other] parameters\n                } {$parameters} must be specified for this"))msg!(
462                "{$descr} {$parameterCount ->
463                    [one] parameter
464                    *[other] parameters
465                } {$parameters} must be specified for this"
466            ),
467        );
468
469        enum Descr {
470            Generic,
471            Type,
472            Const,
473        }
474
475        let mut descr = None;
476        for (_, kind) in &self.missing_generic_params {
477            descr = match (&descr, kind) {
478                (None, ty::GenericParamDefKind::Type { .. }) => Some(Descr::Type),
479                (None, ty::GenericParamDefKind::Const { .. }) => Some(Descr::Const),
480                (Some(Descr::Type), ty::GenericParamDefKind::Const { .. })
481                | (Some(Descr::Const), ty::GenericParamDefKind::Type { .. }) => {
482                    Some(Descr::Generic)
483                }
484                _ => continue,
485            }
486        }
487
488        err.arg(
489            "descr",
490            match descr.unwrap() {
491                Descr::Generic => "generic",
492                Descr::Type => "type",
493                Descr::Const => "const",
494            },
495        );
496        err.arg("parameterCount", self.missing_generic_params.len());
497        err.arg(
498            "parameters",
499            listify(&self.missing_generic_params, |(n, _)| ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("`{0}`", n))
    })format!("`{n}`")).unwrap(),
500        );
501
502        let mut suggested = false;
503        // Don't suggest setting the generic params if there are some already: The order is
504        // tricky to get right and the user will already know what the syntax is.
505        if let Some(snippet) = self.span_snippet
506            && self.empty_generic_args
507        {
508            if snippet.ends_with('>') {
509                // The user wrote `Trait<'a, T>` or similar. To provide an accurate suggestion
510                // we would have to preserve the right order. For now, as clearly the user is
511                // aware of the syntax, we do nothing.
512            } else {
513                // The user wrote `Trait`, so we don't have a type we can suggest, but at
514                // least we can clue them to the correct syntax `Trait</* Term */>`.
515                err.span_suggestion_verbose(
516                    self.span.shrink_to_hi(),
517                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("explicitly specify the {$descr} {$parameterCount ->\n                            [one] parameter\n                            *[other] parameters\n                        }"))msg!(
518                        "explicitly specify the {$descr} {$parameterCount ->
519                            [one] parameter
520                            *[other] parameters
521                        }"
522                    ),
523                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("<{0}>",
                self.missing_generic_params.iter().map(|(n, _)|
                                ::alloc::__export::must_use({
                                        ::alloc::fmt::format(format_args!("/* {0} */", n))
                                    })).collect::<Vec<_>>().join(", ")))
    })format!(
524                        "<{}>",
525                        self.missing_generic_params
526                            .iter()
527                            .map(|(n, _)| format!("/* {n} */"))
528                            .collect::<Vec<_>>()
529                            .join(", ")
530                    ),
531                    Applicability::HasPlaceholders,
532                );
533                suggested = true;
534            }
535        }
536        if !suggested {
537            err.span_label(
538                self.span,
539                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing {$parameterCount ->\n                        [one] reference\n                        *[other] references\n                    } to {$parameters}"))msg!(
540                    "missing {$parameterCount ->
541                        [one] reference
542                        *[other] references
543                    } to {$parameters}"
544                ),
545            );
546        }
547
548        err.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("because the parameter {$parameterCount ->\n                [one] default references\n                *[other] defaults reference\n            } `Self`, the {$parameterCount ->\n                [one] parameter\n                *[other] parameters\n            } must be specified on the trait object type"))msg!(
549            "because the parameter {$parameterCount ->
550                [one] default references
551                *[other] defaults reference
552            } `Self`, the {$parameterCount ->
553                [one] parameter
554                *[other] parameters
555            } must be specified on the trait object type"
556        ));
557        err
558    }
559}
560
561#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ManualImplementation where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ManualImplementation {
                        span: __binding_0, trait_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("manual implementations of `{$trait_name}` are experimental")));
                        diag.code(E0183);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(unboxed_closures)]` to the crate attributes to enable")));
                        ;
                        diag.arg("trait_name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("manual implementations of `{$trait_name}` are experimental")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
562#[diag("manual implementations of `{$trait_name}` are experimental", code = E0183)]
563#[help("add `#![feature(unboxed_closures)]` to the crate attributes to enable")]
564pub(crate) struct ManualImplementation {
565    #[primary_span]
566    #[label("manual implementations of `{$trait_name}` are experimental")]
567    pub span: Span,
568    pub trait_name: String,
569}
570
571#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            GenericArgsOnOverriddenImpl where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    GenericArgsOnOverriddenImpl { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not resolve generic parameters on overridden impl")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
572#[diag("could not resolve generic parameters on overridden impl")]
573pub(crate) struct GenericArgsOnOverriddenImpl {
574    #[primary_span]
575    pub span: Span,
576}
577
578#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstImplForNonConstTrait where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstImplForNonConstTrait {
                        trait_ref_span: __binding_0,
                        trait_name: __binding_1,
                        suggestion: __binding_2,
                        suggestion_pre: __binding_3,
                        marking: __binding_4,
                        adding: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const `impl` for trait `{$trait_name}` which is not `const`")));
                        let __code_8 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("const "))
                                            })].into_iter();
                        ;
                        diag.arg("trait_name", __binding_1);
                        diag.arg("suggestion_pre", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this trait is not `const`")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_suggestions_with_style(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$suggestion_pre}mark `{$trait_name}` as `const` to allow it to have `const` implementations")),
                                __code_8, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowAlways);
                        }
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("marking a trait with `const` ensures all default method bodies are `const`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("adding a non-const method body in the future would be a breaking change")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
579#[diag("const `impl` for trait `{$trait_name}` which is not `const`")]
580pub(crate) struct ConstImplForNonConstTrait {
581    #[primary_span]
582    #[label("this trait is not `const`")]
583    pub trait_ref_span: Span,
584    pub trait_name: String,
585    #[suggestion(
586        "{$suggestion_pre}mark `{$trait_name}` as `const` to allow it to have `const` implementations",
587        applicability = "machine-applicable",
588        code = "const ",
589        style = "verbose"
590    )]
591    pub suggestion: Option<Span>,
592    pub suggestion_pre: &'static str,
593    #[note("marking a trait with `const` ensures all default method bodies are `const`")]
594    pub marking: (),
595    #[note("adding a non-const method body in the future would be a breaking change")]
596    pub adding: (),
597}
598
599#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstBoundForNonConstTrait where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstBoundForNonConstTrait {
                        span: __binding_0,
                        modifier: __binding_1,
                        def_span: __binding_2,
                        suggestion: __binding_3,
                        suggestion_pre: __binding_4,
                        trait_name: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$modifier}` can only be applied to `const` traits")));
                        let __code_9 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("const "))
                                            })].into_iter();
                        ;
                        diag.arg("modifier", __binding_1);
                        diag.arg("suggestion_pre", __binding_4);
                        diag.arg("trait_name", __binding_5);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't be applied to `{$trait_name}`")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_note(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$trait_name}` can't be used with `{$modifier}` because it isn't `const`")));
                        }
                        if let Some(__binding_3) = __binding_3 {
                            diag.span_suggestions_with_style(__binding_3,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$suggestion_pre}mark `{$trait_name}` as `const` to allow it to have `const` implementations")),
                                __code_9, rustc_errors::Applicability::MachineApplicable,
                                rustc_errors::SuggestionStyle::ShowAlways);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
600#[diag("`{$modifier}` can only be applied to `const` traits")]
601pub(crate) struct ConstBoundForNonConstTrait {
602    #[primary_span]
603    #[label("can't be applied to `{$trait_name}`")]
604    pub span: Span,
605    pub modifier: &'static str,
606    #[note("`{$trait_name}` can't be used with `{$modifier}` because it isn't `const`")]
607    pub def_span: Option<Span>,
608    #[suggestion(
609        "{$suggestion_pre}mark `{$trait_name}` as `const` to allow it to have `const` implementations",
610        applicability = "machine-applicable",
611        code = "const ",
612        style = "verbose"
613    )]
614    pub suggestion: Option<Span>,
615    pub suggestion_pre: &'static str,
616    pub trait_name: String,
617}
618
619#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for SelfInImplSelf
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SelfInImplSelf { span: __binding_0, note: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`Self` is not valid in the self type of an impl block")));
                        ;
                        diag.span(__binding_0);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("replace `Self` with a different type")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
620#[diag("`Self` is not valid in the self type of an impl block")]
621pub(crate) struct SelfInImplSelf {
622    #[primary_span]
623    pub span: MultiSpan,
624    #[note("replace `Self` with a different type")]
625    pub note: (),
626}
627
628#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LinkageType
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkageType { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid type for variable with `#[linkage]` attribute")));
                        diag.code(E0791);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
629#[diag("invalid type for variable with `#[linkage]` attribute", code = E0791)]
630pub(crate) struct LinkageType {
631    #[primary_span]
632    pub span: Span,
633}
634
635#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            AutoDerefReachedRecursionLimit<'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 {
                    AutoDerefReachedRecursionLimit {
                        span: __binding_0,
                        ty: __binding_1,
                        suggested_limit: __binding_2,
                        crate_name: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reached the recursion limit while auto-dereferencing `{$ty}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]` attribute to your crate (`{$crate_name}`)")));
                        diag.code(E0055);
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("suggested_limit", __binding_2);
                        diag.arg("crate_name", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("deref recursion limit reached")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
636#[help(
637    "consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]` attribute to your crate (`{$crate_name}`)"
638)]
639#[diag("reached the recursion limit while auto-dereferencing `{$ty}`", code = E0055)]
640pub(crate) struct AutoDerefReachedRecursionLimit<'a> {
641    #[primary_span]
642    #[label("deref recursion limit reached")]
643    pub span: Span,
644    pub ty: Ty<'a>,
645    pub suggested_limit: Limit,
646    pub crate_name: Symbol,
647}
648
649#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            WhereClauseOnMain where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    WhereClauseOnMain {
                        span: __binding_0, generics_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function is not allowed to have a `where` clause")));
                        diag.code(E0646);
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` cannot have a `where` clause")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
650#[diag("`main` function is not allowed to have a `where` clause", code = E0646)]
651pub(crate) struct WhereClauseOnMain {
652    #[primary_span]
653    pub span: Span,
654    #[label("`main` cannot have a `where` clause")]
655    pub generics_span: Option<Span>,
656}
657
658#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TrackCallerOnMain where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TrackCallerOnMain {
                        span: __binding_0, annotated: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function is not allowed to be `#[track_caller]`")));
                        let __code_10 =
                            [::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 this annotation")),
                            __code_10, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function is not allowed to be `#[track_caller]`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
659#[diag("`main` function is not allowed to be `#[track_caller]`")]
660pub(crate) struct TrackCallerOnMain {
661    #[primary_span]
662    #[suggestion("remove this annotation", applicability = "maybe-incorrect", code = "")]
663    pub span: Span,
664    #[label("`main` function is not allowed to be `#[track_caller]`")]
665    pub annotated: Span,
666}
667
668#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TargetFeatureOnMain where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TargetFeatureOnMain { main: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function is not allowed to have `#[target_feature]`")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function is not allowed to have `#[target_feature]`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
669#[diag("`main` function is not allowed to have `#[target_feature]`")]
670pub(crate) struct TargetFeatureOnMain {
671    #[primary_span]
672    #[label("`main` function is not allowed to have `#[target_feature]`")]
673    pub main: Span,
674}
675
676#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MainFunctionReturnTypeGeneric where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MainFunctionReturnTypeGeneric { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function return type is not allowed to have generic parameters")));
                        diag.code(E0131);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
677#[diag("`main` function return type is not allowed to have generic parameters", code = E0131)]
678pub(crate) struct MainFunctionReturnTypeGeneric {
679    #[primary_span]
680    pub span: Span,
681}
682
683#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MainFunctionAsync where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MainFunctionAsync {
                        span: __binding_0, asyncness: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function is not allowed to be `async`")));
                        diag.code(E0752);
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function is not allowed to be `async`")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
684#[diag("`main` function is not allowed to be `async`", code = E0752)]
685pub(crate) struct MainFunctionAsync {
686    #[primary_span]
687    pub span: Span,
688    #[label("`main` function is not allowed to be `async`")]
689    pub asyncness: Option<Span>,
690}
691
692#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MainFunctionGenericParameters where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MainFunctionGenericParameters {
                        span: __binding_0, label_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function is not allowed to have generic parameters")));
                        diag.code(E0131);
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` cannot have generic parameters")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
693#[diag("`main` function is not allowed to have generic parameters", code = E0131)]
694pub(crate) struct MainFunctionGenericParameters {
695    #[primary_span]
696    pub span: Span,
697    #[label("`main` cannot have generic parameters")]
698    pub label_span: Option<Span>,
699}
700
701#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            VariadicFunctionCompatibleConvention<'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 {
                    VariadicFunctionCompatibleConvention {
                        span: __binding_0, convention: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("C-variadic functions with the {$convention} calling convention are not supported")));
                        diag.code(E0045);
                        ;
                        diag.arg("convention", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("C-variadic function must have a compatible calling convention")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
702#[diag("C-variadic functions with the {$convention} calling convention are not supported", code = E0045)]
703pub(crate) struct VariadicFunctionCompatibleConvention<'a> {
704    #[primary_span]
705    #[label("C-variadic function must have a compatible calling convention")]
706    pub span: Span,
707    pub convention: &'a str,
708}
709
710#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotCaptureLateBound where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CannotCaptureLateBound::Type {
                        use_span: __binding_0,
                        def_span: __binding_1,
                        what: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot capture late-bound type parameter in {$what}")));
                        ;
                        diag.arg("what", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parameter defined here")));
                        diag
                    }
                    CannotCaptureLateBound::Const {
                        use_span: __binding_0,
                        def_span: __binding_1,
                        what: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot capture late-bound const parameter in {$what}")));
                        ;
                        diag.arg("what", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parameter defined here")));
                        diag
                    }
                    CannotCaptureLateBound::Lifetime {
                        use_span: __binding_0,
                        def_span: __binding_1,
                        what: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot capture late-bound lifetime in {$what}")));
                        ;
                        diag.arg("what", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
711pub(crate) enum CannotCaptureLateBound {
712    #[diag("cannot capture late-bound type parameter in {$what}")]
713    Type {
714        #[primary_span]
715        use_span: Span,
716        #[label("parameter defined here")]
717        def_span: Span,
718        what: &'static str,
719    },
720    #[diag("cannot capture late-bound const parameter in {$what}")]
721    Const {
722        #[primary_span]
723        use_span: Span,
724        #[label("parameter defined here")]
725        def_span: Span,
726        what: &'static str,
727    },
728    #[diag("cannot capture late-bound lifetime in {$what}")]
729    Lifetime {
730        #[primary_span]
731        use_span: Span,
732        #[label("lifetime defined here")]
733        def_span: Span,
734        what: &'static str,
735    },
736}
737
738#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            TypeOf<'tcx> where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TypeOf { span: __binding_0, ty: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$ty}")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
739#[diag("{$ty}")]
740pub(crate) struct TypeOf<'tcx> {
741    #[primary_span]
742    pub span: Span,
743    pub ty: Ty<'tcx>,
744}
745
746#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidUnionField where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidUnionField {
                        field_span: __binding_0,
                        sugg: __binding_1,
                        note: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union")));
                        diag.code(E0740);
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
747#[diag("field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union", code = E0740)]
748pub(crate) struct InvalidUnionField {
749    #[primary_span]
750    pub field_span: Span,
751    #[subdiagnostic]
752    pub sugg: InvalidUnionFieldSuggestion,
753    #[note(
754        "union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`"
755    )]
756    pub note: (),
757}
758
759#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            ReturnTypeNotationOnNonRpitit<'tcx> where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReturnTypeNotationOnNonRpitit {
                        span: __binding_0,
                        ty: __binding_1,
                        fn_span: __binding_2,
                        note: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type notation used on function that is not `async` and does not return `impl Trait`")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.span(__binding_0);
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_label(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function must be `async` or return `impl Trait`")));
                        }
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function returns `{$ty}`, which is not compatible with associated type return bounds")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
760#[diag(
761    "return type notation used on function that is not `async` and does not return `impl Trait`"
762)]
763pub(crate) struct ReturnTypeNotationOnNonRpitit<'tcx> {
764    #[primary_span]
765    pub span: Span,
766    pub ty: Ty<'tcx>,
767    #[label("this function must be `async` or return `impl Trait`")]
768    pub fn_span: Option<Span>,
769    #[note("function returns `{$ty}`, which is not compatible with associated type return bounds")]
770    pub note: (),
771}
772
773#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidUnionFieldSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InvalidUnionFieldSuggestion {
                        lo: __binding_0, hi: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_11 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("std::mem::ManuallyDrop<"))
                                });
                        let __code_12 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(">"))
                                });
                        suggestions.push((__binding_0, __code_11));
                        suggestions.push((__binding_1, __code_12));
                        diag.store_args();
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrap the field type in `ManuallyDrop<...>`")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
774#[multipart_suggestion(
775    "wrap the field type in `ManuallyDrop<...>`",
776    applicability = "machine-applicable"
777)]
778pub(crate) struct InvalidUnionFieldSuggestion {
779    #[suggestion_part(code = "std::mem::ManuallyDrop<")]
780    pub lo: Span,
781    #[suggestion_part(code = ">")]
782    pub hi: Span,
783}
784
785#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ReturnTypeNotationEqualityBound where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReturnTypeNotationEqualityBound { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type notation is not allowed to use type equality")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
786#[diag("return type notation is not allowed to use type equality")]
787pub(crate) struct ReturnTypeNotationEqualityBound {
788    #[primary_span]
789    pub span: Span,
790}
791
792#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            PlaceholderNotAllowedItemSignatures where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    PlaceholderNotAllowedItemSignatures {
                        spans: __binding_0, kind: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the placeholder `_` is not allowed within types on item signatures for {$kind}")));
                        diag.code(E0121);
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0.clone());
                        for __binding_0 in __binding_0 {
                            diag.span_label(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not allowed in type signatures")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
793#[diag("the placeholder `_` is not allowed within types on item signatures for {$kind}", code = E0121)]
794pub(crate) struct PlaceholderNotAllowedItemSignatures {
795    #[primary_span]
796    #[label("not allowed in type signatures")]
797    pub spans: Vec<Span>,
798    pub kind: String,
799}
800
801#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AssociatedItemTraitUninferredGenericParams where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AssociatedItemTraitUninferredGenericParams {
                        span: __binding_0,
                        inferred_sugg: __binding_1,
                        bound: __binding_2,
                        mpart_sugg: __binding_3,
                        what: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot use the {$what} of a trait with uninferred generic parameters")));
                        let __code_13 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        diag.code(E0212);
                        ;
                        diag.arg("bound", __binding_2);
                        diag.arg("what", __binding_4);
                        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("use a fully qualified path with inferred lifetimes")),
                                __code_13, rustc_errors::Applicability::MaybeIncorrect,
                                rustc_errors::SuggestionStyle::ShowAlways);
                        }
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
802#[diag("cannot use the {$what} of a trait with uninferred generic parameters", code = E0212)]
803pub(crate) struct AssociatedItemTraitUninferredGenericParams {
804    #[primary_span]
805    pub span: Span,
806    #[suggestion(
807        "use a fully qualified path with inferred lifetimes",
808        style = "verbose",
809        applicability = "maybe-incorrect",
810        code = "{bound}"
811    )]
812    pub inferred_sugg: Option<Span>,
813    pub bound: String,
814    #[subdiagnostic]
815    pub mpart_sugg: Option<AssociatedItemTraitUninferredGenericParamsMultipartSuggestion>,
816    pub what: &'static str,
817}
818
819#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for
            AssociatedItemTraitUninferredGenericParamsMultipartSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AssociatedItemTraitUninferredGenericParamsMultipartSuggestion {
                        fspan: __binding_0,
                        first: __binding_1,
                        sspan: __binding_2,
                        second: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_14 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                });
                        let __code_15 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("{0}", __binding_3))
                                });
                        suggestions.push((__binding_0, __code_14));
                        suggestions.push((__binding_2, __code_15));
                        diag.store_args();
                        diag.arg("first", __binding_1);
                        diag.arg("second", __binding_3);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use a fully qualified path with explicit lifetimes")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
820#[multipart_suggestion(
821    "use a fully qualified path with explicit lifetimes",
822    applicability = "maybe-incorrect"
823)]
824pub(crate) struct AssociatedItemTraitUninferredGenericParamsMultipartSuggestion {
825    #[suggestion_part(code = "{first}")]
826    pub fspan: Span,
827    pub first: String,
828    #[suggestion_part(code = "{second}")]
829    pub sspan: Span,
830    pub second: String,
831}
832
833#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EnumDiscriminantOverflowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EnumDiscriminantOverflowed {
                        span: __binding_0,
                        discr: __binding_1,
                        item_name: __binding_2,
                        wrapped_discr: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("enum discriminant overflowed")));
                        diag.code(E0370);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("explicitly set `{$item_name} = {$wrapped_discr}` if that is desired outcome")));
                        ;
                        diag.arg("discr", __binding_1);
                        diag.arg("item_name", __binding_2);
                        diag.arg("wrapped_discr", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("overflowed on value after {$discr}")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
834#[diag("enum discriminant overflowed", code = E0370)]
835#[note("explicitly set `{$item_name} = {$wrapped_discr}` if that is desired outcome")]
836pub(crate) struct EnumDiscriminantOverflowed {
837    #[primary_span]
838    #[label("overflowed on value after {$discr}")]
839    pub span: Span,
840    pub discr: String,
841    pub item_name: Ident,
842    pub wrapped_discr: String,
843}
844
845#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ParenSugarAttribute where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ParenSugarAttribute { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `#[rustc_paren_sugar]` attribute is a temporary means of controlling which traits can use parenthetical notation")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(unboxed_closures)]` to the crate attributes to use it")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
846#[diag(
847    "the `#[rustc_paren_sugar]` attribute is a temporary means of controlling which traits can use parenthetical notation"
848)]
849#[help("add `#![feature(unboxed_closures)]` to the crate attributes to use it")]
850pub(crate) struct ParenSugarAttribute {
851    #[primary_span]
852    pub span: Span,
853}
854
855#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SIMDFFIHighlyExperimental where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SIMDFFIHighlyExperimental {
                        span: __binding_0, snip: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of SIMD type{$snip} in FFI is highly experimental and may result in invalid code")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(simd_ffi)]` to the crate attributes to enable")));
                        ;
                        diag.arg("snip", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
856#[diag("use of SIMD type{$snip} in FFI is highly experimental and may result in invalid code")]
857#[help("add `#![feature(simd_ffi)]` to the crate attributes to enable")]
858pub(crate) struct SIMDFFIHighlyExperimental {
859    #[primary_span]
860    pub span: Span,
861    pub snip: String,
862}
863
864#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ImplNotMarkedDefault where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ImplNotMarkedDefault::Ok {
                        span: __binding_0, ok_label: __binding_1, ident: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` specializes an item from a parent `impl`, but that item is not marked `default`")));
                        diag.code(E0520);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to specialize, `{$ident}` in the parent `impl` must be marked `default`")));
                        ;
                        diag.arg("ident", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot specialize default item `{$ident}`")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parent `impl` is here")));
                        diag
                    }
                    ImplNotMarkedDefault::Err {
                        span: __binding_0, cname: __binding_1, ident: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` specializes an item from a parent `impl`, but that item is not marked `default`")));
                        diag.code(E0520);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parent implementation is in crate `{$cname}`")));
                        ;
                        diag.arg("cname", __binding_1);
                        diag.arg("ident", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
865pub(crate) enum ImplNotMarkedDefault {
866    #[diag("`{$ident}` specializes an item from a parent `impl`, but that item is not marked `default`", code = E0520)]
867    #[note("to specialize, `{$ident}` in the parent `impl` must be marked `default`")]
868    Ok {
869        #[primary_span]
870        #[label("cannot specialize default item `{$ident}`")]
871        span: Span,
872        #[label("parent `impl` is here")]
873        ok_label: Span,
874        ident: Ident,
875    },
876    #[diag("`{$ident}` specializes an item from a parent `impl`, but that item is not marked `default`", code = E0520)]
877    #[note("parent implementation is in crate `{$cname}`")]
878    Err {
879        #[primary_span]
880        span: Span,
881        cname: Symbol,
882        ident: Ident,
883    },
884}
885
886#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UselessImplItem where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UselessImplItem => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this item cannot be used as its where bounds are not satisfied for the `Self` type")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
887#[diag("this item cannot be used as its where bounds are not satisfied for the `Self` type")]
888pub(crate) struct UselessImplItem;
889
890#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            OverridingFinalTraitFunction where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    OverridingFinalTraitFunction {
                        impl_span: __binding_0,
                        trait_span: __binding_1,
                        ident: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot override `{$ident}` because it already has a `final` definition in the trait")));
                        ;
                        diag.arg("ident", __binding_2);
                        diag.span(__binding_0);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ident}` is marked final here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
891#[diag("cannot override `{$ident}` because it already has a `final` definition in the trait")]
892pub(crate) struct OverridingFinalTraitFunction {
893    #[primary_span]
894    pub impl_span: Span,
895    #[note("`{$ident}` is marked final here")]
896    pub trait_span: Span,
897    pub ident: Ident,
898}
899
900#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingTraitItem where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MissingTraitItem {
                        span: __binding_0,
                        missing_trait_item_label: __binding_1,
                        missing_trait_item: __binding_2,
                        missing_trait_item_none: __binding_3,
                        missing_items_msg: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not all trait items implemented, missing: `{$missing_items_msg}`")));
                        diag.code(E0046);
                        ;
                        diag.arg("missing_items_msg", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing `{$missing_items_msg}` in implementation")));
                        for __binding_1 in __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        for __binding_2 in __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        for __binding_3 in __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
901#[diag("not all trait items implemented, missing: `{$missing_items_msg}`", code = E0046)]
902pub(crate) struct MissingTraitItem {
903    #[primary_span]
904    #[label("missing `{$missing_items_msg}` in implementation")]
905    pub span: Span,
906    #[subdiagnostic]
907    pub missing_trait_item_label: Vec<MissingTraitItemLabel>,
908    #[subdiagnostic]
909    pub missing_trait_item: Vec<MissingTraitItemSuggestion>,
910    #[subdiagnostic]
911    pub missing_trait_item_none: Vec<MissingTraitItemSuggestionNone>,
912    pub missing_items_msg: String,
913}
914
915#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MissingTraitItemLabel {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MissingTraitItemLabel { span: __binding_0, item: __binding_1
                        } => {
                        diag.store_args();
                        diag.arg("item", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$item}` from trait")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
916#[label("`{$item}` from trait")]
917pub(crate) struct MissingTraitItemLabel {
918    #[primary_span]
919    pub span: Span,
920    pub item: Symbol,
921}
922
923#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MissingTraitItemSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MissingTraitItemSuggestion {
                        span: __binding_0, code: __binding_1, snippet: __binding_2 }
                        => {
                        let __code_16 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("code", __binding_1);
                        diag.arg("snippet", __binding_2);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implement the missing item: `{$snippet}`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_16, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
924#[suggestion(
925    "implement the missing item: `{$snippet}`",
926    style = "tool-only",
927    applicability = "has-placeholders",
928    code = "{code}"
929)]
930pub(crate) struct MissingTraitItemSuggestion {
931    #[primary_span]
932    pub span: Span,
933    pub code: String,
934    pub snippet: String,
935}
936
937#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MissingTraitItemSuggestionNone {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MissingTraitItemSuggestionNone {
                        span: __binding_0, code: __binding_1, snippet: __binding_2 }
                        => {
                        let __code_17 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("code", __binding_1);
                        diag.arg("snippet", __binding_2);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implement the missing item: `{$snippet}`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_17, rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::HideCodeAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
938#[suggestion(
939    "implement the missing item: `{$snippet}`",
940    style = "hidden",
941    applicability = "has-placeholders",
942    code = "{code}"
943)]
944pub(crate) struct MissingTraitItemSuggestionNone {
945    #[primary_span]
946    pub span: Span,
947    pub code: String,
948    pub snippet: String,
949}
950
951#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingOneOfTraitItem where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MissingOneOfTraitItem {
                        span: __binding_0,
                        note: __binding_1,
                        missing_items_msg: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not all trait items implemented, missing one of: `{$missing_items_msg}`")));
                        diag.code(E0046);
                        ;
                        diag.arg("missing_items_msg", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing one of `{$missing_items_msg}` in implementation")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_note(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("required because of this annotation")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
952#[diag("not all trait items implemented, missing one of: `{$missing_items_msg}`", code = E0046)]
953pub(crate) struct MissingOneOfTraitItem {
954    #[primary_span]
955    #[label("missing one of `{$missing_items_msg}` in implementation")]
956    pub span: Span,
957    #[note("required because of this annotation")]
958    pub note: Option<Span>,
959    pub missing_items_msg: String,
960}
961
962#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingTraitItemUnstable where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MissingTraitItemUnstable {
                        span: __binding_0,
                        some_note: __binding_1,
                        none_note: __binding_2,
                        missing_item_name: __binding_3,
                        feature: __binding_4,
                        reason: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not all trait items implemented, missing: `{$missing_item_name}`")));
                        diag.code(E0046);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("default implementation of `{$missing_item_name}` is unstable")));
                        ;
                        diag.arg("missing_item_name", __binding_3);
                        diag.arg("feature", __binding_4);
                        diag.arg("reason", __binding_5);
                        diag.span(__binding_0);
                        if __binding_1 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unstable library feature `{$feature}`: {$reason}")));
                        }
                        if __binding_2 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of unstable library feature `{$feature}`")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
963#[diag("not all trait items implemented, missing: `{$missing_item_name}`", code = E0046)]
964#[note("default implementation of `{$missing_item_name}` is unstable")]
965pub(crate) struct MissingTraitItemUnstable {
966    #[primary_span]
967    pub span: Span,
968    #[note("use of unstable library feature `{$feature}`: {$reason}")]
969    pub some_note: bool,
970    #[note("use of unstable library feature `{$feature}`")]
971    pub none_note: bool,
972    pub missing_item_name: Ident,
973    pub feature: Symbol,
974    pub reason: String,
975}
976
977#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TransparentEnumVariant where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TransparentEnumVariant {
                        span: __binding_0,
                        spans: __binding_1,
                        many: __binding_2,
                        number: __binding_3,
                        path: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("transparent enum needs exactly one variant, but has {$number}")));
                        diag.code(E0731);
                        ;
                        diag.arg("number", __binding_3);
                        diag.arg("path", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("needs exactly one variant, but has {$number}")));
                        for __binding_1 in __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("variant here")));
                        }
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_label(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("too many variants in `{$path}`")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
978#[diag("transparent enum needs exactly one variant, but has {$number}", code = E0731)]
979pub(crate) struct TransparentEnumVariant {
980    #[primary_span]
981    #[label("needs exactly one variant, but has {$number}")]
982    pub span: Span,
983    #[label("variant here")]
984    pub spans: Vec<Span>,
985    #[label("too many variants in `{$path}`")]
986    pub many: Option<Span>,
987    pub number: usize,
988    pub path: String,
989}
990
991#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            TransparentNonZeroSizedEnum<'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 {
                    TransparentNonZeroSizedEnum {
                        span: __binding_0,
                        spans: __binding_1,
                        field_count: __binding_2,
                        desc: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the variant of a transparent {$desc} needs at most one field with non-trivial size or alignment, but has {$field_count}")));
                        diag.code(E0690);
                        ;
                        diag.arg("field_count", __binding_2);
                        diag.arg("desc", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("needs at most one field with non-trivial size or alignment, but has {$field_count}")));
                        for __binding_1 in __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this field has non-zero size or requires alignment")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
992#[diag("the variant of a transparent {$desc} needs at most one field with non-trivial size or alignment, but has {$field_count}", code = E0690)]
993pub(crate) struct TransparentNonZeroSizedEnum<'a> {
994    #[primary_span]
995    #[label("needs at most one field with non-trivial size or alignment, but has {$field_count}")]
996    pub span: Span,
997    #[label("this field has non-zero size or requires alignment")]
998    pub spans: Vec<Span>,
999    pub field_count: usize,
1000    pub desc: &'a str,
1001}
1002
1003#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            TransparentNonZeroSized<'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 {
                    TransparentNonZeroSized {
                        span: __binding_0,
                        spans: __binding_1,
                        field_count: __binding_2,
                        desc: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("transparent {$desc} needs at most one field with non-trivial size or alignment, but has {$field_count}")));
                        diag.code(E0690);
                        ;
                        diag.arg("field_count", __binding_2);
                        diag.arg("desc", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("needs at most one field with non-trivial size or alignment, but has {$field_count}")));
                        for __binding_1 in __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this field has non-zero size or requires alignment")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1004#[diag("transparent {$desc} needs at most one field with non-trivial size or alignment, but has {$field_count}", code = E0690)]
1005pub(crate) struct TransparentNonZeroSized<'a> {
1006    #[primary_span]
1007    #[label("needs at most one field with non-trivial size or alignment, but has {$field_count}")]
1008    pub span: Span,
1009    #[label("this field has non-zero size or requires alignment")]
1010    pub spans: Vec<Span>,
1011    pub field_count: usize,
1012    pub desc: &'a str,
1013}
1014
1015#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for TooLargeStatic
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TooLargeStatic { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern static is too large for the target architecture")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1016#[diag("extern static is too large for the target architecture")]
1017pub(crate) struct TooLargeStatic {
1018    #[primary_span]
1019    pub span: Span,
1020}
1021
1022#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SpecializationTrait where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SpecializationTrait { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementing `rustc_specialization_trait` traits is unstable")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(min_specialization)]` to the crate attributes to enable")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1023#[diag("implementing `rustc_specialization_trait` traits is unstable")]
1024#[help("add `#![feature(min_specialization)]` to the crate attributes to enable")]
1025pub(crate) struct SpecializationTrait {
1026    #[primary_span]
1027    pub span: Span,
1028}
1029
1030#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ClosureImplicitHrtb where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ClosureImplicitHrtb {
                        spans: __binding_0, for_sp: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implicit types in closure signatures are forbidden when `for<...>` is present")));
                        ;
                        diag.span(__binding_0.clone());
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`for<...>` is here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1031#[diag("implicit types in closure signatures are forbidden when `for<...>` is present")]
1032pub(crate) struct ClosureImplicitHrtb {
1033    #[primary_span]
1034    pub spans: Vec<Span>,
1035    #[label("`for<...>` is here")]
1036    pub for_sp: Span,
1037}
1038
1039#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EmptySpecialization where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EmptySpecialization {
                        span: __binding_0, base_impl_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("specialization impl does not specialize any associated items")));
                        ;
                        diag.span(__binding_0);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl is a specialization of this impl")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1040#[diag("specialization impl does not specialize any associated items")]
1041pub(crate) struct EmptySpecialization {
1042    #[primary_span]
1043    pub span: Span,
1044    #[note("impl is a specialization of this impl")]
1045    pub base_impl_span: Span,
1046}
1047
1048#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            StaticSpecialize where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    StaticSpecialize { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot specialize on `'static` lifetime")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1049#[diag("cannot specialize on `'static` lifetime")]
1050pub(crate) struct StaticSpecialize {
1051    #[primary_span]
1052    pub span: Span,
1053}
1054
1055#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DropImplPolarity where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DropImplPolarity::Negative { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative `Drop` impls are not supported")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                    DropImplPolarity::Reservation { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reservation `Drop` impls are not supported")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1056pub(crate) enum DropImplPolarity {
1057    #[diag("negative `Drop` impls are not supported")]
1058    Negative {
1059        #[primary_span]
1060        span: Span,
1061    },
1062    #[diag("reservation `Drop` impls are not supported")]
1063    Reservation {
1064        #[primary_span]
1065        span: Span,
1066    },
1067}
1068
1069#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ReturnTypeNotationIllegalParam where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReturnTypeNotationIllegalParam::Type {
                        span: __binding_0, param_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type notation is not allowed for functions that have type parameters")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter declared here")));
                        diag
                    }
                    ReturnTypeNotationIllegalParam::Const {
                        span: __binding_0, param_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type notation is not allowed for functions that have const parameters")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const parameter declared here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1070pub(crate) enum ReturnTypeNotationIllegalParam {
1071    #[diag("return type notation is not allowed for functions that have type parameters")]
1072    Type {
1073        #[primary_span]
1074        span: Span,
1075        #[label("type parameter declared here")]
1076        param_span: Span,
1077    },
1078    #[diag("return type notation is not allowed for functions that have const parameters")]
1079    Const {
1080        #[primary_span]
1081        span: Span,
1082        #[label("const parameter declared here")]
1083        param_span: Span,
1084    },
1085}
1086
1087#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LateBoundInApit where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LateBoundInApit::Type {
                        span: __binding_0, param_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait` can only mention type parameters from an fn or impl")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter declared here")));
                        diag
                    }
                    LateBoundInApit::Const {
                        span: __binding_0, param_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait` can only mention const parameters from an fn or impl")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const parameter declared here")));
                        diag
                    }
                    LateBoundInApit::Lifetime {
                        span: __binding_0, param_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait` can only mention lifetimes from an fn or impl")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime declared here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1088pub(crate) enum LateBoundInApit {
1089    #[diag("`impl Trait` can only mention type parameters from an fn or impl")]
1090    Type {
1091        #[primary_span]
1092        span: Span,
1093        #[label("type parameter declared here")]
1094        param_span: Span,
1095    },
1096    #[diag("`impl Trait` can only mention const parameters from an fn or impl")]
1097    Const {
1098        #[primary_span]
1099        span: Span,
1100        #[label("const parameter declared here")]
1101        param_span: Span,
1102    },
1103    #[diag("`impl Trait` can only mention lifetimes from an fn or impl")]
1104    Lifetime {
1105        #[primary_span]
1106        span: Span,
1107        #[label("lifetime declared here")]
1108        param_span: Span,
1109    },
1110}
1111
1112#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnusedAssociatedTypeBounds where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnusedAssociatedTypeBounds { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unnecessary associated type bound for dyn-incompatible associated type")));
                        let __code_18 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized`")));
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this bound")),
                            __code_18, rustc_errors::Applicability::Unspecified,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1113#[diag("unnecessary associated type bound for dyn-incompatible associated type")]
1114#[note(
1115    "this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized`"
1116)]
1117pub(crate) struct UnusedAssociatedTypeBounds {
1118    #[suggestion("remove this bound", code = "")]
1119    pub span: Span,
1120}
1121
1122#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ReturnPositionImplTraitInTraitRefined where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReturnPositionImplTraitInTraitRefined {
                        impl_return_span: __binding_0,
                        trait_return_span: __binding_1,
                        unmatched_bound: __binding_2,
                        pre: __binding_3,
                        post: __binding_4,
                        return_ty: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl trait in impl method signature does not match trait method signature")));
                        let __code_19 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{1}{2}{0}", __binding_4,
                                                        __binding_3, __binding_5))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information")));
                        ;
                        diag.arg("pre", __binding_3);
                        diag.arg("post", __binding_4);
                        diag.arg("return_ty", __binding_5);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("replace the return type so that it matches the trait")),
                            __code_19, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type from trait method defined here")));
                        }
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_label(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this bound is stronger than that defined on the trait")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1123#[diag("impl trait in impl method signature does not match trait method signature")]
1124#[note(
1125    "add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate"
1126)]
1127#[note(
1128    "we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information"
1129)]
1130pub(crate) struct ReturnPositionImplTraitInTraitRefined {
1131    #[suggestion(
1132        "replace the return type so that it matches the trait",
1133        applicability = "maybe-incorrect",
1134        code = "{pre}{return_ty}{post}"
1135    )]
1136    pub impl_return_span: Span,
1137    #[label("return type from trait method defined here")]
1138    pub trait_return_span: Option<Span>,
1139    #[label("this bound is stronger than that defined on the trait")]
1140    pub unmatched_bound: Option<Span>,
1141
1142    pub pre: &'static str,
1143    pub post: &'static str,
1144    pub return_ty: String,
1145}
1146
1147#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ReturnPositionImplTraitInTraitRefinedLifetimes where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReturnPositionImplTraitInTraitRefinedLifetimes {
                        suggestion_span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl trait in impl method captures fewer lifetimes than in trait")));
                        let __code_20 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information")));
                        ;
                        diag.arg("suggestion", __binding_1);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("modify the `use<..>` bound to capture the same lifetimes that the trait does")),
                            __code_20, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1148#[diag("impl trait in impl method captures fewer lifetimes than in trait")]
1149#[note(
1150    "add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate"
1151)]
1152#[note(
1153    "we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information"
1154)]
1155pub(crate) struct ReturnPositionImplTraitInTraitRefinedLifetimes {
1156    #[suggestion(
1157        "modify the `use<..>` bound to capture the same lifetimes that the trait does",
1158        applicability = "maybe-incorrect",
1159        code = "{suggestion}"
1160    )]
1161    pub suggestion_span: Span,
1162    pub suggestion: String,
1163}
1164
1165#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InherentTyOutside where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InherentTyOutside { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define inherent `impl` for a type outside of the crate where the type is defined")));
                        diag.code(E0390);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider moving this inherent impl into the crate defining the type if possible")));
                        ;
                        diag.span(__binding_0);
                        diag.span_help(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1166#[diag("cannot define inherent `impl` for a type outside of the crate where the type is defined", code = E0390)]
1167#[help("consider moving this inherent impl into the crate defining the type if possible")]
1168pub(crate) struct InherentTyOutside {
1169    #[primary_span]
1170    #[help(
1171        "alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items"
1172    )]
1173    pub span: Span,
1174}
1175
1176#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DispatchFromDynRepr where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DispatchFromDynRepr { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]`")));
                        diag.code(E0378);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1177#[diag("structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]`", code = E0378)]
1178pub(crate) struct DispatchFromDynRepr {
1179    #[primary_span]
1180    pub span: Span,
1181}
1182
1183#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CoercePointeeNotStruct where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoercePointeeNotStruct {
                        span: __binding_0, kind: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`derive(CoercePointee)` is only applicable to `struct`, instead of `{$kind}`")));
                        diag.code(E0802);
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1184#[diag("`derive(CoercePointee)` is only applicable to `struct`, instead of `{$kind}`", code = E0802)]
1185pub(crate) struct CoercePointeeNotStruct {
1186    #[primary_span]
1187    pub span: Span,
1188    pub kind: String,
1189}
1190
1191#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CoercePointeeNotConcreteType where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoercePointeeNotConcreteType { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`derive(CoercePointee)` is only applicable to `struct`")));
                        diag.code(E0802);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1192#[diag("`derive(CoercePointee)` is only applicable to `struct`", code = E0802)]
1193pub(crate) struct CoercePointeeNotConcreteType {
1194    #[primary_span]
1195    pub span: Span,
1196}
1197
1198#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CoercePointeeNoUserValidityAssertion where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoercePointeeNoUserValidityAssertion { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("asserting applicability of `derive(CoercePointee)` on a target data is forbidden")));
                        diag.code(E0802);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1199#[diag("asserting applicability of `derive(CoercePointee)` on a target data is forbidden", code = E0802)]
1200pub(crate) struct CoercePointeeNoUserValidityAssertion {
1201    #[primary_span]
1202    pub span: Span,
1203}
1204
1205#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CoercePointeeNotTransparent where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoercePointeeNotTransparent { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout")));
                        diag.code(E0802);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1206#[diag("`derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout", code = E0802)]
1207pub(crate) struct CoercePointeeNotTransparent {
1208    #[primary_span]
1209    pub span: Span,
1210}
1211
1212#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CoercePointeeNoField where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoercePointeeNoField { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`CoercePointee` can only be derived on `struct`s with at least one field")));
                        diag.code(E0802);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1213#[diag("`CoercePointee` can only be derived on `struct`s with at least one field", code = E0802)]
1214pub(crate) struct CoercePointeeNoField {
1215    #[primary_span]
1216    pub span: Span,
1217}
1218
1219#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InherentTyOutsideRelevant where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InherentTyOutsideRelevant {
                        span: __binding_0, help_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define inherent `impl` for a type outside of the crate where the type is defined")));
                        diag.code(E0390);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider moving this inherent impl into the crate defining the type if possible")));
                        ;
                        diag.span(__binding_0);
                        diag.span_help(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1220#[diag("cannot define inherent `impl` for a type outside of the crate where the type is defined", code = E0390)]
1221#[help("consider moving this inherent impl into the crate defining the type if possible")]
1222pub(crate) struct InherentTyOutsideRelevant {
1223    #[primary_span]
1224    pub span: Span,
1225    #[help("alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items")]
1226    pub help_span: Span,
1227}
1228
1229#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InherentTyOutsideNew where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InherentTyOutsideNew { span: __binding_0, note: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define inherent `impl` for a type outside of the crate where the type is defined")));
                        diag.code(E0116);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider defining a trait and implementing it for the type or using a newtype wrapper like `struct MyType(ExternalType);` and implement it")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more details about the orphan rules, see <https://doc.rust-lang.org/reference/items/implementations.html?highlight=orphan#orphan-rules>")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl for type defined outside of crate")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1230#[diag("cannot define inherent `impl` for a type outside of the crate where the type is defined", code = E0116)]
1231#[help(
1232    "consider defining a trait and implementing it for the type or using a newtype wrapper like `struct MyType(ExternalType);` and implement it"
1233)]
1234#[note(
1235    "for more details about the orphan rules, see <https://doc.rust-lang.org/reference/items/implementations.html?highlight=orphan#orphan-rules>"
1236)]
1237pub(crate) struct InherentTyOutsideNew {
1238    #[primary_span]
1239    #[label("impl for type defined outside of crate")]
1240    pub span: Span,
1241    #[subdiagnostic]
1242    pub note: Option<InherentTyOutsideNewAliasNote>,
1243}
1244
1245#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InherentTyOutsideNewAliasNote {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InherentTyOutsideNewAliasNote {
                        span: __binding_0,
                        ty_name: __binding_1,
                        alias_ty_name: __binding_2 } => {
                        diag.store_args();
                        diag.arg("ty_name", __binding_1);
                        diag.arg("alias_ty_name", __binding_2);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ty_name}` does not define a new type, only an alias of `{$alias_ty_name}` defined here")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1246#[note("`{$ty_name}` does not define a new type, only an alias of `{$alias_ty_name}` defined here")]
1247pub(crate) struct InherentTyOutsideNewAliasNote {
1248    #[primary_span]
1249    pub span: Span,
1250    pub ty_name: String,
1251    pub alias_ty_name: String,
1252}
1253
1254#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InherentTyOutsidePrimitive where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InherentTyOutsidePrimitive {
                        span: __binding_0, help_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define inherent `impl` for primitive types outside of `core`")));
                        diag.code(E0390);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider moving this inherent impl into `core` if possible")));
                        ;
                        diag.span(__binding_0);
                        diag.span_help(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1255#[diag("cannot define inherent `impl` for primitive types outside of `core`", code = E0390)]
1256#[help("consider moving this inherent impl into `core` if possible")]
1257pub(crate) struct InherentTyOutsidePrimitive {
1258    #[primary_span]
1259    pub span: Span,
1260    #[help("alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items")]
1261    pub help_span: Span,
1262}
1263
1264#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            InherentPrimitiveTy<'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 {
                    InherentPrimitiveTy { span: __binding_0, note: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define inherent `impl` for primitive types")));
                        diag.code(E0390);
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using an extension trait instead")));
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1265#[diag("cannot define inherent `impl` for primitive types", code = E0390)]
1266#[help("consider using an extension trait instead")]
1267pub(crate) struct InherentPrimitiveTy<'a> {
1268    #[primary_span]
1269    pub span: Span,
1270    #[subdiagnostic]
1271    pub note: Option<InherentPrimitiveTyNote<'a>>,
1272}
1273
1274#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for InherentPrimitiveTyNote<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InherentPrimitiveTyNote { subty: __binding_0 } => {
                        diag.store_args();
                        diag.arg("subty", __binding_0);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you could also try moving the reference to uses of `{$subty}` (such as `self`) within the implementation")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1275#[note(
1276    "you could also try moving the reference to uses of `{$subty}` (such as `self`) within the implementation"
1277)]
1278pub(crate) struct InherentPrimitiveTyNote<'a> {
1279    pub subty: Ty<'a>,
1280}
1281
1282#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for InherentDyn
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InherentDyn { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define inherent `impl` for a dyn auto trait")));
                        diag.code(E0785);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("define and implement a new trait or type instead")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl requires at least one non-auto trait")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1283#[diag("cannot define inherent `impl` for a dyn auto trait", code = E0785)]
1284#[note("define and implement a new trait or type instead")]
1285pub(crate) struct InherentDyn {
1286    #[primary_span]
1287    #[label("impl requires at least one non-auto trait")]
1288    pub span: Span,
1289}
1290
1291#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InherentNominal where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InherentNominal { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no nominal type found for inherent implementation")));
                        diag.code(E0118);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("either implement a trait on it or create a newtype to wrap it instead")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl requires a nominal type")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1292#[diag("no nominal type found for inherent implementation", code = E0118)]
1293#[note("either implement a trait on it or create a newtype to wrap it instead")]
1294pub(crate) struct InherentNominal {
1295    #[primary_span]
1296    #[label("impl requires a nominal type")]
1297    pub span: Span,
1298}
1299
1300#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            DispatchFromDynZST<'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 {
                    DispatchFromDynZST {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment that don't mention type/const generics, and nothing else")));
                        diag.code(E0378);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extra field `{$name}` of type `{$ty}` is not allowed")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1301#[diag("the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment that don't mention type/const generics, and nothing else", code = E0378)]
1302#[note("extra field `{$name}` of type `{$ty}` is not allowed")]
1303pub(crate) struct DispatchFromDynZST<'a> {
1304    #[primary_span]
1305    pub span: Span,
1306    pub name: Ident,
1307    pub ty: Ty<'a>,
1308}
1309
1310#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CoerceNoField
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoerceNoField {
                        span: __binding_0,
                        trait_name: __binding_1,
                        note: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementing `{$trait_name}` requires a field to be coerced")));
                        diag.code(E0374);
                        ;
                        diag.arg("trait_name", __binding_1);
                        diag.span(__binding_0);
                        if __binding_2 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a single field to be coerced, none found")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1311#[diag("implementing `{$trait_name}` requires a field to be coerced", code = E0374)]
1312pub(crate) struct CoerceNoField {
1313    #[primary_span]
1314    pub span: Span,
1315    pub trait_name: &'static str,
1316    #[note("expected a single field to be coerced, none found")]
1317    pub note: bool,
1318}
1319
1320#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CoerceMulti
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoerceMulti {
                        trait_name: __binding_0,
                        span: __binding_1,
                        number: __binding_2,
                        fields: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementing `{$trait_name}` does not allow multiple fields to be coerced")));
                        diag.code(E0375);
                        ;
                        diag.arg("trait_name", __binding_0);
                        diag.arg("number", __binding_2);
                        diag.span(__binding_1);
                        diag.span_note(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the trait `{$trait_name}` may only be implemented when a single field is being coerced")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1321#[diag("implementing `{$trait_name}` does not allow multiple fields to be coerced", code = E0375)]
1322pub(crate) struct CoerceMulti {
1323    pub trait_name: &'static str,
1324    #[primary_span]
1325    pub span: Span,
1326    pub number: usize,
1327    #[note(
1328        "the trait `{$trait_name}` may only be implemented when a single field is being coerced"
1329    )]
1330    pub fields: MultiSpan,
1331}
1332
1333#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CoerceUnsizedNonStruct where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoerceUnsizedNonStruct {
                        span: __binding_0, trait_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the trait `{$trait_name}` may only be implemented for a coercion between structures")));
                        diag.code(E0377);
                        ;
                        diag.arg("trait_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1334#[diag("the trait `{$trait_name}` may only be implemented for a coercion between structures", code = E0377)]
1335pub(crate) struct CoerceUnsizedNonStruct {
1336    #[primary_span]
1337    pub span: Span,
1338    pub trait_name: &'static str,
1339}
1340
1341#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CoerceSamePatKind where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoerceSamePatKind {
                        span: __binding_0,
                        trait_name: __binding_1,
                        pat_a: __binding_2,
                        pat_b: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only pattern types with the same pattern can be coerced between each other")));
                        ;
                        diag.arg("trait_name", __binding_1);
                        diag.arg("pat_a", __binding_2);
                        diag.arg("pat_b", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1342#[diag("only pattern types with the same pattern can be coerced between each other")]
1343pub(crate) struct CoerceSamePatKind {
1344    #[primary_span]
1345    pub span: Span,
1346    pub trait_name: &'static str,
1347    pub pat_a: String,
1348    pub pat_b: String,
1349}
1350
1351#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CoerceSameStruct where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoerceSameStruct {
                        span: __binding_0,
                        trait_name: __binding_1,
                        note: __binding_2,
                        source_path: __binding_3,
                        target_path: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the trait `{$trait_name}` may only be implemented for a coercion between structures")));
                        diag.code(E0377);
                        ;
                        diag.arg("trait_name", __binding_1);
                        diag.arg("source_path", __binding_3);
                        diag.arg("target_path", __binding_4);
                        diag.span(__binding_0);
                        if __binding_2 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected coercion between the same definition; expected `{$source_path}`, found `{$target_path}`")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1352#[diag("the trait `{$trait_name}` may only be implemented for a coercion between structures", code = E0377)]
1353pub(crate) struct CoerceSameStruct {
1354    #[primary_span]
1355    pub span: Span,
1356    pub trait_name: &'static str,
1357    #[note(
1358        "expected coercion between the same definition; expected `{$source_path}`, found `{$target_path}`"
1359    )]
1360    pub note: bool,
1361    pub source_path: String,
1362    pub target_path: String,
1363}
1364
1365#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            CoerceFieldValidity<'tcx> where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CoerceFieldValidity {
                        span: __binding_0,
                        ty: __binding_1,
                        trait_name: __binding_2,
                        field_span: __binding_3,
                        field_ty: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for `{$ty}` to have a valid implementation of `{$trait_name}`, it must be possible to coerce the field of type `{$field_ty}`")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("trait_name", __binding_2);
                        diag.arg("field_ty", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$field_ty}` must be a pointer, reference, or smart pointer that is allowed to be unsized")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1366#[diag(
1367    "for `{$ty}` to have a valid implementation of `{$trait_name}`, it must be possible to coerce the field of type `{$field_ty}`"
1368)]
1369pub(crate) struct CoerceFieldValidity<'tcx> {
1370    #[primary_span]
1371    pub span: Span,
1372    pub ty: Ty<'tcx>,
1373    pub trait_name: &'static str,
1374    #[label(
1375        "`{$field_ty}` must be a pointer, reference, or smart pointer that is allowed to be unsized"
1376    )]
1377    pub field_span: Span,
1378    pub field_ty: Ty<'tcx>,
1379}
1380
1381#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TraitCannotImplForTy where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TraitCannotImplForTy {
                        span: __binding_0,
                        trait_name: __binding_1,
                        label_spans: __binding_2,
                        notes: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the trait `{$trait_name}` cannot be implemented for this type")));
                        diag.code(E0204);
                        ;
                        diag.arg("trait_name", __binding_1);
                        diag.span(__binding_0);
                        for __binding_2 in __binding_2 {
                            diag.span_label(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this field does not implement `{$trait_name}`")));
                        }
                        for __binding_3 in __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1382#[diag("the trait `{$trait_name}` cannot be implemented for this type", code = E0204)]
1383pub(crate) struct TraitCannotImplForTy {
1384    #[primary_span]
1385    pub span: Span,
1386    pub trait_name: String,
1387    #[label("this field does not implement `{$trait_name}`")]
1388    pub label_spans: Vec<Span>,
1389    #[subdiagnostic]
1390    pub notes: Vec<ImplForTyRequires>,
1391}
1392
1393#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ImplForTyRequires {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ImplForTyRequires {
                        span: __binding_0,
                        error_predicate: __binding_1,
                        trait_name: __binding_2,
                        ty: __binding_3 } => {
                        diag.store_args();
                        diag.arg("error_predicate", __binding_1);
                        diag.arg("trait_name", __binding_2);
                        diag.arg("ty", __binding_3);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$trait_name}` impl for `{$ty}` requires that `{$error_predicate}`")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1394#[note("the `{$trait_name}` impl for `{$ty}` requires that `{$error_predicate}`")]
1395pub(crate) struct ImplForTyRequires {
1396    #[primary_span]
1397    pub span: MultiSpan,
1398    pub error_predicate: String,
1399    pub trait_name: String,
1400    pub ty: String,
1401}
1402
1403#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            TraitsWithDefaultImpl<'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 {
                    TraitsWithDefaultImpl {
                        span: __binding_0,
                        traits: __binding_1,
                        problematic_kind: __binding_2,
                        self_ty: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("traits with a default impl, like `{$traits}`, cannot be implemented for {$problematic_kind} `{$self_ty}`")));
                        diag.code(E0321);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a trait object implements `{$traits}` if and only if `{$traits}` is one of the trait object's trait bounds")));
                        ;
                        diag.arg("traits", __binding_1);
                        diag.arg("problematic_kind", __binding_2);
                        diag.arg("self_ty", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1404#[diag("traits with a default impl, like `{$traits}`, cannot be implemented for {$problematic_kind} `{$self_ty}`", code = E0321)]
1405#[note(
1406    "a trait object implements `{$traits}` if and only if `{$traits}` is one of the trait object's trait bounds"
1407)]
1408pub(crate) struct TraitsWithDefaultImpl<'a> {
1409    #[primary_span]
1410    pub span: Span,
1411    pub traits: String,
1412    pub problematic_kind: &'a str,
1413    pub self_ty: Ty<'a>,
1414}
1415
1416#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            CrossCrateTraits<'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 {
                    CrossCrateTraits {
                        span: __binding_0, traits: __binding_1, self_ty: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cross-crate traits with a default impl, like `{$traits}`, can only be implemented for a struct/enum type, not `{$self_ty}`")));
                        diag.code(E0321);
                        ;
                        diag.arg("traits", __binding_1);
                        diag.arg("self_ty", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't implement cross-crate trait with a default impl for non-struct/enum type")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1417#[diag("cross-crate traits with a default impl, like `{$traits}`, can only be implemented for a struct/enum type, not `{$self_ty}`", code = E0321)]
1418pub(crate) struct CrossCrateTraits<'a> {
1419    #[primary_span]
1420    #[label("can't implement cross-crate trait with a default impl for non-struct/enum type")]
1421    pub span: Span,
1422    pub traits: String,
1423    pub self_ty: Ty<'a>,
1424}
1425
1426#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CrossCrateTraitsDefined where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CrossCrateTraitsDefined {
                        span: __binding_0, traits: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cross-crate traits with a default impl, like `{$traits}`, can only be implemented for a struct/enum type defined in the current crate")));
                        diag.code(E0321);
                        ;
                        diag.arg("traits", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't implement cross-crate trait for type in another crate")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1427#[diag("cross-crate traits with a default impl, like `{$traits}`, can only be implemented for a struct/enum type defined in the current crate", code = E0321)]
1428pub(crate) struct CrossCrateTraitsDefined {
1429    #[primary_span]
1430    #[label("can't implement cross-crate trait for type in another crate")]
1431    pub span: Span,
1432    pub traits: String,
1433}
1434
1435#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            NoVariantNamed<'tcx> where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NoVariantNamed {
                        span: __binding_0, ident: __binding_1, ty: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no variant named `{$ident}` found for enum `{$ty}`")));
                        diag.code(E0599);
                        ;
                        diag.arg("ident", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1436#[diag("no variant named `{$ident}` found for enum `{$ty}`", code = E0599)]
1437pub struct NoVariantNamed<'tcx> {
1438    #[primary_span]
1439    pub span: Span,
1440    pub ident: Ident,
1441    pub ty: Ty<'tcx>,
1442}
1443
1444#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            NoFieldOnType<'tcx> where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NoFieldOnType {
                        span: __binding_0, ty: __binding_1, field: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no field `{$field}` on type `{$ty}`")));
                        diag.code(E0609);
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("field", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1445#[diag("no field `{$field}` on type `{$ty}`", code = E0609)]
1446pub struct NoFieldOnType<'tcx> {
1447    #[primary_span]
1448    pub span: Span,
1449    pub ty: Ty<'tcx>,
1450    pub field: Ident,
1451}
1452
1453// FIXME(fmease): Deduplicate:
1454
1455#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            TyParamFirstLocal<'tcx> where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TyParamFirstLocal {
                        span: __binding_0,
                        note: __binding_1,
                        param: __binding_2,
                        local_type: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)")));
                        diag.code(E0210);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type")));
                        ;
                        diag.arg("param", __binding_2);
                        diag.arg("local_type", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1456#[diag("type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)", code = E0210)]
1457#[note(
1458    "implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type"
1459)]
1460pub(crate) struct TyParamFirstLocal<'tcx> {
1461    #[primary_span]
1462    #[label(
1463        "type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)"
1464    )]
1465    pub span: Span,
1466    #[note(
1467        "in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last"
1468    )]
1469    pub note: (),
1470    pub param: Ident,
1471    pub local_type: Ty<'tcx>,
1472}
1473
1474#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            TyParamFirstLocalLint<'tcx> where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TyParamFirstLocalLint {
                        span: __binding_0,
                        note: __binding_1,
                        param: __binding_2,
                        local_type: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)")));
                        diag.code(E0210);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type")));
                        ;
                        diag.arg("param", __binding_2);
                        diag.arg("local_type", __binding_3);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1475#[diag("type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)", code = E0210)]
1476#[note(
1477    "implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type"
1478)]
1479pub(crate) struct TyParamFirstLocalLint<'tcx> {
1480    #[label(
1481        "type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)"
1482    )]
1483    pub span: Span,
1484    #[note(
1485        "in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last"
1486    )]
1487    pub note: (),
1488    pub param: Ident,
1489    pub local_type: Ty<'tcx>,
1490}
1491
1492#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for TyParamSome
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TyParamSome {
                        span: __binding_0, note: __binding_1, param: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter `{$param}` must be used as the type parameter for some local type (e.g., `MyStruct<{$param}>`)")));
                        diag.code(E0210);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementing a foreign trait is only possible if at least one of the types for which it is implemented is local")));
                        ;
                        diag.arg("param", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter `{$param}` must be used as the type parameter for some local type")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only traits defined in the current crate can be implemented for a type parameter")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1493#[diag("type parameter `{$param}` must be used as the type parameter for some local type (e.g., `MyStruct<{$param}>`)", code = E0210)]
1494#[note(
1495    "implementing a foreign trait is only possible if at least one of the types for which it is implemented is local"
1496)]
1497pub(crate) struct TyParamSome {
1498    #[primary_span]
1499    #[label("type parameter `{$param}` must be used as the type parameter for some local type")]
1500    pub span: Span,
1501    #[note("only traits defined in the current crate can be implemented for a type parameter")]
1502    pub note: (),
1503    pub param: Ident,
1504}
1505
1506#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TyParamSomeLint where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TyParamSomeLint {
                        span: __binding_0, note: __binding_1, param: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter `{$param}` must be used as the type parameter for some local type (e.g., `MyStruct<{$param}>`)")));
                        diag.code(E0210);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("implementing a foreign trait is only possible if at least one of the types for which it is implemented is local")));
                        ;
                        diag.arg("param", __binding_2);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type parameter `{$param}` must be used as the type parameter for some local type")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only traits defined in the current crate can be implemented for a type parameter")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1507#[diag("type parameter `{$param}` must be used as the type parameter for some local type (e.g., `MyStruct<{$param}>`)", code = E0210)]
1508#[note(
1509    "implementing a foreign trait is only possible if at least one of the types for which it is implemented is local"
1510)]
1511pub(crate) struct TyParamSomeLint {
1512    #[label("type parameter `{$param}` must be used as the type parameter for some local type")]
1513    pub span: Span,
1514    #[note("only traits defined in the current crate can be implemented for a type parameter")]
1515    pub note: (),
1516    pub param: Ident,
1517}
1518
1519#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            OnlyCurrentTraits where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    OnlyCurrentTraits::Outside {
                        span: __binding_0, note: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only traits defined in the current crate can be implemented for types defined outside of the crate")));
                        diag.code(E0117);
                        ;
                        diag.span(__binding_0);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl doesn't have any local type before any uncovered type parameters")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("define and implement a trait or new type instead")));
                        diag
                    }
                    OnlyCurrentTraits::Primitive {
                        span: __binding_0, note: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only traits defined in the current crate can be implemented for primitive types")));
                        diag.code(E0117);
                        ;
                        diag.span(__binding_0);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl doesn't have any local type before any uncovered type parameters")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("define and implement a trait or new type instead")));
                        diag
                    }
                    OnlyCurrentTraits::Arbitrary {
                        span: __binding_0, note: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only traits defined in the current crate can be implemented for arbitrary types")));
                        diag.code(E0117);
                        ;
                        diag.span(__binding_0);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl doesn't have any local type before any uncovered type parameters")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("define and implement a trait or new type instead")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1520pub(crate) enum OnlyCurrentTraits {
1521    #[diag("only traits defined in the current crate can be implemented for types defined outside of the crate", code = E0117)]
1522    Outside {
1523        #[primary_span]
1524        span: Span,
1525        #[note("impl doesn't have any local type before any uncovered type parameters")]
1526        #[note(
1527            "for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules"
1528        )]
1529        #[note("define and implement a trait or new type instead")]
1530        note: (),
1531    },
1532    #[diag("only traits defined in the current crate can be implemented for primitive types", code = E0117)]
1533    Primitive {
1534        #[primary_span]
1535        span: Span,
1536        #[note("impl doesn't have any local type before any uncovered type parameters")]
1537        #[note(
1538            "for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules"
1539        )]
1540        #[note("define and implement a trait or new type instead")]
1541        note: (),
1542    },
1543    #[diag("only traits defined in the current crate can be implemented for arbitrary types", code = E0117)]
1544    Arbitrary {
1545        #[primary_span]
1546        span: Span,
1547        #[note("impl doesn't have any local type before any uncovered type parameters")]
1548        #[note(
1549            "for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules"
1550        )]
1551        #[note("define and implement a trait or new type instead")]
1552        note: (),
1553    },
1554}
1555
1556#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for OnlyCurrentTraitsOpaque {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OnlyCurrentTraitsOpaque { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type alias impl trait is treated as if it were foreign, because its hidden type could be from a foreign crate")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1557#[label(
1558    "type alias impl trait is treated as if it were foreign, because its hidden type could be from a foreign crate"
1559)]
1560pub(crate) struct OnlyCurrentTraitsOpaque {
1561    #[primary_span]
1562    pub span: Span,
1563}
1564#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for OnlyCurrentTraitsForeign {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OnlyCurrentTraitsForeign { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is not defined in the current crate because this is a foreign trait")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1565#[label("this is not defined in the current crate because this is a foreign trait")]
1566pub(crate) struct OnlyCurrentTraitsForeign {
1567    #[primary_span]
1568    pub span: Span,
1569}
1570
1571#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for OnlyCurrentTraitsName<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OnlyCurrentTraitsName { span: __binding_0, name: __binding_1
                        } => {
                        diag.store_args();
                        diag.arg("name", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is not defined in the current crate because {$name} are always foreign")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1572#[label("this is not defined in the current crate because {$name} are always foreign")]
1573pub(crate) struct OnlyCurrentTraitsName<'a> {
1574    #[primary_span]
1575    pub span: Span,
1576    pub name: &'a str,
1577}
1578
1579#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for OnlyCurrentTraitsPointer<'a>
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OnlyCurrentTraitsPointer {
                        span: __binding_0, pointer: __binding_1 } => {
                        diag.store_args();
                        diag.arg("pointer", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$pointer}` is not defined in the current crate because raw pointers are always foreign")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1580#[label("`{$pointer}` is not defined in the current crate because raw pointers are always foreign")]
1581pub(crate) struct OnlyCurrentTraitsPointer<'a> {
1582    #[primary_span]
1583    pub span: Span,
1584    pub pointer: Ty<'a>,
1585}
1586
1587#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for OnlyCurrentTraitsTy<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OnlyCurrentTraitsTy { span: __binding_0, ty: __binding_1 }
                        => {
                        diag.store_args();
                        diag.arg("ty", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ty}` is not defined in the current crate")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1588#[label("`{$ty}` is not defined in the current crate")]
1589pub(crate) struct OnlyCurrentTraitsTy<'a> {
1590    #[primary_span]
1591    pub span: Span,
1592    pub ty: Ty<'a>,
1593}
1594
1595#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for OnlyCurrentTraitsAdt {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OnlyCurrentTraitsAdt { span: __binding_0, name: __binding_1
                        } => {
                        diag.store_args();
                        diag.arg("name", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` is not defined in the current crate")));
                        diag.span_label(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1596#[label("`{$name}` is not defined in the current crate")]
1597pub(crate) struct OnlyCurrentTraitsAdt {
1598    #[primary_span]
1599    pub span: Span,
1600    pub name: String,
1601}
1602
1603#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for
            OnlyCurrentTraitsPointerSugg<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OnlyCurrentTraitsPointerSugg {
                        wrapper_span: __binding_0,
                        struct_span: __binding_1,
                        mut_key: __binding_2,
                        ptr_ty: __binding_3 } => {
                        let mut suggestions = Vec::new();
                        let __code_21 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("WrapperType"))
                                });
                        let __code_22 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("struct WrapperType(*{0}{1});\n\n",
                                            __binding_2, __binding_3))
                                });
                        suggestions.push((__binding_0, __code_21));
                        suggestions.push((__binding_1, __code_22));
                        diag.store_args();
                        diag.arg("mut_key", __binding_2);
                        diag.arg("ptr_ty", __binding_3);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider introducing a new wrapper type")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1604#[multipart_suggestion(
1605    "consider introducing a new wrapper type",
1606    applicability = "maybe-incorrect"
1607)]
1608pub(crate) struct OnlyCurrentTraitsPointerSugg<'a> {
1609    #[suggestion_part(code = "WrapperType")]
1610    pub wrapper_span: Span,
1611    #[suggestion_part(code = "struct WrapperType(*{mut_key}{ptr_ty});\n\n")]
1612    pub(crate) struct_span: Span,
1613    pub mut_key: &'a str,
1614    pub ptr_ty: Ty<'a>,
1615}
1616
1617#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsupportedDelegation<'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 {
                    UnsupportedDelegation {
                        span: __binding_0,
                        descr: __binding_1,
                        callee_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$descr}")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("callee defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1618#[diag("{$descr}")]
1619pub(crate) struct UnsupportedDelegation<'a> {
1620    #[primary_span]
1621    pub span: Span,
1622    pub descr: &'a str,
1623    #[label("callee defined here")]
1624    pub callee_span: Span,
1625}
1626
1627#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MethodShouldReturnFuture where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MethodShouldReturnFuture {
                        span: __binding_0,
                        method_name: __binding_1,
                        trait_item_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("method should be `async` or return a future, but it is synchronous")));
                        ;
                        diag.arg("method_name", __binding_1);
                        diag.span(__binding_0);
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_note(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this method is `async` so it expects a future to be returned")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1628#[diag("method should be `async` or return a future, but it is synchronous")]
1629pub(crate) struct MethodShouldReturnFuture {
1630    #[primary_span]
1631    pub span: Span,
1632    pub method_name: Ident,
1633    #[note("this method is `async` so it expects a future to be returned")]
1634    pub trait_item_span: Option<Span>,
1635}
1636
1637#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnusedGenericParameter where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnusedGenericParameter {
                        span: __binding_0,
                        param_name: __binding_1,
                        param_def_kind: __binding_2,
                        usage_spans: __binding_3,
                        help: __binding_4,
                        const_param_help: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$param_def_kind} `{$param_name}` is never used")));
                        ;
                        diag.arg("param_name", __binding_1);
                        diag.arg("param_def_kind", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused {$param_def_kind}")));
                        for __binding_3 in __binding_3 {
                            diag.span_label(__binding_3,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$param_name}` is named here, but is likely unused in the containing type")));
                        }
                        diag.subdiagnostic(__binding_4);
                        if __binding_5 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you intended `{$param_name}` to be a const parameter, use `const {$param_name}: /* Type */` instead")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1638#[diag("{$param_def_kind} `{$param_name}` is never used")]
1639pub(crate) struct UnusedGenericParameter {
1640    #[primary_span]
1641    #[label("unused {$param_def_kind}")]
1642    pub span: Span,
1643    pub param_name: Ident,
1644    pub param_def_kind: &'static str,
1645    #[label("`{$param_name}` is named here, but is likely unused in the containing type")]
1646    pub usage_spans: Vec<Span>,
1647    #[subdiagnostic]
1648    pub help: UnusedGenericParameterHelp,
1649    #[help(
1650        "if you intended `{$param_name}` to be a const parameter, use `const {$param_name}: /* Type */` instead"
1651    )]
1652    pub const_param_help: bool,
1653}
1654
1655#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RecursiveGenericParameter where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RecursiveGenericParameter {
                        spans: __binding_0,
                        param_span: __binding_1,
                        param_name: __binding_2,
                        param_def_kind: __binding_3,
                        help: __binding_4,
                        note: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$param_def_kind} `{$param_name}` is only used recursively")));
                        ;
                        diag.arg("param_name", __binding_2);
                        diag.arg("param_def_kind", __binding_3);
                        diag.span(__binding_0.clone());
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$param_def_kind} must be used non-recursively in the definition")));
                        diag.subdiagnostic(__binding_4);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("all type parameters must be used in a non-recursive way in order to constrain their variance")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1656#[diag("{$param_def_kind} `{$param_name}` is only used recursively")]
1657pub(crate) struct RecursiveGenericParameter {
1658    #[primary_span]
1659    pub spans: Vec<Span>,
1660    #[label("{$param_def_kind} must be used non-recursively in the definition")]
1661    pub param_span: Span,
1662    pub param_name: Ident,
1663    pub param_def_kind: &'static str,
1664    #[subdiagnostic]
1665    pub help: UnusedGenericParameterHelp,
1666    #[note(
1667        "all type parameters must be used in a non-recursive way in order to constrain their variance"
1668    )]
1669    pub note: (),
1670}
1671
1672#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnusedGenericParameterHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnusedGenericParameterHelp::Adt {
                        param_name: __binding_0, phantom_data: __binding_1 } => {
                        diag.store_args();
                        diag.arg("param_name", __binding_0);
                        diag.arg("phantom_data", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing `{$param_name}`, referring to it in a field, or using a marker such as `{$phantom_data}`")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                    UnusedGenericParameterHelp::AdtNoPhantomData {
                        param_name: __binding_0 } => {
                        diag.store_args();
                        diag.arg("param_name", __binding_0);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing `{$param_name}` or referring to it in a field")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                    UnusedGenericParameterHelp::TyAlias {
                        param_name: __binding_0 } => {
                        diag.store_args();
                        diag.arg("param_name", __binding_0);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing `{$param_name}` or referring to it in the body of the type alias")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1673pub(crate) enum UnusedGenericParameterHelp {
1674    #[help(
1675        "consider removing `{$param_name}`, referring to it in a field, or using a marker such as `{$phantom_data}`"
1676    )]
1677    Adt { param_name: Ident, phantom_data: String },
1678    #[help("consider removing `{$param_name}` or referring to it in a field")]
1679    AdtNoPhantomData { param_name: Ident },
1680    #[help("consider removing `{$param_name}` or referring to it in the body of the type alias")]
1681    TyAlias { param_name: Ident },
1682}
1683
1684#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnconstrainedGenericParameter where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnconstrainedGenericParameter {
                        span: __binding_0,
                        param_name: __binding_1,
                        param_def_kind: __binding_2,
                        const_param_note: __binding_3,
                        const_param_note2: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$param_def_kind} `{$param_name}` is not constrained by the impl trait, self type, or predicates")));
                        ;
                        diag.arg("param_name", __binding_1);
                        diag.arg("param_def_kind", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unconstrained {$param_def_kind}")));
                        if __binding_3 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expressions using a const parameter must map each value to a distinct output value")));
                        }
                        if __binding_4 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("proving the result of expressions other than the parameter are unique is not supported")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1685#[diag(
1686    "the {$param_def_kind} `{$param_name}` is not constrained by the impl trait, self type, or predicates"
1687)]
1688pub(crate) struct UnconstrainedGenericParameter {
1689    #[primary_span]
1690    #[label("unconstrained {$param_def_kind}")]
1691    pub span: Span,
1692    pub param_name: Ident,
1693    pub param_def_kind: &'static str,
1694    #[note("expressions using a const parameter must map each value to a distinct output value")]
1695    pub const_param_note: bool,
1696    #[note(
1697        "proving the result of expressions other than the parameter are unique is not supported"
1698    )]
1699    pub const_param_note2: bool,
1700}
1701
1702#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            OpaqueCapturesHigherRankedLifetime where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    OpaqueCapturesHigherRankedLifetime {
                        span: __binding_0,
                        label: __binding_1,
                        decl_span: __binding_2,
                        bad_place: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait` cannot capture {$bad_place}")));
                        diag.code(E0657);
                        ;
                        diag.arg("bad_place", __binding_3);
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait` implicitly captures all lifetimes in scope")));
                        }
                        diag.span_note(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime declared here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1703#[diag("`impl Trait` cannot capture {$bad_place}", code = E0657)]
1704pub(crate) struct OpaqueCapturesHigherRankedLifetime {
1705    #[primary_span]
1706    pub span: MultiSpan,
1707    #[label("`impl Trait` implicitly captures all lifetimes in scope")]
1708    pub label: Option<Span>,
1709    #[note("lifetime declared here")]
1710    pub decl_span: MultiSpan,
1711    pub bad_place: &'static str,
1712}
1713
1714#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidReceiverTyHint {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InvalidReceiverTyHint::Weak => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`Weak` does not implement `Receiver` because it has methods that may shadow the referent; consider wrapping your `Weak` in a newtype wrapper for which you implement `Receiver`")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    InvalidReceiverTyHint::NonNull => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`NonNull` does not implement `Receiver` because it has methods that may shadow the referent; consider wrapping your `NonNull` in a newtype wrapper for which you implement `Receiver`")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1715pub(crate) enum InvalidReceiverTyHint {
1716    #[note(
1717        "`Weak` does not implement `Receiver` because it has methods that may shadow the referent; consider wrapping your `Weak` in a newtype wrapper for which you implement `Receiver`"
1718    )]
1719    Weak,
1720    #[note(
1721        "`NonNull` does not implement `Receiver` because it has methods that may shadow the referent; consider wrapping your `NonNull` in a newtype wrapper for which you implement `Receiver`"
1722    )]
1723    NonNull,
1724}
1725
1726#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidReceiverTyNoArbitrarySelfTypes<'tcx> where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidReceiverTyNoArbitrarySelfTypes {
                        span: __binding_0, receiver_ty: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid `self` parameter type: `{$receiver_ty}`")));
                        diag.code(E0307);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type of `self` must be `Self` or a type that dereferences to it")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)")));
                        ;
                        diag.arg("receiver_ty", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1727#[diag("invalid `self` parameter type: `{$receiver_ty}`", code = E0307)]
1728#[note("type of `self` must be `Self` or a type that dereferences to it")]
1729#[help(
1730    "consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)"
1731)]
1732pub(crate) struct InvalidReceiverTyNoArbitrarySelfTypes<'tcx> {
1733    #[primary_span]
1734    pub span: Span,
1735    pub receiver_ty: Ty<'tcx>,
1736}
1737
1738#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidReceiverTy<'tcx> where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidReceiverTy {
                        span: __binding_0,
                        receiver_ty: __binding_1,
                        hint: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid `self` parameter type: `{$receiver_ty}`")));
                        diag.code(E0307);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type of `self` must be `Self` or some type implementing `Receiver`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`")));
                        ;
                        diag.arg("receiver_ty", __binding_1);
                        diag.span(__binding_0);
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1739#[diag("invalid `self` parameter type: `{$receiver_ty}`", code = E0307)]
1740#[note("type of `self` must be `Self` or some type implementing `Receiver`")]
1741#[help(
1742    "consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`"
1743)]
1744pub(crate) struct InvalidReceiverTy<'tcx> {
1745    #[primary_span]
1746    pub span: Span,
1747    pub receiver_ty: Ty<'tcx>,
1748    #[subdiagnostic]
1749    pub hint: Option<InvalidReceiverTyHint>,
1750}
1751
1752#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidGenericReceiverTy<'tcx> where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidGenericReceiverTy {
                        span: __binding_0, receiver_ty: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid generic `self` parameter type: `{$receiver_ty}`")));
                        diag.code(E0801);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type of `self` must not be a method generic parameter type")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)")));
                        ;
                        diag.arg("receiver_ty", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1753#[diag("invalid generic `self` parameter type: `{$receiver_ty}`", code = E0801)]
1754#[note("type of `self` must not be a method generic parameter type")]
1755#[help(
1756    "use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)"
1757)]
1758pub(crate) struct InvalidGenericReceiverTy<'tcx> {
1759    #[primary_span]
1760    pub span: Span,
1761    pub receiver_ty: Ty<'tcx>,
1762}
1763
1764#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CmseInputsStackSpill where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CmseInputsStackSpill { spans: __binding_0, abi: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("arguments for `{$abi}` function too large to pass via registers")));
                        diag.code(E0798);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the `{$abi}` ABI must pass all their arguments via the 4 32-bit argument registers")));
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0.clone());
                        for __binding_0 in __binding_0 {
                            diag.span_label(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("does not fit in the available registers")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1765#[diag("arguments for `{$abi}` function too large to pass via registers", code = E0798)]
1766#[note(
1767    "functions with the `{$abi}` ABI must pass all their arguments via the 4 32-bit argument registers"
1768)]
1769pub(crate) struct CmseInputsStackSpill {
1770    #[primary_span]
1771    #[label("does not fit in the available registers")]
1772    pub spans: Vec<Span>,
1773    pub abi: ExternAbi,
1774}
1775
1776#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CmseOutputStackSpill where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CmseOutputStackSpill { span: __binding_0, abi: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return value of `{$abi}` function too large to pass via registers")));
                        diag.code(E0798);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions with the `{$abi}` ABI must pass their result via the available return registers")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size")));
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this type doesn't fit in the available registers")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1777#[diag("return value of `{$abi}` function too large to pass via registers", code = E0798)]
1778#[note("functions with the `{$abi}` ABI must pass their result via the available return registers")]
1779#[note(
1780    "the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size"
1781)]
1782pub(crate) struct CmseOutputStackSpill {
1783    #[primary_span]
1784    #[label("this type doesn't fit in the available registers")]
1785    pub span: Span,
1786    pub abi: ExternAbi,
1787}
1788
1789#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CmseGeneric
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CmseGeneric { span: __binding_0, abi: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generics are not allowed in `extern {$abi}` signatures")));
                        diag.code(E0798);
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1790#[diag("generics are not allowed in `extern {$abi}` signatures", code = E0798)]
1791pub(crate) struct CmseGeneric {
1792    #[primary_span]
1793    pub span: Span,
1794    pub abi: ExternAbi,
1795}
1796
1797#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CmseImplTrait
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CmseImplTrait { span: __binding_0, abi: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`impl Trait` is not allowed in `extern {$abi}` signatures")));
                        diag.code(E0798);
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1798#[diag("`impl Trait` is not allowed in `extern {$abi}` signatures", code = E0798)]
1799pub(crate) struct CmseImplTrait {
1800    #[primary_span]
1801    pub span: Span,
1802    pub abi: ExternAbi,
1803}
1804
1805#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BadReturnTypeNotation where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BadReturnTypeNotation { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("return type notation not allowed in this position yet")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1806#[diag("return type notation not allowed in this position yet")]
1807pub(crate) struct BadReturnTypeNotation {
1808    #[primary_span]
1809    pub span: Span,
1810}
1811
1812#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SupertraitItemShadowing where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SupertraitItemShadowing {
                        item: __binding_0,
                        subtrait: __binding_1,
                        shadowee: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trait item `{$item}` from `{$subtrait}` shadows identically named item from supertrait")));
                        ;
                        diag.arg("item", __binding_0);
                        diag.arg("subtrait", __binding_1);
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1813#[diag("trait item `{$item}` from `{$subtrait}` shadows identically named item from supertrait")]
1814pub(crate) struct SupertraitItemShadowing {
1815    pub item: Symbol,
1816    pub subtrait: Symbol,
1817    #[subdiagnostic]
1818    pub shadowee: SupertraitItemShadowee,
1819}
1820
1821#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for SupertraitItemShadowee {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    SupertraitItemShadowee::Labeled {
                        span: __binding_0, supertrait: __binding_1 } => {
                        diag.store_args();
                        diag.arg("supertrait", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("item from `{$supertrait}` is shadowed by a subtrait item")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                    SupertraitItemShadowee::Several {
                        spans: __binding_0, traits: __binding_1 } => {
                        diag.store_args();
                        diag.arg("traits", __binding_1);
                        let __message =
                            diag.eagerly_format(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items from several supertraits are shadowed: {$traits}")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1822pub(crate) enum SupertraitItemShadowee {
1823    #[note("item from `{$supertrait}` is shadowed by a subtrait item")]
1824    Labeled {
1825        #[primary_span]
1826        span: Span,
1827        supertrait: Symbol,
1828    },
1829    #[note("items from several supertraits are shadowed: {$traits}")]
1830    Several {
1831        #[primary_span]
1832        spans: MultiSpan,
1833        traits: DiagSymbolList,
1834    },
1835}
1836
1837#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DynTraitAssocItemBindingMentionsSelf where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DynTraitAssocItemBindingMentionsSelf {
                        span: __binding_0, kind: __binding_1, binding: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind} binding in trait object type mentions `Self`")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("contains a mention of `Self`")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this binding mentions `Self`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1838#[diag("{$kind} binding in trait object type mentions `Self`")]
1839pub(crate) struct DynTraitAssocItemBindingMentionsSelf {
1840    #[primary_span]
1841    #[label("contains a mention of `Self`")]
1842    pub span: Span,
1843    pub kind: &'static str,
1844    #[label("this binding mentions `Self`")]
1845    pub binding: Span,
1846}
1847
1848#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AbiCustomClothedFunction where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AbiCustomClothedFunction {
                        span: __binding_0, naked_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("items with the \"custom\" ABI can only be declared externally or defined via naked functions")));
                        let __code_23 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("#[unsafe(naked)]\n"))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("convert this to an `#[unsafe(naked)]` function")),
                            __code_23, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1849#[diag(
1850    "items with the \"custom\" ABI can only be declared externally or defined via naked functions"
1851)]
1852pub(crate) struct AbiCustomClothedFunction {
1853    #[primary_span]
1854    pub span: Span,
1855    #[suggestion(
1856        "convert this to an `#[unsafe(naked)]` function",
1857        applicability = "maybe-incorrect",
1858        code = "#[unsafe(naked)]\n",
1859        style = "short"
1860    )]
1861    pub naked_span: Span,
1862}
1863
1864#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AsyncDropWithoutSyncDrop where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AsyncDropWithoutSyncDrop { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`AsyncDrop` impl without `Drop` impl")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("type implementing `AsyncDrop` trait must also implement `Drop` trait to be used in sync context and unwinds")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1865#[diag("`AsyncDrop` impl without `Drop` impl")]
1866#[help(
1867    "type implementing `AsyncDrop` trait must also implement `Drop` trait to be used in sync context and unwinds"
1868)]
1869pub(crate) struct AsyncDropWithoutSyncDrop {
1870    #[primary_span]
1871    pub span: Span,
1872}
1873
1874#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LifetimesOrBoundsMismatchOnEii where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LifetimesOrBoundsMismatchOnEii {
                        span: __binding_0,
                        generics_span: __binding_1,
                        where_span: __binding_2,
                        bounds_span: __binding_3,
                        ident: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetime parameters or bounds of `{$ident}` do not match the declaration")));
                        ;
                        diag.arg("ident", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetimes do not match")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lifetimes in impl do not match this signature")));
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_label(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `where` clause might not match the one in the trait")));
                        }
                        for __binding_3 in __binding_3 {
                            diag.span_label(__binding_3,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this bound might be missing in the impl")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1875#[diag("lifetime parameters or bounds of `{$ident}` do not match the declaration")]
1876pub(crate) struct LifetimesOrBoundsMismatchOnEii {
1877    #[primary_span]
1878    #[label("lifetimes do not match")]
1879    pub span: Span,
1880    #[label("lifetimes in impl do not match this signature")]
1881    pub generics_span: Span,
1882    #[label("this `where` clause might not match the one in the trait")]
1883    pub where_span: Option<Span>,
1884    #[label("this bound might be missing in the impl")]
1885    pub bounds_span: Vec<Span>,
1886    pub ident: Symbol,
1887}
1888
1889#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EiiWithGenerics where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EiiWithGenerics {
                        span: __binding_0,
                        attr: __binding_1,
                        eii_name: __binding_2,
                        impl_name: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$impl_name}` cannot have generic parameters other than lifetimes")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$eii_name}]` marks the implementation of an \"externally implementable item\"")));
                        ;
                        diag.arg("eii_name", __binding_2);
                        diag.arg("impl_name", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("required by this attribute")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1890#[diag("`{$impl_name}` cannot have generic parameters other than lifetimes")]
1891#[help("`#[{$eii_name}]` marks the implementation of an \"externally implementable item\"")]
1892pub(crate) struct EiiWithGenerics {
1893    #[primary_span]
1894    pub span: Span,
1895    #[label("required by this attribute")]
1896    pub attr: Span,
1897    pub eii_name: Symbol,
1898    pub impl_name: Symbol,
1899}
1900
1901#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ImplUnpinForPinProjectedType where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ImplUnpinForPinProjectedType {
                        span: __binding_0,
                        adt_span: __binding_1,
                        adt_name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("explicit impls for the `Unpin` trait are not permitted for structurally pinned types")));
                        ;
                        diag.arg("adt_name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("impl of `Unpin` not allowed")));
                        diag.span_help(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$adt_name}` is structurally pinned because it is marked as `#[pin_v2]`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1902#[diag("explicit impls for the `Unpin` trait are not permitted for structurally pinned types")]
1903pub(crate) struct ImplUnpinForPinProjectedType {
1904    #[primary_span]
1905    #[label("impl of `Unpin` not allowed")]
1906    pub span: Span,
1907    #[help("`{$adt_name}` is structurally pinned because it is marked as `#[pin_v2]`")]
1908    pub adt_span: Span,
1909    pub adt_name: Symbol,
1910}