Skip to main content

rustc_passes/
errors.rs

1use std::io::Error;
2use std::path::{Path, PathBuf};
3
4use rustc_errors::codes::*;
5use rustc_errors::{
6    Applicability, Diag, DiagCtxtHandle, DiagSymbolList, Diagnostic, EmissionGuarantee, Level,
7    MultiSpan, msg,
8};
9use rustc_hir::Target;
10use rustc_hir::attrs::{MirDialect, MirPhase};
11use rustc_macros::{Diagnostic, Subdiagnostic};
12use rustc_middle::ty::{MainDefinition, Ty};
13use rustc_span::{DUMMY_SP, Ident, Span, Symbol};
14
15use crate::check_attr::ProcMacroKind;
16use crate::lang_items::Duplicate;
17
18#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncorrectDoNotRecommendLocation where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncorrectDoNotRecommendLocation => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[diagnostic::do_not_recommend]` can only be placed on trait implementations")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
19#[diag("`#[diagnostic::do_not_recommend]` can only be placed on trait implementations")]
20pub(crate) struct IncorrectDoNotRecommendLocation;
21
22#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LoopMatchAttr
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LoopMatchAttr {
                        attr_span: __binding_0, node_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[loop_match]` should be applied to a loop")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a loop")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
23#[diag("`#[loop_match]` should be applied to a loop")]
24pub(crate) struct LoopMatchAttr {
25    #[primary_span]
26    pub attr_span: Span,
27    #[label("not a loop")]
28    pub node_span: Span,
29}
30
31#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstContinueAttr where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstContinueAttr {
                        attr_span: __binding_0, node_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[const_continue]` should be applied to a break expression")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a break expression")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
32#[diag("`#[const_continue]` should be applied to a break expression")]
33pub(crate) struct ConstContinueAttr {
34    #[primary_span]
35    pub attr_span: Span,
36    #[label("not a break expression")]
37    pub node_span: Span,
38}
39
40#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MixedExportNameAndNoMangle where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MixedExportNameAndNoMangle {
                        no_mangle_span: __binding_0,
                        export_name_span: __binding_1,
                        no_mangle_attr: __binding_2,
                        export_name_attr: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$no_mangle_attr}` attribute may not be used in combination with `{$export_name_attr}`")));
                        let __code_0 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("no_mangle_attr", __binding_2);
                        diag.arg("export_name_attr", __binding_3);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$no_mangle_attr}` is ignored")));
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the `{$no_mangle_attr}` attribute")),
                            __code_0, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$export_name_attr}` takes precedence")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
41#[diag("`{$no_mangle_attr}` attribute may not be used in combination with `{$export_name_attr}`")]
42pub(crate) struct MixedExportNameAndNoMangle {
43    #[label("`{$no_mangle_attr}` is ignored")]
44    #[suggestion(
45        "remove the `{$no_mangle_attr}` attribute",
46        style = "verbose",
47        code = "",
48        applicability = "machine-applicable"
49    )]
50    pub no_mangle_span: Span,
51    #[note("`{$export_name_attr}` takes precedence")]
52    pub export_name_span: Span,
53    pub no_mangle_attr: &'static str,
54    pub export_name_attr: &'static str,
55}
56
57#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            OuterCrateLevelAttr where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    OuterCrateLevelAttr { suggestion: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("crate-level attribute should be an inner attribute")));
                        ;
                        diag.subdiagnostic(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
58#[diag("crate-level attribute should be an inner attribute")]
59pub(crate) struct OuterCrateLevelAttr {
60    #[subdiagnostic]
61    pub suggestion: OuterCrateLevelAttrSuggestion,
62}
63
64#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for OuterCrateLevelAttrSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    OuterCrateLevelAttrSuggestion { bang_position: __binding_0 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_1 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("!"))
                                });
                        suggestions.push((__binding_0, __code_1));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add a `!`")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::Unspecified,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
65#[multipart_suggestion("add a `!`", style = "verbose")]
66pub(crate) struct OuterCrateLevelAttrSuggestion {
67    #[suggestion_part(code = "!")]
68    pub bang_position: Span,
69}
70
71#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InnerCrateLevelAttr where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InnerCrateLevelAttr => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("crate-level attribute should be in the root module")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
72#[diag("crate-level attribute should be in the root module")]
73pub(crate) struct InnerCrateLevelAttr;
74
75#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NonExhaustiveWithDefaultFieldValues where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NonExhaustiveWithDefaultFieldValues {
                        attr_span: __binding_0, defn_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[non_exhaustive]` can't be used to annotate items with default field values")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this struct has default field values")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
76#[diag("`#[non_exhaustive]` can't be used to annotate items with default field values")]
77pub(crate) struct NonExhaustiveWithDefaultFieldValues {
78    #[primary_span]
79    pub attr_span: Span,
80    #[label("this struct has default field values")]
81    pub defn_span: Span,
82}
83
84#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAliasBadLocation<'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 {
                    DocAliasBadLocation {
                        span: __binding_0, location: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(alias = \"...\")]` isn't allowed on {$location}")));
                        ;
                        diag.arg("location", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
85#[diag("`#[doc(alias = \"...\")]` isn't allowed on {$location}")]
86pub(crate) struct DocAliasBadLocation<'a> {
87    #[primary_span]
88    pub span: Span,
89    pub location: &'a str,
90}
91
92#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAliasNotAnAlias where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocAliasNotAnAlias {
                        span: __binding_0, attr_str: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(alias = \"{$attr_str}\"]` is the same as the item's name")));
                        ;
                        diag.arg("attr_str", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
93#[diag("`#[doc(alias = \"{$attr_str}\"]` is the same as the item's name")]
94pub(crate) struct DocAliasNotAnAlias {
95    #[primary_span]
96    pub span: Span,
97    pub attr_str: Symbol,
98}
99
100#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocKeywordAttributeEmptyMod where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocKeywordAttributeEmptyMod {
                        span: __binding_0, attr_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc({$attr_name} = \"...\")]` should be used on empty modules")));
                        ;
                        diag.arg("attr_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
101#[diag("`#[doc({$attr_name} = \"...\")]` should be used on empty modules")]
102pub(crate) struct DocKeywordAttributeEmptyMod {
103    #[primary_span]
104    pub span: Span,
105    pub attr_name: &'static str,
106}
107
108#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocKeywordAttributeNotMod where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocKeywordAttributeNotMod {
                        span: __binding_0, attr_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc({$attr_name} = \"...\")]` should be used on modules")));
                        ;
                        diag.arg("attr_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
109#[diag("`#[doc({$attr_name} = \"...\")]` should be used on modules")]
110pub(crate) struct DocKeywordAttributeNotMod {
111    #[primary_span]
112    pub span: Span,
113    pub attr_name: &'static str,
114}
115
116#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocFakeVariadicNotValid where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocFakeVariadicNotValid { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(fake_variadic)]` must be used on the first of a set of tuple or fn pointer trait impls with varying arity")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
117#[diag(
118    "`#[doc(fake_variadic)]` must be used on the first of a set of tuple or fn pointer trait impls with varying arity"
119)]
120pub(crate) struct DocFakeVariadicNotValid {
121    #[primary_span]
122    pub span: Span,
123}
124
125#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocKeywordOnlyImpl where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocKeywordOnlyImpl { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(keyword = \"...\")]` should be used on impl blocks")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
126#[diag("`#[doc(keyword = \"...\")]` should be used on impl blocks")]
127pub(crate) struct DocKeywordOnlyImpl {
128    #[primary_span]
129    pub span: Span,
130}
131
132#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocSearchUnboxInvalid where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocSearchUnboxInvalid { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(search_unbox)]` should be used on generic structs and enums")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
133#[diag("`#[doc(search_unbox)]` should be used on generic structs and enums")]
134pub(crate) struct DocSearchUnboxInvalid {
135    #[primary_span]
136    pub span: Span,
137}
138
139#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocInlineConflict where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocInlineConflict { spans: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("conflicting doc inlining attributes")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove one of the conflicting attributes")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
140#[diag("conflicting doc inlining attributes")]
141#[help("remove one of the conflicting attributes")]
142pub(crate) struct DocInlineConflict {
143    #[primary_span]
144    pub spans: MultiSpan,
145}
146
147#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocInlineOnlyUse where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocInlineOnlyUse {
                        attr_span: __binding_0, item_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute can only be applied to a `use` item")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only applicable on `use` items")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a `use` item")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
148#[diag("this attribute can only be applied to a `use` item")]
149#[note(
150    "read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information"
151)]
152pub(crate) struct DocInlineOnlyUse {
153    #[label("only applicable on `use` items")]
154    pub attr_span: Span,
155    #[label("not a `use` item")]
156    pub item_span: Span,
157}
158
159#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocMaskedOnlyExternCrate where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocMaskedOnlyExternCrate {
                        attr_span: __binding_0, item_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute can only be applied to an `extern crate` item")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read <https://doc.rust-lang.org/unstable-book/language-features/doc-masked.html> for more information")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only applicable on `extern crate` items")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not an `extern crate` item")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
160#[diag("this attribute can only be applied to an `extern crate` item")]
161#[note(
162    "read <https://doc.rust-lang.org/unstable-book/language-features/doc-masked.html> for more information"
163)]
164pub(crate) struct DocMaskedOnlyExternCrate {
165    #[label("only applicable on `extern crate` items")]
166    pub attr_span: Span,
167    #[label("not an `extern crate` item")]
168    pub item_span: Span,
169}
170
171#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocMaskedNotExternCrateSelf where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DocMaskedNotExternCrateSelf {
                        attr_span: __binding_0, item_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute cannot be applied to an `extern crate self` item")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not applicable on `extern crate self` items")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`extern crate self` defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
172#[diag("this attribute cannot be applied to an `extern crate self` item")]
173pub(crate) struct DocMaskedNotExternCrateSelf {
174    #[label("not applicable on `extern crate self` items")]
175    pub attr_span: Span,
176    #[label("`extern crate self` defined here")]
177    pub item_span: Span,
178}
179
180#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BothFfiConstAndPure where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BothFfiConstAndPure { attr_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[ffi_const]` function cannot be `#[ffi_pure]`")));
                        diag.code(E0757);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
