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