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