181#[diag("`#[ffi_const]` function cannot be `#[ffi_pure]`", code = E0757)]
182pub(crate) struct BothFfiConstAndPure {
183    #[primary_span]
184    pub attr_span: Span,
185}
186
187#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for Link where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    Link { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to an `extern` block with non-Rust ABI")));
                        diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.span_label(__binding_0,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not an `extern` block")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
188#[diag("attribute should be applied to an `extern` block with non-Rust ABI")]
189#[warning(
190    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
191)]
192pub(crate) struct Link {
193    #[label("not an `extern` block")]
194    pub span: Option<Span>,
195}
196
197#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcLegacyConstGenericsOnly where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RustcLegacyConstGenericsOnly {
                        attr_span: __binding_0, param_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("#[rustc_legacy_const_generics] functions must only have const generics")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-const generic parameter")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
198#[diag("#[rustc_legacy_const_generics] functions must only have const generics")]
199pub(crate) struct RustcLegacyConstGenericsOnly {
200    #[primary_span]
201    pub attr_span: Span,
202    #[label("non-const generic parameter")]
203    pub param_span: Span,
204}
205
206#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcLegacyConstGenericsIndex where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RustcLegacyConstGenericsIndex {
                        attr_span: __binding_0, generics_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("#[rustc_legacy_const_generics] must have one index for each generic parameter")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic parameters")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
207#[diag("#[rustc_legacy_const_generics] must have one index for each generic parameter")]
208pub(crate) struct RustcLegacyConstGenericsIndex {
209    #[primary_span]
210    pub attr_span: Span,
211    #[label("generic parameters")]
212    pub generics_span: Span,
213}
214
215#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcLegacyConstGenericsIndexExceed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RustcLegacyConstGenericsIndexExceed {
                        span: __binding_0, arg_count: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("index exceeds number of arguments")));
                        ;
                        diag.arg("arg_count", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there {$arg_count ->\n            [one] is\n            *[other] are\n        } only {$arg_count} {$arg_count ->\n            [one] argument\n            *[other] arguments\n        }")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
216#[diag("index exceeds number of arguments")]
217pub(crate) struct RustcLegacyConstGenericsIndexExceed {
218    #[primary_span]
219    #[label(
220        "there {$arg_count ->
221            [one] is
222            *[other] are
223        } only {$arg_count} {$arg_count ->
224            [one] argument
225            *[other] arguments
226        }"
227    )]
228    pub span: Span,
229    pub arg_count: usize,
230}
231
232#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ReprConflicting where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReprConflicting { hint_spans: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("conflicting representation hints")));
                        diag.code(E0566);
                        ;
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
233#[diag("conflicting representation hints", code = E0566)]
234pub(crate) struct ReprConflicting {
235    #[primary_span]
236    pub hint_spans: Vec<Span>,
237}
238
239#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidReprAlignForTarget where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidReprAlignForTarget {
                        span: __binding_0, size: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("alignment must not be greater than `isize::MAX` bytes")));
                        diag.code(E0589);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`isize::MAX` is {$size} for the current target")));
                        ;
                        diag.arg("size", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
240#[diag("alignment must not be greater than `isize::MAX` bytes", code = E0589)]
241#[note("`isize::MAX` is {$size} for the current target")]
242pub(crate) struct InvalidReprAlignForTarget {
243    #[primary_span]
244    pub span: Span,
245    pub size: u64,
246}
247
248#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ReprConflictingLint where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReprConflictingLint => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("conflicting representation hints")));
                        diag.code(E0566);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
249#[diag("conflicting representation hints", code = E0566)]
250pub(crate) struct ReprConflictingLint;
251
252#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MacroOnlyAttribute where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MacroOnlyAttribute {
                        attr_span: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to a macro")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a macro")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
253#[diag("attribute should be applied to a macro")]
254pub(crate) struct MacroOnlyAttribute {
255    #[primary_span]
256    pub attr_span: Span,
257    #[label("not a macro")]
258    pub span: Span,
259}
260
261#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            DebugVisualizerUnreadable<'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 {
                    DebugVisualizerUnreadable {
                        span: __binding_0, file: __binding_1, error: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("couldn't read {$file}: {$error}")));
                        ;
                        diag.arg("file", __binding_1);
                        diag.arg("error", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
262#[diag("couldn't read {$file}: {$error}")]
263pub(crate) struct DebugVisualizerUnreadable<'a> {
264    #[primary_span]
265    pub span: Span,
266    pub file: &'a Path,
267    pub error: Error,
268}
269
270#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcAllowConstFnUnstable where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RustcAllowConstFnUnstable {
                        attr_span: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to `const fn`")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a `const fn`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
271#[diag("attribute should be applied to `const fn`")]
272pub(crate) struct RustcAllowConstFnUnstable {
273    #[primary_span]
274    pub attr_span: Span,
275    #[label("not a `const fn`")]
276    pub span: Span,
277}
278
279#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcPubTransparent where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RustcPubTransparent {
                        attr_span: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to `#[repr(transparent)]` types")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a `#[repr(transparent)]` type")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
280#[diag("attribute should be applied to `#[repr(transparent)]` types")]
281pub(crate) struct RustcPubTransparent {
282    #[primary_span]
283    pub attr_span: Span,
284    #[label("not a `#[repr(transparent)]` type")]
285    pub span: Span,
286}
287
288#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcForceInlineCoro where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RustcForceInlineCoro {
                        attr_span: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute cannot be applied to a `async`, `gen` or `async gen` function")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`async`, `gen` or `async gen` function")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
289#[diag("attribute cannot be applied to a `async`, `gen` or `async gen` function")]
290pub(crate) struct RustcForceInlineCoro {
291    #[primary_span]
292    pub attr_span: Span,
293    #[label("`async`, `gen` or `async gen` function")]
294    pub span: Span,
295}
296
297#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MacroExport
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MacroExport::OnDeclMacro => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[macro_export]` has no effect on declarative macro definitions")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("declarative macros follow the same exporting rules as regular items")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
298pub(crate) enum MacroExport {
299    #[diag("`#[macro_export]` has no effect on declarative macro definitions")]
300    #[note("declarative macros follow the same exporting rules as regular items")]
301    OnDeclMacro,
302}
303
304#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnusedNote {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnusedNote::EmptyList { name: __binding_0 } => {
                        diag.store_args();
                        diag.arg("name", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute `{$name}` with an empty list has no effect")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    UnusedNote::NoLints { name: __binding_0 } => {
                        diag.store_args();
                        diag.arg("name", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute `{$name}` without any lints has no effect")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    UnusedNote::DefaultMethodBodyConst => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`default_method_body_is_const` has been replaced with `const` on traits")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                    UnusedNote::LinkerMessagesBinaryCrateOnly => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `linker_messages` lint can only be controlled at the root of a crate that needs to be linked")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
305pub(crate) enum UnusedNote {
306    #[note("attribute `{$name}` with an empty list has no effect")]
307    EmptyList { name: Symbol },
308    #[note("attribute `{$name}` without any lints has no effect")]
309    NoLints { name: Symbol },
310    #[note("`default_method_body_is_const` has been replaced with `const` on traits")]
311    DefaultMethodBodyConst,
312    #[note(
313        "the `linker_messages` lint can only be controlled at the root of a crate that needs to be linked"
314    )]
315    LinkerMessagesBinaryCrateOnly,
316}
317
318#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for Unused where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    Unused { attr_span: __binding_0, note: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
                            __code_2, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
319#[diag("unused attribute")]
320pub(crate) struct Unused {
321    #[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
322    pub attr_span: Span,
323    #[subdiagnostic]
324    pub note: UnusedNote,
325}
326
327#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NonExportedMacroInvalidAttrs where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NonExportedMacroInvalidAttrs { attr_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to function or closure")));
                        diag.code(E0518);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a function or closure")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
