Skip to main content

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