Skip to main content

rustc_hir_analysis/
diagnostics.rs

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