328#[diag("attribute should be applied to function or closure", code = E0518)]
329pub(crate) struct NonExportedMacroInvalidAttrs {
330    #[primary_span]
331    #[label("not a function or closure")]
332    pub attr_span: Span,
333}
334
335#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidMayDangle where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidMayDangle { attr_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
336#[diag("`#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl")]
337pub(crate) struct InvalidMayDangle {
338    #[primary_span]
339    pub attr_span: Span,
340}
341
342#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnusedDuplicate where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnusedDuplicate {
                        this: __binding_0, other: __binding_1, warning: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
                            __code_3, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
                        if __binding_2 {
                            diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
343#[diag("unused attribute")]
344pub(crate) struct UnusedDuplicate {
345    #[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
346    pub this: Span,
347    #[note("attribute also specified here")]
348    pub other: Span,
349    #[warning(
350        "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
351    )]
352    pub warning: bool,
353}
354
355#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for UnusedMultiple
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnusedMultiple {
                        this: __binding_0, other: __binding_1, name: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `{$name}` attributes")));
                        let __code_4 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
                            __code_4, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
356#[diag("multiple `{$name}` attributes")]
357pub(crate) struct UnusedMultiple {
358    #[primary_span]
359    #[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
360    pub this: Span,
361    #[note("attribute also specified here")]
362    pub other: Span,
363    pub name: Symbol,
364}
365
366#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DeprecatedAnnotationHasNoEffect where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DeprecatedAnnotationHasNoEffect { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this `#[deprecated]` annotation has no effect")));
                        let __code_5 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the unnecessary deprecation attribute")),
                            __code_5, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
367#[diag("this `#[deprecated]` annotation has no effect")]
368pub(crate) struct DeprecatedAnnotationHasNoEffect {
369    #[suggestion(
370        "remove the unnecessary deprecation attribute",
371        applicability = "machine-applicable",
372        code = ""
373    )]
374    pub span: Span,
375}
376
377#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownExternLangItem where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnknownExternLangItem {
                        span: __binding_0, lang_item: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown external lang item: `{$lang_item}`")));
                        diag.code(E0264);
                        ;
                        diag.arg("lang_item", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
378#[diag("unknown external lang item: `{$lang_item}`", code = E0264)]
379pub(crate) struct UnknownExternLangItem {
380    #[primary_span]
381    pub span: Span,
382    pub lang_item: Symbol,
383}
384
385#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingPanicHandler where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MissingPanicHandler => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[panic_handler]` function required, but not found")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
386#[diag("`#[panic_handler]` function required, but not found")]
387pub(crate) struct MissingPanicHandler;
388
389#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            PanicUnwindWithoutStd where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    PanicUnwindWithoutStd => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unwinding panics are not supported without std")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using nightly cargo, use -Zbuild-std with panic=\"abort\" to avoid unwinding")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("since the core library is usually precompiled with panic=\"unwind\", rebuilding your crate with panic=\"abort\" may not be enough to fix the problem")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
390#[diag("unwinding panics are not supported without std")]
391#[help("using nightly cargo, use -Zbuild-std with panic=\"abort\" to avoid unwinding")]
392#[note(
393    "since the core library is usually precompiled with panic=\"unwind\", rebuilding your crate with panic=\"abort\" may not be enough to fix the problem"
394)]
395pub(crate) struct PanicUnwindWithoutStd;
396
397#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingLangItem where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MissingLangItem { name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lang item required, but not found: `{$name}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this can occur when a binary crate with `#![no_std]` is compiled for a target where `{$name}` is defined in the standard library")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you may be able to compile for a target that doesn't need `{$name}`, specify a target with `--target` or in `.cargo/config`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
398#[diag("lang item required, but not found: `{$name}`")]
399#[note(
400    "this can occur when a binary crate with `#![no_std]` is compiled for a target where `{$name}` is defined in the standard library"
401)]
402#[help(
403    "you may be able to compile for a target that doesn't need `{$name}`, specify a target with `--target` or in `.cargo/config`"
404)]
405pub(crate) struct MissingLangItem {
406    pub name: Symbol,
407}
408
409#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LangItemWithTrackCaller where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LangItemWithTrackCaller {
                        attr_span: __binding_0,
                        name: __binding_1,
                        sig_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$name ->\n    [panic_impl] `#[panic_handler]`\n    *[other] `{$name}` lang item\n} function is not allowed to have `#[track_caller]`")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$name ->\n            [panic_impl] `#[panic_handler]`\n            *[other] `{$name}` lang item\n        } function is not allowed to have `#[track_caller]`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
410#[diag(
411    "{$name ->
412    [panic_impl] `#[panic_handler]`
413    *[other] `{$name}` lang item
414} function is not allowed to have `#[track_caller]`"
415)]
416pub(crate) struct LangItemWithTrackCaller {
417    #[primary_span]
418    pub attr_span: Span,
419    pub name: Symbol,
420    #[label(
421        "{$name ->
422            [panic_impl] `#[panic_handler]`
423            *[other] `{$name}` lang item
424        } function is not allowed to have `#[track_caller]`"
425    )]
426    pub sig_span: Span,
427}
428
429#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LangItemWithTargetFeature where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LangItemWithTargetFeature {
                        attr_span: __binding_0,
                        name: __binding_1,
                        sig_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$name ->\n        [panic_impl] `#[panic_handler]`\n        *[other] `{$name}` lang item\n    } function is not allowed to have `#[target_feature]`")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$name ->\n            [panic_impl] `#[panic_handler]`\n            *[other] `{$name}` lang item\n        } function is not allowed to have `#[target_feature]`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
430#[diag(
431    "{$name ->
432        [panic_impl] `#[panic_handler]`
433        *[other] `{$name}` lang item
434    } function is not allowed to have `#[target_feature]`"
435)]
436pub(crate) struct LangItemWithTargetFeature {
437    #[primary_span]
438    pub attr_span: Span,
439    pub name: Symbol,
440    #[label(
441        "{$name ->
442            [panic_impl] `#[panic_handler]`
443            *[other] `{$name}` lang item
444        } function is not allowed to have `#[target_feature]`"
445    )]
446    pub sig_span: Span,
447}
448
449#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LangItemOnIncorrectTarget where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LangItemOnIncorrectTarget {
                        span: __binding_0,
                        name: __binding_1,
                        expected_target: __binding_2,
                        actual_target: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` lang item must be applied to a {$expected_target}")));
                        diag.code(E0718);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("expected_target", __binding_2);
                        diag.arg("actual_target", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to a {$expected_target}, not a {$actual_target}")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
450#[diag("`{$name}` lang item must be applied to a {$expected_target}", code = E0718)]
451pub(crate) struct LangItemOnIncorrectTarget {
452    #[primary_span]
453    #[label("attribute should be applied to a {$expected_target}, not a {$actual_target}")]
454    pub span: Span,
455    pub name: Symbol,
456    pub expected_target: Target,
457    pub actual_target: Target,
458}
459
460pub(crate) struct InvalidAttrAtCrateLevel {
461    pub span: Span,
462    pub sugg_span: Option<Span>,
463    pub name: Symbol,
464    pub item: Option<ItemFollowingInnerAttr>,
465}
466
467#[derive(#[automatically_derived]
impl ::core::clone::Clone for ItemFollowingInnerAttr {
    #[inline]
    fn clone(&self) -> ItemFollowingInnerAttr {
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<&'static str>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for ItemFollowingInnerAttr { }Copy)]
468pub(crate) struct ItemFollowingInnerAttr {
469    pub span: Span,
470    pub kind: &'static str,
471}
472
473impl<G: EmissionGuarantee> Diagnostic<'_, G> for InvalidAttrAtCrateLevel {
474    #[track_caller]
475    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
476        let mut diag =
477            Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` attribute cannot be used at crate level"))msg!("`{$name}` attribute cannot be used at crate level"));
478        diag.span(self.span);
479        diag.arg("name", self.name);
480        // Only emit an error with a suggestion if we can create a string out
481        // of the attribute span
482        if let Some(span) = self.sugg_span {
483            diag.span_suggestion_verbose(
484                span,
485                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("perhaps you meant to use an outer attribute"))msg!("perhaps you meant to use an outer attribute"),
486                String::new(),
487                Applicability::MachineApplicable,
488            );
489        }
490        if let Some(item) = self.item {
491            diag.arg("kind", item.kind);
492            diag.span_label(item.span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the inner attribute doesn't annotate this {$kind}"))msg!("the inner attribute doesn't annotate this {$kind}"));
493        }
494        diag
495    }
496}
497
498#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DuplicateDiagnosticItemInCrate where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DuplicateDiagnosticItemInCrate {
                        duplicate_span: __binding_0,
                        orig_span: __binding_1,
                        different_crates: __binding_2,
                        crate_name: __binding_3,
                        orig_crate_name: __binding_4,
                        name: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate diagnostic item in crate `{$crate_name}`: `{$name}`")));
                        ;
                        diag.arg("crate_name", __binding_3);
                        diag.arg("orig_crate_name", __binding_4);
                        diag.arg("name", __binding_5);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span(__binding_0);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_note(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the diagnostic item is first defined here")));
                        }
                        if __binding_2 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the diagnostic item is first defined in crate `{$orig_crate_name}`")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
