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