499#[diag("duplicate diagnostic item in crate `{$crate_name}`: `{$name}`")]
500pub(crate) struct DuplicateDiagnosticItemInCrate {
501    #[primary_span]
502    pub duplicate_span: Option<Span>,
503    #[note("the diagnostic item is first defined here")]
504    pub orig_span: Option<Span>,
505    #[note("the diagnostic item is first defined in crate `{$orig_crate_name}`")]
506    pub different_crates: bool,
507    pub crate_name: Symbol,
508    pub orig_crate_name: Symbol,
509    pub name: Symbol,
510}
511
512#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LayoutAbi
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LayoutAbi { span: __binding_0, abi: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("abi: {$abi}")));
                        ;
                        diag.arg("abi", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
513#[diag("abi: {$abi}")]
514pub(crate) struct LayoutAbi {
515    #[primary_span]
516    pub span: Span,
517    pub abi: String,
518}
519
520#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LayoutAlign
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LayoutAlign { span: __binding_0, align: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("align: {$align}")));
                        ;
                        diag.arg("align", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
521#[diag("align: {$align}")]
522pub(crate) struct LayoutAlign {
523    #[primary_span]
524    pub span: Span,
525    pub align: String,
526}
527
528#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LayoutSize
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LayoutSize { span: __binding_0, size: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("size: {$size}")));
                        ;
                        diag.arg("size", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
529#[diag("size: {$size}")]
530pub(crate) struct LayoutSize {
531    #[primary_span]
532    pub span: Span,
533    pub size: String,
534}
535
536#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LayoutHomogeneousAggregate where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LayoutHomogeneousAggregate {
                        span: __binding_0, homogeneous_aggregate: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("homogeneous_aggregate: {$homogeneous_aggregate}")));
                        ;
                        diag.arg("homogeneous_aggregate", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
537#[diag("homogeneous_aggregate: {$homogeneous_aggregate}")]
538pub(crate) struct LayoutHomogeneousAggregate {
539    #[primary_span]
540    pub span: Span,
541    pub homogeneous_aggregate: String,
542}
543
544#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            LayoutOf<'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 {
                    LayoutOf {
                        span: __binding_0,
                        normalized_ty: __binding_1,
                        ty_layout: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("layout_of({$normalized_ty}) = {$ty_layout}")));
                        ;
                        diag.arg("normalized_ty", __binding_1);
                        diag.arg("ty_layout", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
545#[diag("layout_of({$normalized_ty}) = {$ty_layout}")]
546pub(crate) struct LayoutOf<'tcx> {
547    #[primary_span]
548    pub span: Span,
549    pub normalized_ty: Ty<'tcx>,
550    pub ty_layout: String,
551}
552
553#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for AbiOf where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AbiOf {
                        span: __binding_0, fn_name: __binding_1, fn_abi: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("fn_abi_of({$fn_name}) = {$fn_abi}")));
                        ;
                        diag.arg("fn_name", __binding_1);
                        diag.arg("fn_abi", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
554#[diag("fn_abi_of({$fn_name}) = {$fn_abi}")]
555pub(crate) struct AbiOf {
556    #[primary_span]
557    pub span: Span,
558    pub fn_name: Symbol,
559    pub fn_abi: String,
560}
561
562#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for AbiNe where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AbiNe {
                        span: __binding_0, left: __binding_1, right: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ABIs are not compatible\n    left ABI = {$left}\n    right ABI = {$right}")));
                        ;
                        diag.arg("left", __binding_1);
                        diag.arg("right", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
563#[diag(
564    "ABIs are not compatible
565    left ABI = {$left}
566    right ABI = {$right}"
567)]
568pub(crate) struct AbiNe {
569    #[primary_span]
570    pub span: Span,
571    pub left: String,
572    pub right: String,
573}
574
575#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AbiInvalidAttribute where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AbiInvalidAttribute { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_abi]` can only be applied to function items, type aliases, and associated functions")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
576#[diag(
577    "`#[rustc_abi]` can only be applied to function items, type aliases, and associated functions"
578)]
579pub(crate) struct AbiInvalidAttribute {
580    #[primary_span]
581    pub span: Span,
582}
583
584#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnrecognizedArgument where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnrecognizedArgument { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unrecognized argument")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
585#[diag("unrecognized argument")]
586pub(crate) struct UnrecognizedArgument {
587    #[primary_span]
588    pub span: Span,
589}
590
591#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FeatureStableTwice where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FeatureStableTwice {
                        span: __binding_0,
                        feature: __binding_1,
                        since: __binding_2,
                        prev_since: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("feature `{$feature}` is declared stable since {$since}, but was previously declared stable since {$prev_since}")));
                        diag.code(E0711);
                        ;
                        diag.arg("feature", __binding_1);
                        diag.arg("since", __binding_2);
                        diag.arg("prev_since", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
592#[diag("feature `{$feature}` is declared stable since {$since}, but was previously declared stable since {$prev_since}", code = E0711)]
593pub(crate) struct FeatureStableTwice {
594    #[primary_span]
595    pub span: Span,
596    pub feature: Symbol,
597    pub since: Symbol,
598    pub prev_since: Symbol,
599}
600
601#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            FeaturePreviouslyDeclared<'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 {
                    FeaturePreviouslyDeclared {
                        span: __binding_0,
                        feature: __binding_1,
                        declared: __binding_2,
                        prev_declared: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("feature `{$feature}` is declared {$declared}, but was previously declared {$prev_declared}")));
                        diag.code(E0711);
                        ;
                        diag.arg("feature", __binding_1);
                        diag.arg("declared", __binding_2);
                        diag.arg("prev_declared", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
602#[diag("feature `{$feature}` is declared {$declared}, but was previously declared {$prev_declared}", code = E0711)]
603pub(crate) struct FeaturePreviouslyDeclared<'a> {
604    #[primary_span]
605    pub span: Span,
606    pub feature: Symbol,
607    pub declared: &'a str,
608    pub prev_declared: &'a str,
609}
610
611#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleRustcMain where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MultipleRustcMain {
                        span: __binding_0,
                        first: __binding_1,
                        additional: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple functions with a `#[rustc_main]` attribute")));
                        diag.code(E0137);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first `#[rustc_main]` function")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("additional `#[rustc_main]` function")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
612#[diag("multiple functions with a `#[rustc_main]` attribute", code = E0137)]
613pub(crate) struct MultipleRustcMain {
614    #[primary_span]
615    pub span: Span,
616    #[label("first `#[rustc_main]` function")]
617    pub first: Span,
618    #[label("additional `#[rustc_main]` function")]
619    pub additional: Span,
620}
621
622#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for ExternMain
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ExternMain { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `main` function cannot be declared in an `extern` block")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
623#[diag("the `main` function cannot be declared in an `extern` block")]
624pub(crate) struct ExternMain {
625    #[primary_span]
626    pub span: Span,
627}
628
629pub(crate) struct NoMainErr {
630    pub sp: Span,
631    pub crate_name: Symbol,
632    pub has_filename: bool,
633    pub filename: PathBuf,
634    pub file_empty: bool,
635    pub non_main_fns: Vec<Span>,
636    pub main_def_opt: Option<MainDefinition>,
637    pub add_teach_note: bool,
638}
639
640impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NoMainErr {
641    #[track_caller]
642    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
643        let mut diag =
644            Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`main` function not found in crate `{$crate_name}`"))msg!("`main` function not found in crate `{$crate_name}`"));
645        diag.span(DUMMY_SP);
646        diag.code(E0601);
647        diag.arg("crate_name", self.crate_name);
648        diag.arg("filename", self.filename);
649        diag.arg("has_filename", self.has_filename);
650        let note = if !self.non_main_fns.is_empty() {
651            for &span in &self.non_main_fns {
652                diag.span_note(span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("here is a function named `main`"))msg!("here is a function named `main`"));
653            }
654            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you have one or more functions named `main` not defined at the crate level"))msg!(
655                "you have one or more functions named `main` not defined at the crate level"
656            ));
657            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider moving the `main` function definitions"))msg!("consider moving the `main` function definitions"));
658            // There were some functions named `main` though. Try to give the user a hint.
659            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the main function must be defined at the crate level{$has_filename ->\n                    [true] {\" \"}(in `{$filename}`)\n                    *[false] {\"\"}\n                }"))msg!(
660                "the main function must be defined at the crate level{$has_filename ->
661                    [true] {\" \"}(in `{$filename}`)
662                    *[false] {\"\"}
663                }"
664            )
665        } else if self.has_filename {
666            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider adding a `main` function to `{$filename}`"))msg!("consider adding a `main` function to `{$filename}`")
667        } else {
668            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider adding a `main` function at the crate level"))msg!("consider adding a `main` function at the crate level")
669        };
670        if self.file_empty {
671            diag.note(note);
672        } else {
673            diag.span(self.sp.shrink_to_hi());
674            diag.span_label(self.sp.shrink_to_hi(), note);
675        }
676
677        if let Some(main_def) = self.main_def_opt
678            && main_def.opt_fn_def_id().is_none()
679        {
680            // There is something at `crate::main`, but it is not a function definition.
681            diag.span_label(main_def.span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("non-function item at `crate::main` is found"))msg!("non-function item at `crate::main` is found"));
682        }
683
684        if self.add_teach_note {
685            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you don't know the basics of Rust, you can go look to the Rust Book to get started: https://doc.rust-lang.org/book/"))msg!("if you don't know the basics of Rust, you can go look to the Rust Book to get started: https://doc.rust-lang.org/book/"));
686        }
687        diag
688    }
689}
690
691pub(crate) struct DuplicateLangItem {
692    pub local_span: Option<Span>,
693    pub lang_item_name: Symbol,
694    pub crate_name: Symbol,
695    pub dependency_of: Option<Symbol>,
696    pub is_local: bool,
697    pub path: String,
698    pub first_defined_span: Option<Span>,
699    pub orig_crate_name: Option<Symbol>,
700    pub orig_dependency_of: Option<Symbol>,
701    pub orig_is_local: bool,
702    pub orig_path: String,
703    pub(crate) duplicate: Duplicate,
704}
705
706impl<G: EmissionGuarantee> Diagnostic<'_, G> for DuplicateLangItem {
707    #[track_caller]
708    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
709        let mut diag = Diag::new(
710            dcx,
711            level,
712            match self.duplicate {
713                Duplicate::Plain => rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found duplicate lang item `{$lang_item_name}`"))msg!("found duplicate lang item `{$lang_item_name}`"),
714                Duplicate::Crate => {
715                    rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate lang item in crate `{$crate_name}`: `{$lang_item_name}`"))msg!("duplicate lang item in crate `{$crate_name}`: `{$lang_item_name}`")
716                }
717                Duplicate::CrateDepends => rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate lang item in crate `{$crate_name}` (which `{$dependency_of}` depends on): `{$lang_item_name}`"))msg!(
718                    "duplicate lang item in crate `{$crate_name}` (which `{$dependency_of}` depends on): `{$lang_item_name}`"
719                ),
720            },
721        );
722        diag.code(E0152);
723        diag.arg("lang_item_name", self.lang_item_name);
724        diag.arg("crate_name", self.crate_name);
725        if let Some(dependency_of) = self.dependency_of {
726            diag.arg("dependency_of", dependency_of);
727        }
728        diag.arg("path", self.path);
729        if let Some(orig_crate_name) = self.orig_crate_name {
730            diag.arg("orig_crate_name", orig_crate_name);
731        }
732        if let Some(orig_dependency_of) = self.orig_dependency_of {
733            diag.arg("orig_dependency_of", orig_dependency_of);
734        }
735        diag.arg("orig_path", self.orig_path);
736        if let Some(span) = self.local_span {
737            diag.span(span);
738        }
739        if let Some(span) = self.first_defined_span {
740            diag.span_note(span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the lang item is first defined here"))msg!("the lang item is first defined here"));
741        } else {
742            if self.orig_dependency_of.is_none() {
743                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the lang item is first defined in crate `{$orig_crate_name}`"))msg!("the lang item is first defined in crate `{$orig_crate_name}`"));
744            } else {
745                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on)"))msg!("the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on)"));
746            }
747
748            if self.orig_is_local {
749                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first definition in the local crate (`{$orig_crate_name}`)"))msg!("first definition in the local crate (`{$orig_crate_name}`)"));
750            } else {
751                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first definition in `{$orig_crate_name}` loaded from {$orig_path}"))msg!(
752                    "first definition in `{$orig_crate_name}` loaded from {$orig_path}"
753                ));
754            }
755
756            if self.is_local {
757                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("second definition in the local crate (`{$crate_name}`)"))msg!("second definition in the local crate (`{$crate_name}`)"));
758            } else {
759                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("second definition in `{$crate_name}` loaded from {$path}"))msg!("second definition in `{$crate_name}` loaded from {$path}"));
760            }
761        }
762        diag
763    }
764}
765
766#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            IncorrectTarget<'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 {
                    IncorrectTarget {
                        span: __binding_0,
                        generics_span: __binding_1,
                        name: __binding_2,
                        kind: __binding_3,
                        num: __binding_4,
                        actual_num: __binding_5,
                        at_least: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` lang item must be applied to a {$kind} with {$at_least ->\n        [true] at least {$num}\n        *[false] {$num}\n    } generic {$num ->\n        [one] argument\n        *[other] arguments\n    }")));
                        diag.code(E0718);
                        ;
                        diag.arg("name", __binding_2);
                        diag.arg("kind", __binding_3);
                        diag.arg("num", __binding_4);
                        diag.arg("actual_num", __binding_5);
                        diag.arg("at_least", __binding_6);
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this {$kind} has {$actual_num} generic {$actual_num ->\n            [one] argument\n            *[other] arguments\n        }")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
767#[diag("`{$name}` lang item must be applied to a {$kind} with {$at_least ->
768        [true] at least {$num}
769        *[false] {$num}
770    } generic {$num ->
771        [one] argument
772        *[other] arguments
773    }", code = E0718)]
774pub(crate) struct IncorrectTarget<'a> {
775    #[primary_span]
776    pub span: Span,
777    #[label(
778        "this {$kind} has {$actual_num} generic {$actual_num ->
779            [one] argument
780            *[other] arguments
781        }"
782    )]
783    pub generics_span: Span,
784    pub name: &'a str, // cannot be symbol because it renders e.g. `r#fn` instead of `fn`
785    pub kind: &'static str,
786    pub num: usize,
787    pub actual_num: usize,
788    pub at_least: bool,
789}
790
791#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncorrectCrateType where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncorrectCrateType { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lang items are not allowed in stable dylibs")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
792#[diag("lang items are not allowed in stable dylibs")]
793pub(crate) struct IncorrectCrateType {
794    #[primary_span]
795    pub span: Span,
796}
797
798#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            UselessAssignment<'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 {
                    UselessAssignment {
                        is_field_assign: __binding_0, ty: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("useless assignment of {$is_field_assign ->\n        [true] field\n        *[false] variable\n    } of type `{$ty}` to itself")));
                        ;
                        diag.arg("is_field_assign", __binding_0);
                        diag.arg("ty", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
799#[diag(
800    "useless assignment of {$is_field_assign ->
801        [true] field
802        *[false] variable
803    } of type `{$ty}` to itself"
804)]
805pub(crate) struct UselessAssignment<'a> {
806    pub is_field_assign: bool,
807    pub ty: Ty<'a>,
808}
809
810#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InlineIgnoredForExported where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InlineIgnoredForExported => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[inline]` is ignored on externally exported functions")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
811#[diag("`#[inline]` is ignored on externally exported functions")]
812#[help(
813    "externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`"
814)]
815pub(crate) struct InlineIgnoredForExported;
816
817#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ObjectLifetimeErr where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ObjectLifetimeErr { span: __binding_0, repr: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$repr}")));
                        ;
                        diag.arg("repr", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
818#[diag("{$repr}")]
819pub(crate) struct ObjectLifetimeErr {
820    #[primary_span]
821    pub span: Span,
822    pub repr: String,
823}
824
825#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AttrApplication where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AttrApplication::Enum {
                        hint_span: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to an enum")));
                        diag.code(E0517);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not an enum")));
                        diag
                    }
                    AttrApplication::Struct {
                        hint_span: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to a struct")));
                        diag.code(E0517);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a struct")));
                        diag
                    }
                    AttrApplication::StructUnion {
                        hint_span: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to a struct or union")));
                        diag.code(E0517);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a struct or union")));
                        diag
                    }
                    AttrApplication::StructEnumUnion {
                        hint_span: __binding_0, span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute should be applied to a struct, enum, or union")));
                        diag.code(E0517);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a struct, enum, or union")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
826pub(crate) enum AttrApplication {
827    #[diag("attribute should be applied to an enum", code = E0517)]
828    Enum {
829        #[primary_span]
830        hint_span: Span,
831        #[label("not an enum")]
832        span: Span,
833    },
834    #[diag("attribute should be applied to a struct", code = E0517)]
835    Struct {
836        #[primary_span]
837        hint_span: Span,
838        #[label("not a struct")]
839        span: Span,
840    },
841    #[diag("attribute should be applied to a struct or union", code = E0517)]
842    StructUnion {
843        #[primary_span]
844        hint_span: Span,
845        #[label("not a struct or union")]
846        span: Span,
847    },
848    #[diag("attribute should be applied to a struct, enum, or union", code = E0517)]
849    StructEnumUnion {
850        #[primary_span]
851        hint_span: Span,
852        #[label("not a struct, enum, or union")]
853        span: Span,
854    },
855}
856
857#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TransparentIncompatible where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TransparentIncompatible {
                        hint_spans: __binding_0, target: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("transparent {$target} cannot have other repr hints")));
                        diag.code(E0692);
                        ;
                        diag.arg("target", __binding_1);
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
858#[diag("transparent {$target} cannot have other repr hints", code = E0692)]
859pub(crate) struct TransparentIncompatible {
860    #[primary_span]
861    pub hint_spans: Vec<Span>,
862    pub target: String,
863}
864
865#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DeprecatedAttribute where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DeprecatedAttribute { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("deprecated attribute must be paired with either stable or unstable attribute")));
                        diag.code(E0549);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
866#[diag("deprecated attribute must be paired with either stable or unstable attribute", code = E0549)]
867pub(crate) struct DeprecatedAttribute {
868    #[primary_span]
869    pub span: Span,
870}
871
872#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UselessStability where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UselessStability { span: __binding_0, item_sp: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this stability annotation is useless")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("useless stability annotation")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the stability attribute annotates this item")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
873#[diag("this stability annotation is useless")]
874pub(crate) struct UselessStability {
875    #[primary_span]
876    #[label("useless stability annotation")]
877    pub span: Span,
878    #[label("the stability attribute annotates this item")]
879    pub item_sp: Span,
880}
881
882#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotStabilizeDeprecated where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CannotStabilizeDeprecated {
                        span: __binding_0, item_sp: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an API can't be stabilized after it is deprecated")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid version")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the stability attribute annotates this item")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
883#[diag("an API can't be stabilized after it is deprecated")]
884pub(crate) struct CannotStabilizeDeprecated {
885    #[primary_span]
886    #[label("invalid version")]
887    pub span: Span,
888    #[label("the stability attribute annotates this item")]
889    pub item_sp: Span,
890}
891
892#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnstableAttrForAlreadyStableFeature where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnstableAttrForAlreadyStableFeature {
                        attr_span: __binding_0, item_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't mark as unstable using an already stable feature")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this feature is already stable")));
                        diag.span_help(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing the attribute")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the stability attribute annotates this item")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
893#[diag("can't mark as unstable using an already stable feature")]
894pub(crate) struct UnstableAttrForAlreadyStableFeature {
895    #[primary_span]
896    #[label("this feature is already stable")]
897    #[help("consider removing the attribute")]
898    pub attr_span: Span,
899    #[label("the stability attribute annotates this item")]
900    pub item_span: Span,
901}
902
903#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingStabilityAttr<'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 {
                    MissingStabilityAttr { span: __binding_0, descr: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$descr} has missing stability attribute")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
904#[diag("{$descr} has missing stability attribute")]
905pub(crate) struct MissingStabilityAttr<'a> {
906    #[primary_span]
907    pub span: Span,
908    pub descr: &'a str,
909}
910
911#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingConstStabAttr<'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 {
                    MissingConstStabAttr { span: __binding_0, descr: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$descr} has missing const stability attribute")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
912#[diag("{$descr} has missing const stability attribute")]
913pub(crate) struct MissingConstStabAttr<'a> {
914    #[primary_span]
915    pub span: Span,
916    pub descr: &'a str,
917}
918
919#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TraitImplConstStable where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TraitImplConstStable { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("trait implementations cannot be const stable yet")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
920#[diag("trait implementations cannot be const stable yet")]
921#[note("see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information")]
922pub(crate) struct TraitImplConstStable {
923    #[primary_span]
924    pub span: Span,
925}
926
927#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TraitImplConstStabilityMismatch where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TraitImplConstStabilityMismatch {
                        span: __binding_0,
                        impl_stability: __binding_1,
                        trait_stability: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const stability on the impl does not match the const stability on the trait")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
928#[diag("const stability on the impl does not match the const stability on the trait")]
929pub(crate) struct TraitImplConstStabilityMismatch {
930    #[primary_span]
931    pub span: Span,
932    #[subdiagnostic]
933    pub impl_stability: ImplConstStability,
934    #[subdiagnostic]
935    pub trait_stability: TraitConstStability,
936}
937
938#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for TraitConstStability {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    TraitConstStability::Stable { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("...but the trait is stable")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                    TraitConstStability::Unstable { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("...but the trait is unstable")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
939pub(crate) enum TraitConstStability {
940    #[note("...but the trait is stable")]
941    Stable {
942        #[primary_span]
943        span: Span,
944    },
945    #[note("...but the trait is unstable")]
946    Unstable {
947        #[primary_span]
948        span: Span,
949    },
950}
951
952#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ImplConstStability {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ImplConstStability::Stable { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this impl is (implicitly) stable...")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                    ImplConstStability::Unstable { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this impl is unstable...")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
953pub(crate) enum ImplConstStability {
954    #[note("this impl is (implicitly) stable...")]
955    Stable {
956        #[primary_span]
957        span: Span,
958    },
959    #[note("this impl is unstable...")]
960    Unstable {
961        #[primary_span]
962        span: Span,
963    },
964}
965
966#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for UnknownFeature
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnknownFeature {
                        span: __binding_0,
                        feature: __binding_1,
                        suggestion: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown feature `{$feature}`")));
                        diag.code(E0635);
                        ;
                        diag.arg("feature", __binding_1);
                        diag.span(__binding_0);
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
967#[diag("unknown feature `{$feature}`", code = E0635)]
968pub(crate) struct UnknownFeature {
969    #[primary_span]
970    pub span: Span,
971    pub feature: Symbol,
972    #[subdiagnostic]
973    pub suggestion: Option<MisspelledFeature>,
974}
975
976#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MisspelledFeature {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MisspelledFeature {
                        span: __binding_0, actual_name: __binding_1 } => {
                        let __code_6 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("actual_name", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a feature with a similar name: `{$actual_name}`")));
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_6, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
977#[suggestion(
978    "there is a feature with a similar name: `{$actual_name}`",
979    style = "verbose",
980    code = "{actual_name}",
981    applicability = "maybe-incorrect"
982)]
983pub(crate) struct MisspelledFeature {
984    #[primary_span]
985    pub span: Span,
986    pub actual_name: Symbol,
987}
988
989#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for RenamedFeature
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RenamedFeature {
                        span: __binding_0, feature: __binding_1, alias: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("feature `{$alias}` has been renamed to `{$feature}`")));
                        diag.code(E0635);
                        ;
                        diag.arg("feature", __binding_1);
                        diag.arg("alias", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
990#[diag("feature `{$alias}` has been renamed to `{$feature}`", code = E0635)]
991pub(crate) struct RenamedFeature {
992    #[primary_span]
993    pub span: Span,
994    pub feature: Symbol,
995    pub alias: Symbol,
996}
997
998#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ImpliedFeatureNotExist where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ImpliedFeatureNotExist {
                        span: __binding_0,
                        feature: __binding_1,
                        implied_by: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("feature `{$implied_by}` implying `{$feature}` does not exist")));
                        ;
                        diag.arg("feature", __binding_1);
                        diag.arg("implied_by", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
999#[diag("feature `{$implied_by}` implying `{$feature}` does not exist")]
1000pub(crate) struct ImpliedFeatureNotExist {
1001    #[primary_span]
1002    pub span: Span,
1003    pub feature: Symbol,
1004    pub implied_by: Symbol,
1005}
1006
1007#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DuplicateFeatureErr where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DuplicateFeatureErr {
                        span: __binding_0, feature: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature `{$feature}` has already been enabled")));
                        diag.code(E0636);
                        ;
                        diag.arg("feature", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1008#[diag("the feature `{$feature}` has already been enabled", code = E0636)]
1009pub(crate) struct DuplicateFeatureErr {
1010    #[primary_span]
1011    pub span: Span,
1012    pub feature: Symbol,
1013}
1014
1015#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingConstErr where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MissingConstErr { fn_sig_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const`")));
                        ;
                        diag.span(__binding_0);
                        diag.span_help(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("make the function or method const")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1016#[diag(
1017    "attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const`"
1018)]
1019pub(crate) struct MissingConstErr {
1020    #[primary_span]
1021    #[help("make the function or method const")]
1022    pub fn_sig_span: Span,
1023}
1024
1025#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstStableNotStable where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConstStableNotStable {
                        fn_sig_span: __binding_0, const_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]`")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute specified here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1026#[diag(
1027    "attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]`"
1028)]
1029pub(crate) struct ConstStableNotStable {
1030    #[primary_span]
1031    pub fn_sig_span: Span,
1032    #[label("attribute specified here")]
1033    pub const_span: Span,
1034}
1035
1036#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleDeadCodes<'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 {
                    MultipleDeadCodes::DeadCodes {
                        multiple: __binding_0,
                        num: __binding_1,
                        descr: __binding_2,
                        participle: __binding_3,
                        name_list: __binding_4,
                        enum_variants_with_same_name: __binding_5,
                        parent_info: __binding_6,
                        ignored_derived_impls: __binding_7 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{ $multiple ->\n            *[true] multiple {$descr}s are\n            [false] { $num ->\n                [one] {$descr} {$name_list} is\n                *[other] {$descr}s {$name_list} are\n            }\n        } never {$participle}")));
                        ;
                        diag.arg("multiple", __binding_0);
                        diag.arg("num", __binding_1);
                        diag.arg("descr", __binding_2);
                        diag.arg("participle", __binding_3);
                        diag.arg("name_list", __binding_4);
                        for __binding_5 in __binding_5 {
                            diag.subdiagnostic(__binding_5);
                        }
                        if let Some(__binding_6) = __binding_6 {
                            diag.subdiagnostic(__binding_6);
                        }
                        if let Some(__binding_7) = __binding_7 {
                            diag.subdiagnostic(__binding_7);
                        }
                        diag
                    }
                    MultipleDeadCodes::UnusedTupleStructFields {
                        multiple: __binding_0,
                        num: __binding_1,
                        descr: __binding_2,
                        participle: __binding_3,
                        name_list: __binding_4,
                        change_fields_suggestion: __binding_5,
                        parent_info: __binding_6,
                        ignored_derived_impls: __binding_7 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{ $multiple ->\n            *[true] multiple {$descr}s are\n            [false] { $num ->\n                [one] {$descr} {$name_list} is\n                *[other] {$descr}s {$name_list} are\n            }\n        } never {$participle}")));
                        ;
                        diag.arg("multiple", __binding_0);
                        diag.arg("num", __binding_1);
                        diag.arg("descr", __binding_2);
                        diag.arg("participle", __binding_3);
                        diag.arg("name_list", __binding_4);
                        diag.subdiagnostic(__binding_5);
                        if let Some(__binding_6) = __binding_6 {
                            diag.subdiagnostic(__binding_6);
                        }
                        if let Some(__binding_7) = __binding_7 {
                            diag.subdiagnostic(__binding_7);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1037pub(crate) enum MultipleDeadCodes<'tcx> {
1038    #[diag(
1039        "{ $multiple ->
1040            *[true] multiple {$descr}s are
1041            [false] { $num ->
1042                [one] {$descr} {$name_list} is
1043                *[other] {$descr}s {$name_list} are
1044            }
1045        } never {$participle}"
1046    )]
1047    DeadCodes {
1048        multiple: bool,
1049        num: usize,
1050        descr: &'tcx str,
1051        participle: &'tcx str,
1052        name_list: DiagSymbolList,
1053        #[subdiagnostic]
1054        // only on DeadCodes since it's never a problem for tuple struct fields
1055        enum_variants_with_same_name: Vec<EnumVariantSameName<'tcx>>,
1056        #[subdiagnostic]
1057        parent_info: Option<ParentInfo<'tcx>>,
1058        #[subdiagnostic]
1059        ignored_derived_impls: Option<IgnoredDerivedImpls>,
1060    },
1061    #[diag(
1062        "{ $multiple ->
1063            *[true] multiple {$descr}s are
1064            [false] { $num ->
1065                [one] {$descr} {$name_list} is
1066                *[other] {$descr}s {$name_list} are
1067            }
1068        } never {$participle}"
1069    )]
1070    UnusedTupleStructFields {
1071        multiple: bool,
1072        num: usize,
1073        descr: &'tcx str,
1074        participle: &'tcx str,
1075        name_list: DiagSymbolList,
1076        #[subdiagnostic]
1077        change_fields_suggestion: ChangeFields,
1078        #[subdiagnostic]
1079        parent_info: Option<ParentInfo<'tcx>>,
1080        #[subdiagnostic]
1081        ignored_derived_impls: Option<IgnoredDerivedImpls>,
1082    },
1083}
1084
1085#[derive(const _: () =
    {
        impl<'tcx> rustc_errors::Subdiagnostic for EnumVariantSameName<'tcx> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    EnumVariantSameName {
                        variant_span: __binding_0,
                        dead_name: __binding_1,
                        dead_descr: __binding_2 } => {
                        diag.store_args();
                        diag.arg("dead_name", __binding_1);
                        diag.arg("dead_descr", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("it is impossible to refer to the {$dead_descr} `{$dead_name}` because it is shadowed by this enum variant with the same name")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1086#[note(
1087    "it is impossible to refer to the {$dead_descr} `{$dead_name}` because it is shadowed by this enum variant with the same name"
1088)]
1089pub(crate) struct EnumVariantSameName<'tcx> {
1090    #[primary_span]
1091    pub variant_span: Span,
1092    pub dead_name: Symbol,
1093    pub dead_descr: &'tcx str,
1094}
1095
1096#[derive(const _: () =
    {
        impl<'tcx> rustc_errors::Subdiagnostic for ParentInfo<'tcx> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ParentInfo {
                        num: __binding_0,
                        descr: __binding_1,
                        parent_descr: __binding_2,
                        span: __binding_3 } => {
                        diag.store_args();
                        diag.arg("num", __binding_0);
                        diag.arg("descr", __binding_1);
                        diag.arg("parent_descr", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$num ->\n        [one] {$descr}\n        *[other] {$descr}s\n    } in this {$parent_descr}")));
                        diag.span_label(__binding_3, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1097#[label(
1098    "{$num ->
1099        [one] {$descr}
1100        *[other] {$descr}s
1101    } in this {$parent_descr}"
1102)]
1103pub(crate) struct ParentInfo<'tcx> {
1104    pub num: usize,
1105    pub descr: &'tcx str,
1106    pub parent_descr: &'tcx str,
1107    #[primary_span]
1108    pub span: Span,
1109}
1110
1111#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for IgnoredDerivedImpls {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    IgnoredDerivedImpls {
                        name: __binding_0,
                        trait_list: __binding_1,
                        trait_list_len: __binding_2 } => {
                        diag.store_args();
                        diag.arg("name", __binding_0);
                        diag.arg("trait_list", __binding_1);
                        diag.arg("trait_list_len", __binding_2);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` has {$trait_list_len ->\n        [one] a derived impl\n        *[other] derived impls\n    } for the {$trait_list_len ->\n        [one] trait {$trait_list}, but this is\n        *[other] traits {$trait_list}, but these are\n    } intentionally ignored during dead code analysis")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1112#[note(
1113    "`{$name}` has {$trait_list_len ->
1114        [one] a derived impl
1115        *[other] derived impls
1116    } for the {$trait_list_len ->
1117        [one] trait {$trait_list}, but this is
1118        *[other] traits {$trait_list}, but these are
1119    } intentionally ignored during dead code analysis"
1120)]
1121pub(crate) struct IgnoredDerivedImpls {
1122    pub name: Symbol,
1123    pub trait_list: DiagSymbolList,
1124    pub trait_list_len: usize,
1125}
1126
1127#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ChangeFields {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ChangeFields::ChangeToUnitTypeOrRemove {
                        num: __binding_0, spans: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_7 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("()"))
                                });
                        for __binding_1 in __binding_1 {
                            suggestions.push((__binding_1, __code_7.clone()));
                        }
                        diag.store_args();
                        diag.arg("num", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider changing the { $num ->\n            [one] field\n            *[other] fields\n        } to be of unit type to suppress this warning while preserving the field numbering, or remove the { $num ->\n            [one] field\n            *[other] fields\n        }")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::HasPlaceholders,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                    ChangeFields::Remove { num: __binding_0 } => {
                        diag.store_args();
                        diag.arg("num", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing { $num ->\n            [one] this\n            *[other] these\n        } { $num ->\n            [one] field\n            *[other] fields\n        }")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1128pub(crate) enum ChangeFields {
1129    #[multipart_suggestion(
1130        "consider changing the { $num ->
1131            [one] field
1132            *[other] fields
1133        } to be of unit type to suppress this warning while preserving the field numbering, or remove the { $num ->
1134            [one] field
1135            *[other] fields
1136        }",
1137        applicability = "has-placeholders"
1138    )]
1139    ChangeToUnitTypeOrRemove {
1140        num: usize,
1141        #[suggestion_part(code = "()")]
1142        spans: Vec<Span>,
1143    },
1144    #[help(
1145        "consider removing { $num ->
1146            [one] this
1147            *[other] these
1148        } { $num ->
1149            [one] field
1150            *[other] fields
1151        }"
1152    )]
1153    Remove { num: usize },
1154}
1155
1156#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ProcMacroBadSig where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ProcMacroBadSig { span: __binding_0, kind: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind} has incorrect signature")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1157#[diag("{$kind} has incorrect signature")]
1158pub(crate) struct ProcMacroBadSig {
1159    #[primary_span]
1160    pub span: Span,
1161    pub kind: ProcMacroKind,
1162}
1163
1164#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnnecessaryStableFeature where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnnecessaryStableFeature {
                        feature: __binding_0, since: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature `{$feature}` has been stable since {$since} and no longer requires an attribute to enable")));
                        ;
                        diag.arg("feature", __binding_0);
                        diag.arg("since", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1165#[diag(
1166    "the feature `{$feature}` has been stable since {$since} and no longer requires an attribute to enable"
1167)]
1168pub(crate) struct UnnecessaryStableFeature {
1169    pub feature: Symbol,
1170    pub since: Symbol,
1171}
1172
1173#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnnecessaryPartialStableFeature where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnnecessaryPartialStableFeature {
                        span: __binding_0,
                        line: __binding_1,
                        feature: __binding_2,
                        since: __binding_3,
                        implies: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature `{$feature}` has been partially stabilized since {$since} and is succeeded by the feature `{$implies}`")));
                        let __code_8 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_4))
                                            })].into_iter();
                        let __code_9 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("feature", __binding_2);
                        diag.arg("since", __binding_3);
                        diag.arg("implies", __binding_4);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you are using features which are still unstable, change to using `{$implies}`")),
                            __code_8, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you are using features which are now stable, remove this line")),
                            __code_9, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1174#[diag(
1175    "the feature `{$feature}` has been partially stabilized since {$since} and is succeeded by the feature `{$implies}`"
1176)]
1177pub(crate) struct UnnecessaryPartialStableFeature {
1178    #[suggestion(
1179        "if you are using features which are still unstable, change to using `{$implies}`",
1180        code = "{implies}",
1181        applicability = "maybe-incorrect"
1182    )]
1183    pub span: Span,
1184    #[suggestion(
1185        "if you are using features which are now stable, remove this line",
1186        code = "",
1187        applicability = "maybe-incorrect"
1188    )]
1189    pub line: Span,
1190    pub feature: Symbol,
1191    pub since: Symbol,
1192    pub implies: Symbol,
1193}
1194
1195#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IneffectiveUnstableImpl where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IneffectiveUnstableImpl => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an `#[unstable]` annotation here has no effect")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1196#[diag("an `#[unstable]` annotation here has no effect")]
1197#[note("see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information")]
1198pub(crate) struct IneffectiveUnstableImpl;
1199
1200#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizeAttributeNotAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizeAttributeNotAllowed {
                        attr_span: __binding_0,
                        not_fn_impl_mod: __binding_1,
                        no_body: __binding_2,
                        help: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("sanitize attribute not allowed here")));
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a function, impl block, or module")));
                        }
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_label(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function has no body")));
                        }
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("sanitize attribute can be applied to a function (with body), impl block, or module")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1201#[diag("sanitize attribute not allowed here")]
1202pub(crate) struct SanitizeAttributeNotAllowed {
1203    #[primary_span]
1204    pub attr_span: Span,
1205    #[label("not a function, impl block, or module")]
1206    pub not_fn_impl_mod: Option<Span>,
1207    #[label("function has no body")]
1208    pub no_body: Option<Span>,
1209    #[help("sanitize attribute can be applied to a function (with body), impl block, or module")]
1210    pub help: (),
1211}
1212
1213// FIXME(jdonszelmann): move back to rustc_attr
1214#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcConstStableIndirectPairing where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RustcConstStableIndirectPairing { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`const_stable_indirect` attribute does not make sense on `rustc_const_stable` function, its behavior is already implied")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1215#[diag(
1216    "`const_stable_indirect` attribute does not make sense on `rustc_const_stable` function, its behavior is already implied"
1217)]
1218pub(crate) struct RustcConstStableIndirectPairing {
1219    #[primary_span]
1220    pub span: Span,
1221}
1222
1223#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsupportedAttributesInWhere where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsupportedAttributesInWhere { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("most attributes are not supported in `where` clauses")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `#[cfg]` and `#[cfg_attr]` are supported")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1224#[diag("most attributes are not supported in `where` clauses")]
1225#[help("only `#[cfg]` and `#[cfg_attr]` are supported")]
1226pub(crate) struct UnsupportedAttributesInWhere {
1227    #[primary_span]
1228    pub span: MultiSpan,
1229}
1230
1231#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            UnexportableItem<'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 {
                    UnexportableItem::Item {
                        span: __binding_0, descr: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$descr}'s are not exportable")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                    UnexportableItem::GenericFn(__binding_0) => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic functions are not exportable")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                    UnexportableItem::FnAbi(__binding_0) => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only functions with \"C\" ABI are exportable")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                    UnexportableItem::TypeRepr(__binding_0) => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("types with unstable layout are not exportable")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                    UnexportableItem::TypeInInterface {
                        span: __binding_0,
                        desc: __binding_1,
                        ty: __binding_2,
                        ty_span: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$desc} with `#[export_stable]` attribute uses type `{$ty}`, which is not exportable")));
                        ;
                        diag.arg("desc", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not exportable")));
                        diag
                    }
                    UnexportableItem::PrivItem {
                        span: __binding_0,
                        vis_note: __binding_1,
                        vis_descr: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("private items are not exportable")));
                        ;
                        diag.arg("vis_descr", __binding_2);
                        diag.span(__binding_0);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("is only usable at visibility `{$vis_descr}`")));
                        diag
                    }
                    UnexportableItem::AdtWithPrivFields {
                        span: __binding_0,
                        vis_note: __binding_1,
                        field_name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ADT types with private fields are not exportable")));
                        ;
                        diag.arg("field_name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$field_name}` is private")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1232pub(crate) enum UnexportableItem<'a> {
1233    #[diag("{$descr}'s are not exportable")]
1234    Item {
1235        #[primary_span]
1236        span: Span,
1237        descr: &'a str,
1238    },
1239
1240    #[diag("generic functions are not exportable")]
1241    GenericFn(#[primary_span] Span),
1242
1243    #[diag("only functions with \"C\" ABI are exportable")]
1244    FnAbi(#[primary_span] Span),
1245
1246    #[diag("types with unstable layout are not exportable")]
1247    TypeRepr(#[primary_span] Span),
1248
1249    #[diag("{$desc} with `#[export_stable]` attribute uses type `{$ty}`, which is not exportable")]
1250    TypeInInterface {
1251        #[primary_span]
1252        span: Span,
1253        desc: &'a str,
1254        ty: &'a str,
1255        #[label("not exportable")]
1256        ty_span: Span,
1257    },
1258
1259    #[diag("private items are not exportable")]
1260    PrivItem {
1261        #[primary_span]
1262        span: Span,
1263        #[note("is only usable at visibility `{$vis_descr}`")]
1264        vis_note: Span,
1265        vis_descr: &'a str,
1266    },
1267
1268    #[diag("ADT types with private fields are not exportable")]
1269    AdtWithPrivFields {
1270        #[primary_span]
1271        span: Span,
1272        #[note("`{$field_name}` is private")]
1273        vis_note: Span,
1274        field_name: &'a str,
1275    },
1276}
1277
1278#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ReprAlignShouldBeAlign where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReprAlignShouldBeAlign {
                        span: __binding_0, item: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[repr(align(...))]` is not supported on {$item}")));
                        ;
                        diag.arg("item", __binding_1);
                        diag.span(__binding_0);
                        diag.span_help(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#[rustc_align(...)]` instead")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1279#[diag("`#[repr(align(...))]` is not supported on {$item}")]
1280pub(crate) struct ReprAlignShouldBeAlign {
1281    #[primary_span]
1282    #[help("use `#[rustc_align(...)]` instead")]
1283    pub span: Span,
1284    pub item: &'static str,
1285}
1286
1287#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ReprAlignShouldBeAlignStatic where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReprAlignShouldBeAlignStatic {
                        span: __binding_0, item: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[repr(align(...))]` is not supported on {$item}")));
                        ;
                        diag.arg("item", __binding_1);
                        diag.span(__binding_0);
                        diag.span_help(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#[rustc_align_static(...)]` instead")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1288#[diag("`#[repr(align(...))]` is not supported on {$item}")]
1289pub(crate) struct ReprAlignShouldBeAlignStatic {
1290    #[primary_span]
1291    #[help("use `#[rustc_align_static(...)]` instead")]
1292    pub span: Span,
1293    pub item: &'static str,
1294}
1295
1296#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CustomMirPhaseRequiresDialect where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CustomMirPhaseRequiresDialect {
                        attr_span: __binding_0, phase_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`dialect` key required")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`phase` argument requires a `dialect` argument")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1297#[diag("`dialect` key required")]
1298pub(crate) struct CustomMirPhaseRequiresDialect {
1299    #[primary_span]
1300    pub attr_span: Span,
1301    #[label("`phase` argument requires a `dialect` argument")]
1302    pub phase_span: Span,
1303}
1304
1305#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CustomMirIncompatibleDialectAndPhase where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CustomMirIncompatibleDialectAndPhase {
                        dialect: __binding_0,
                        phase: __binding_1,
                        attr_span: __binding_2,
                        dialect_span: __binding_3,
                        phase_span: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$dialect} dialect is not compatible with the {$phase} phase")));
                        ;
                        diag.arg("dialect", __binding_0);
                        diag.arg("phase", __binding_1);
                        diag.span(__binding_2);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this dialect...")));
                        diag.span_label(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("... is not compatible with this phase")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1306#[diag("the {$dialect} dialect is not compatible with the {$phase} phase")]
1307pub(crate) struct CustomMirIncompatibleDialectAndPhase {
1308    pub dialect: MirDialect,
1309    pub phase: MirPhase,
1310    #[primary_span]
1311    pub attr_span: Span,
1312    #[label("this dialect...")]
1313    pub dialect_span: Span,
1314    #[label("... is not compatible with this phase")]
1315    pub phase_span: Span,
1316}
1317
1318#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EiiImplNotFunction where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EiiImplNotFunction { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`eii_macro_for` is only valid on functions")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1319#[diag("`eii_macro_for` is only valid on functions")]
1320pub(crate) struct EiiImplNotFunction {
1321    #[primary_span]
1322    pub span: Span,
1323}
1324
1325#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EiiImplRequiresUnsafe where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EiiImplRequiresUnsafe {
                        span: __binding_0,
                        name: __binding_1,
                        suggestion: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` is unsafe to implement")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1326#[diag("`#[{$name}]` is unsafe to implement")]
1327pub(crate) struct EiiImplRequiresUnsafe {
1328    #[primary_span]
1329    pub span: Span,
1330    pub name: Symbol,
1331    #[subdiagnostic]
1332    pub suggestion: EiiImplRequiresUnsafeSuggestion,
1333}
1334
1335#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for EiiImplRequiresUnsafeSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    EiiImplRequiresUnsafeSuggestion {
                        left: __binding_0, right: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_10 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("unsafe("))
                                });
                        let __code_11 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_10));
                        suggestions.push((__binding_1, __code_11));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrap the attribute in `unsafe(...)`")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1336#[multipart_suggestion("wrap the attribute in `unsafe(...)`", applicability = "machine-applicable")]
1337pub(crate) struct EiiImplRequiresUnsafeSuggestion {
1338    #[suggestion_part(code = "unsafe(")]
1339    pub left: Span,
1340    #[suggestion_part(code = ")")]
1341    pub right: Span,
1342}
1343
1344#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EiiWithTrackCaller where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EiiWithTrackCaller {
                        attr_span: __binding_0,
                        name: __binding_1,
                        sig_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` is not allowed to have `#[track_caller]`")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` is not allowed to have `#[track_caller]`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1345#[diag("`#[{$name}]` is not allowed to have `#[track_caller]`")]
1346pub(crate) struct EiiWithTrackCaller {
1347    #[primary_span]
1348    pub attr_span: Span,
1349    pub name: Symbol,
1350    #[label("`#[{$name}]` is not allowed to have `#[track_caller]`")]
1351    pub sig_span: Span,
1352}
1353
1354#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for EiiWithoutImpl
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EiiWithoutImpl {
                        span: __binding_0,
                        name: __binding_1,
                        current_crate_name: __binding_2,
                        decl_crate_name: __binding_3,
                        help: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` required, but not found")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("current_crate_name", __binding_2);
                        diag.arg("decl_crate_name", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected because `#[{$name}]` was declared here in crate `{$decl_crate_name}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected at least one implementation in crate `{$current_crate_name}` or any of its dependencies")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1355#[diag("`#[{$name}]` required, but not found")]
1356pub(crate) struct EiiWithoutImpl {
1357    #[primary_span]
1358    #[label("expected because `#[{$name}]` was declared here in crate `{$decl_crate_name}`")]
1359    pub span: Span,
1360    pub name: Symbol,
1361
1362    pub current_crate_name: Symbol,
1363    pub decl_crate_name: Symbol,
1364    #[help(
1365        "expected at least one implementation in crate `{$current_crate_name}` or any of its dependencies"
1366    )]
1367    pub help: (),
1368}
1369
1370#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DuplicateEiiImpls where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DuplicateEiiImpls {
                        name: __binding_0,
                        first_span: __binding_1,
                        first_crate: __binding_2,
                        second_span: __binding_3,
                        second_crate: __binding_4,
                        additional_crates: __binding_5,
                        num_additional_crates: __binding_6,
                        additional_crate_names: __binding_7,
                        help: __binding_8 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple implementations of `#[{$name}]`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.arg("first_crate", __binding_2);
                        diag.arg("second_crate", __binding_4);
                        diag.arg("num_additional_crates", __binding_6);
                        diag.arg("additional_crate_names", __binding_7);
                        diag.span(__binding_1);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first implemented here in crate `{$first_crate}`")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("also implemented here in crate `{$second_crate}`")));
                        if let Some(__binding_5) = __binding_5 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in addition to these two, { $num_additional_crates ->\n        [one] another implementation was found in crate {$additional_crate_names}\n        *[other] more implementations were also found in the following crates: {$additional_crate_names}\n    }")));
                        }
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an \"externally implementable item\" can only have a single implementation in the final artifact. When multiple implementations are found, also in different crates, they conflict")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1371#[diag("multiple implementations of `#[{$name}]`")]
1372pub(crate) struct DuplicateEiiImpls {
1373    pub name: Symbol,
1374
1375    #[primary_span]
1376    #[label("first implemented here in crate `{$first_crate}`")]
1377    pub first_span: Span,
1378    pub first_crate: Symbol,
1379
1380    #[label("also implemented here in crate `{$second_crate}`")]
1381    pub second_span: Span,
1382    pub second_crate: Symbol,
1383
1384    #[note("in addition to these two, { $num_additional_crates ->
1385        [one] another implementation was found in crate {$additional_crate_names}
1386        *[other] more implementations were also found in the following crates: {$additional_crate_names}
1387    }")]
1388    pub additional_crates: Option<()>,
1389
1390    pub num_additional_crates: usize,
1391    pub additional_crate_names: String,
1392
1393    #[help(
1394        "an \"externally implementable item\" can only have a single implementation in the final artifact. When multiple implementations are found, also in different crates, they conflict"
1395    )]
1396    pub help: (),
1397}
1398
1399#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FunctionNotHaveDefaultImplementation where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FunctionNotHaveDefaultImplementation {
                        span: __binding_0, note_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function doesn't have a default implementation")));
                        ;
                        diag.span(__binding_0);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("required by this annotation")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1400#[diag("function doesn't have a default implementation")]
1401pub(crate) struct FunctionNotHaveDefaultImplementation {
1402    #[primary_span]
1403    pub span: Span,
1404    #[note("required by this annotation")]
1405    pub note_span: Span,
1406}
1407
1408#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MustImplementNotFunction where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MustImplementNotFunction {
                        span: __binding_0, span_note: __binding_1, note: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a function")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1409#[diag("not a function")]
1410pub(crate) struct MustImplementNotFunction {
1411    #[primary_span]
1412    pub span: Span,
1413    #[subdiagnostic]
1414    pub span_note: MustImplementNotFunctionSpanNote,
1415    #[subdiagnostic]
1416    pub note: MustImplementNotFunctionNote,
1417}
1418
1419#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MustImplementNotFunctionSpanNote
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MustImplementNotFunctionSpanNote { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("required by this annotation")));
                        diag.span_note(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1420#[note("required by this annotation")]
1421pub(crate) struct MustImplementNotFunctionSpanNote {
1422    #[primary_span]
1423    pub span: Span,
1424}
1425
1426#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MustImplementNotFunctionNote {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MustImplementNotFunctionNote {} => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("all `#[rustc_must_implement_one_of]` arguments must be associated function names")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
1427#[note("all `#[rustc_must_implement_one_of]` arguments must be associated function names")]
1428pub(crate) struct MustImplementNotFunctionNote {}
1429
1430#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FunctionNotFoundInTrait where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FunctionNotFoundInTrait { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function not found in this trait")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1431#[diag("function not found in this trait")]
1432pub(crate) struct FunctionNotFoundInTrait {
1433    #[primary_span]
1434    pub span: Span,
1435}
1436
1437#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FunctionNamesDuplicated where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FunctionNamesDuplicated { spans: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("functions names are duplicated")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("all `#[rustc_must_implement_one_of]` arguments must be unique")));
                        ;
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1438#[diag("functions names are duplicated")]
1439#[note("all `#[rustc_must_implement_one_of]` arguments must be unique")]
1440pub(crate) struct FunctionNamesDuplicated {
1441    #[primary_span]
1442    pub spans: Vec<Span>,
1443}
1444
1445#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownFormatParameterForOnUnimplementedAttr where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnknownFormatParameterForOnUnimplementedAttr {
                        argument_name: __binding_0,
                        trait_name: __binding_1,
                        help: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is no parameter `{$argument_name}` on trait `{$trait_name}`")));
                        ;
                        diag.arg("argument_name", __binding_0);
                        diag.arg("trait_name", __binding_1);
                        if __binding_2 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expect either a generic argument name or {\"`{Self}`\"} as format argument")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1446#[diag("there is no parameter `{$argument_name}` on trait `{$trait_name}`")]
1447pub(crate) struct UnknownFormatParameterForOnUnimplementedAttr {
1448    pub argument_name: Symbol,
1449    pub trait_name: Ident,
1450    // `false` if we're in rustc_on_unimplemented, since its syntax is a lot more complex.
1451    #[help(r#"expect either a generic argument name or {"`{Self}`"} as format argument"#)]
1452    pub help: bool,
1453}