Skip to main content

rustc_attr_parsing/
diagnostics.rs

1use std::num::IntErrorKind;
2
3use rustc_attr_ir::{AttrPath, MirDialect, MirPhase};
4use rustc_errors::codes::*;
5use rustc_errors::{
6    Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, E0264, Level, MultiSpan,
7};
8use rustc_macros::{Diagnostic, Subdiagnostic};
9use rustc_span::{Ident, Span, Symbol};
10use rustc_target::spec::TargetTuple;
11
12use crate::AttributeTemplate;
13use crate::context::Suggestion;
14
15#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RustcLegacyConstGenericsOnly {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
16#[diag("#[rustc_legacy_const_generics] functions must only have const generics")]
17pub(crate) struct RustcLegacyConstGenericsOnly {
18    #[primary_span]
19    pub attr_span: Span,
20    #[label("non-const generic parameter")]
21    pub param_span: Span,
22}
23
24#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RustcLegacyConstGenericsIndex {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
25#[diag("#[rustc_legacy_const_generics] must have one index for each generic parameter")]
26pub(crate) struct RustcLegacyConstGenericsIndex {
27    #[primary_span]
28    pub attr_span: Span,
29    #[label("generic parameters")]
30    pub generics_span: Span,
31}
32
33#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RustcLegacyConstGenericsIndexExceed {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
34#[diag("index exceeds number of arguments")]
35pub(crate) struct RustcLegacyConstGenericsIndexExceed {
36    #[primary_span]
37    #[label(
38        "there {$arg_count ->
39            [one] is
40            *[other] are
41        } only {$arg_count} {$arg_count ->
42            [one] argument
43            *[other] arguments
44        }"
45    )]
46    pub span: Span,
47    pub arg_count: usize,
48}
49
50#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidAttrAtCrateLevel {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAttrAtCrateLevel {
                        span: __binding_0,
                        pound_to_opening_bracket: __binding_1,
                        name: __binding_2,
                        item: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` attribute cannot be used at crate level")));
                        let __code_0 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("#["))
                                            })].into_iter();
                        ;
                        diag.arg("name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("perhaps you meant to use an outer attribute")),
                            __code_0, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
51#[diag("`{$name}` attribute cannot be used at crate level")]
52pub(crate) struct InvalidAttrAtCrateLevel {
53    #[primary_span]
54    pub span: Span,
55    #[suggestion(
56        "perhaps you meant to use an outer attribute",
57        code = "#[",
58        applicability = "machine-applicable",
59        style = "verbose"
60    )]
61    pub pound_to_opening_bracket: Span,
62    pub name: Symbol,
63    #[subdiagnostic]
64    pub item: Option<ItemFollowingInnerAttr>,
65}
66
67#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for ItemFollowingInnerAttr {
}
#[automatically_derived]impl ::core::clone::Clone for ItemFollowingInnerAttr {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]impl ::core::marker::Copy for ItemFollowingInnerAttr {
}Copy, const _: () =
    {
        impl rustc_errors::Subdiagnostic for ItemFollowingInnerAttr {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ItemFollowingInnerAttr { 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("the inner attribute doesn't annotate this item")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
68#[label("the inner attribute doesn't annotate this item")]
69pub(crate) struct ItemFollowingInnerAttr {
70    #[primary_span]
71    pub span: Span,
72}
73
74#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnreachableCfgSelectPredicate {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnreachableCfgSelectPredicate { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable configuration predicate")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this configuration predicate is never reached")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
75#[diag("unreachable configuration predicate")]
76pub(crate) struct UnreachableCfgSelectPredicate {
77    #[label("this configuration predicate is never reached")]
78    pub span: Span,
79}
80
81#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnsupportedAttributesInWhere {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsupportedAttributesInWhere { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("most attributes are not supported in `where` clauses")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `#[cfg]` and `#[cfg_attr]` are supported")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
82#[diag("most attributes are not supported in `where` clauses")]
83#[help("only `#[cfg]` and `#[cfg_attr]` are supported")]
84pub(crate) struct UnsupportedAttributesInWhere {
85    #[primary_span]
86    pub span: MultiSpan,
87}
88
89#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnreachableCfgSelectPredicateWildcard {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnreachableCfgSelectPredicateWildcard {
                        span: __binding_0, wildcard_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unreachable configuration predicate")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this configuration predicate is never reached")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("always matches")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
90#[diag("unreachable configuration predicate")]
91pub(crate) struct UnreachableCfgSelectPredicateWildcard {
92    #[label("this configuration predicate is never reached")]
93    pub span: Span,
94
95    #[label("always matches")]
96    pub wildcard_span: Span,
97}
98
99#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MustBeNameOfAssociatedFunction {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MustBeNameOfAssociatedFunction { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("must be a name of an associated function")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
100#[diag("must be a name of an associated function")]
101pub(crate) struct MustBeNameOfAssociatedFunction {
102    #[primary_span]
103    pub span: Span,
104}
105
106#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            FunctionNamesDuplicated {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
107#[diag("functions names are duplicated")]
108#[note("all `#[rustc_must_implement_one_of]` arguments must be unique")]
109pub(crate) struct FunctionNamesDuplicated {
110    #[primary_span]
111    pub spans: Vec<Span>,
112}
113
114#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnsafeAttrOutsideUnsafeLint {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsafeAttrOutsideUnsafeLint {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe attribute used without unsafe")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of unsafe attribute")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
115#[diag("unsafe attribute used without unsafe")]
116pub(crate) struct UnsafeAttrOutsideUnsafeLint {
117    #[label("usage of unsafe attribute")]
118    pub span: Span,
119    #[subdiagnostic]
120    pub suggestion: Option<crate::diagnostics::UnsafeAttrOutsideUnsafeSuggestion>,
121}
122
123#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RustcAllowConstFnUnstable {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
124#[diag("attribute should be applied to `const fn`")]
125pub(crate) struct RustcAllowConstFnUnstable {
126    #[primary_span]
127    pub attr_span: Span,
128    #[label("not a `const fn`")]
129    pub span: Span,
130}
131
132#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            IllFormedAttributeInput {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    IllFormedAttributeInput {
                        num_suggestions: __binding_0,
                        suggestions: __binding_1,
                        has_docs: __binding_2,
                        docs: __binding_3,
                        help: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$num_suggestions ->\n        [1] attribute must be of the form {$suggestions}\n        *[other] valid forms for the attribute are {$suggestions}\n    }")));
                        ;
                        diag.arg("num_suggestions", __binding_0);
                        diag.arg("suggestions", __binding_1);
                        diag.arg("docs", __binding_3);
                        if __binding_2 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <{$docs}>")));
                        }
                        if let Some(__binding_4) = __binding_4 {
                            diag.subdiagnostic(__binding_4);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
133#[diag(
134    "{$num_suggestions ->
135        [1] attribute must be of the form {$suggestions}
136        *[other] valid forms for the attribute are {$suggestions}
137    }"
138)]
139pub(crate) struct IllFormedAttributeInput {
140    pub num_suggestions: usize,
141    pub suggestions: DiagArgValue,
142    #[note("for more information, visit <{$docs}>")]
143    pub has_docs: bool,
144    pub docs: &'static str,
145    #[subdiagnostic]
146    help: Option<IllFormedAttributeInputHelp>,
147}
148
149impl IllFormedAttributeInput {
150    pub(crate) fn new(
151        suggestions: &[String],
152        docs: Option<&'static str>,
153        help: Option<&str>,
154    ) -> Self {
155        Self {
156            num_suggestions: suggestions.len(),
157            suggestions: DiagArgValue::StrListSepByAnd(
158                suggestions.iter().map(|s| ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("`{0}`", s))
    })format!("`{s}`").into()).collect(),
159            ),
160            has_docs: docs.is_some(),
161            docs: docs.unwrap_or(""),
162            help: help.map(|h| IllFormedAttributeInputHelp { lint: h.to_string() }),
163        }
164    }
165}
166
167#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for IllFormedAttributeInputHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    IllFormedAttributeInputHelp { lint: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("lint".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("if you meant to silence a warning, consider using #![allow({$lint})] or #![expect({$lint})]")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
168#[help(
169    "if you meant to silence a warning, consider using #![allow({$lint})] or #![expect({$lint})]"
170)]
171struct IllFormedAttributeInputHelp {
172    pub lint: String,
173}
174
175#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptyAttributeList {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EmptyAttributeList {
                        attr_span: __binding_0,
                        attr_path: __binding_1,
                        valid_without_list: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
                        let __code_1 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$valid_without_list ->\n        [true] using `{$attr_path}` with an empty list is equivalent to not using a list at all\n        *[other] using `{$attr_path}` with an empty list has no effect\n    }")));
                        ;
                        diag.arg("attr_path", __binding_1);
                        diag.arg("valid_without_list", __binding_2);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$valid_without_list ->\n            [true] remove these parentheses\n            *[other] remove this attribute\n        }")),
                            __code_1, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
176#[diag("unused attribute")]
177#[note(
178    "{$valid_without_list ->
179        [true] using `{$attr_path}` with an empty list is equivalent to not using a list at all
180        *[other] using `{$attr_path}` with an empty list has no effect
181    }"
182)]
183pub(crate) struct EmptyAttributeList {
184    #[suggestion(
185        "{$valid_without_list ->
186            [true] remove these parentheses
187            *[other] remove this attribute
188        }",
189        code = "",
190        applicability = "machine-applicable"
191    )]
192    pub attr_span: Span,
193    pub attr_path: String,
194    pub valid_without_list: bool,
195}
196
197#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidAttrStyle {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAttrStyle {
                        name: __binding_0,
                        is_used_as_inner: __binding_1,
                        target_span: __binding_2,
                        target: __binding_3,
                        crate_root_path: __binding_4,
                        show_crate_root_help: __binding_5,
                        span: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$is_used_as_inner ->\n        [false] crate-level attribute should be an inner attribute: add an exclamation mark: `#![{$name}]`\n        *[other] the `#![{$name}]` attribute can only be used at the crate root\n    }")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.arg("is_used_as_inner", __binding_1);
                        diag.arg("target", __binding_3);
                        diag.arg("crate_root_path", __binding_4);
                        if let Some(__binding_2) = __binding_2 {
                            diag.span_note(__binding_2,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute does not have an `!`, which means it is applied to this {$target}")));
                        }
                        if __binding_5 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate root is at `{$crate_root_path}`")));
                        }
                        diag.span(__binding_6);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
198#[diag(
199    "{$is_used_as_inner ->
200        [false] crate-level attribute should be an inner attribute: add an exclamation mark: `#![{$name}]`
201        *[other] the `#![{$name}]` attribute can only be used at the crate root
202    }"
203)]
204pub(crate) struct InvalidAttrStyle {
205    pub name: String,
206    pub is_used_as_inner: bool,
207    #[note("this attribute does not have an `!`, which means it is applied to this {$target}")]
208    pub target_span: Option<Span>,
209    pub target: &'static str,
210    pub crate_root_path: String,
211    #[help("the crate root is at `{$crate_root_path}`")]
212    pub show_crate_root_help: bool,
213    #[primary_span]
214    pub span: Span,
215}
216
217#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAliasDuplicated {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAliasDuplicated { first_definition: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("doc alias is duplicated")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
218#[diag("doc alias is duplicated")]
219pub(crate) struct DocAliasDuplicated {
220    #[label("first defined here")]
221    pub first_definition: Span,
222}
223
224#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DocAutoCfgExpectsHideOrShow {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAutoCfgExpectsHideOrShow => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
225#[diag("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")]
226pub(crate) struct DocAutoCfgExpectsHideOrShow;
227
228#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AmbiguousDeriveHelpers {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AmbiguousDeriveHelpers => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there exists a built-in attribute with the same name")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
229#[diag("there exists a built-in attribute with the same name")]
230pub(crate) struct AmbiguousDeriveHelpers;
231
232#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DocAutoCfgHideShowUnexpectedItem {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAutoCfgHideShowUnexpectedItem { attr_name: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or `values(...)`")));
                        ;
                        diag.arg("attr_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
233#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or `values(...)`")]
234pub(crate) struct DocAutoCfgHideShowUnexpectedItem {
235    pub attr_name: Symbol,
236}
237
238#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DocAutoCfgHideShowValuesMix {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAutoCfgHideShowValuesMix { value_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`any()` was used when other values were provided")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value declared here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
239#[diag("`any()` was used when other values were provided")]
240pub(crate) struct DocAutoCfgHideShowValuesMix {
241    #[label("value declared here")]
242    pub value_span: Span,
243}
244
245#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DocAutoCfgHideShowUnexpectedItemAfterValues {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAutoCfgHideShowUnexpectedItemAfterValues => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected item after `values()`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
246#[diag("unexpected item after `values()`")]
247pub(crate) struct DocAutoCfgHideShowUnexpectedItemAfterValues;
248
249#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DocAutoCfgHideShowExpectsList {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAutoCfgHideShowExpectsList { attr_name: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")));
                        ;
                        diag.arg("attr_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
250#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")]
251pub(crate) struct DocAutoCfgHideShowExpectsList {
252    pub attr_name: Symbol,
253}
254
255#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownInclude {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocUnknownInclude {
                        inner: __binding_0, value: __binding_1, sugg: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `include`")));
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("#{0}[doc = include_str!(\"{1}\")]",
                                                        __binding_0, __binding_1))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_2.0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `doc = include_str!` instead")),
                            __code_2, __binding_2.1,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
256#[diag("unknown `doc` attribute `include`")]
257pub(crate) struct DocUnknownInclude {
258    pub inner: &'static str,
259    pub value: Symbol,
260    #[suggestion(
261        "use `doc = include_str!` instead",
262        code = "#{inner}[doc = include_str!(\"{value}\")]"
263    )]
264    pub sugg: (Span, Applicability),
265}
266
267#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownSpotlight
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocUnknownSpotlight { sugg_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `spotlight`")));
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("notable_trait"))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc(spotlight)` was renamed to `doc(notable_trait)`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc(spotlight)` is now a no-op")));
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `notable_trait` instead")),
                            __code_3, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
268#[diag("unknown `doc` attribute `spotlight`")]
269#[note("`doc(spotlight)` was renamed to `doc(notable_trait)`")]
270#[note("`doc(spotlight)` is now a no-op")]
271pub(crate) struct DocUnknownSpotlight {
272    #[suggestion(
273        "use `notable_trait` instead",
274        style = "short",
275        applicability = "machine-applicable",
276        code = "notable_trait"
277    )]
278    pub sugg_span: Span,
279}
280
281#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownPasses {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocUnknownPasses { name: __binding_0, note_span: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `{$name}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc` attribute `{$name}` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc({$name})` is now a no-op")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no longer functions")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
282#[diag("unknown `doc` attribute `{$name}`")]
283#[note(
284    "`doc` attribute `{$name}` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>"
285)]
286#[note("`doc({$name})` is now a no-op")]
287pub(crate) struct DocUnknownPasses {
288    pub name: Symbol,
289    #[label("no longer functions")]
290    pub note_span: Span,
291}
292
293#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownPlugins {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocUnknownPlugins { label_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `plugins`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc` attribute `plugins` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136> and CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`doc(plugins)` is now a no-op")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no longer functions")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
294#[diag("unknown `doc` attribute `plugins`")]
295#[note(
296    "`doc` attribute `plugins` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136> and CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>"
297)]
298#[note("`doc(plugins)` is now a no-op")]
299pub(crate) struct DocUnknownPlugins {
300    #[label("no longer functions")]
301    pub label_span: Span,
302}
303
304#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocUnknownAny {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocUnknownAny { name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc` attribute `{$name}`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
305#[diag("unknown `doc` attribute `{$name}`")]
306pub(crate) struct DocUnknownAny {
307    pub name: Symbol,
308}
309
310#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DocAutoCfgWrongLiteral {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAutoCfgWrongLiteral => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected boolean for `#[doc(auto_cfg = ...)]`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
311#[diag("expected boolean for `#[doc(auto_cfg = ...)]`")]
312pub(crate) struct DocAutoCfgWrongLiteral;
313
314#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DocAutoCfgHideShowNoIdentBeforeValues {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAutoCfgHideShowNoIdentBeforeValues => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there must be at least one identifier before `values(...)`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
315#[diag("there must be at least one identifier before `values(...)`")]
316pub(crate) struct DocAutoCfgHideShowNoIdentBeforeValues;
317
318#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocTestTakesList {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocTestTakesList => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(test(...)]` takes a list of attributes")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
319#[diag("`#[doc(test(...)]` takes a list of attributes")]
320pub(crate) struct DocTestTakesList;
321
322#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocTestUnknown {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocTestUnknown { name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown `doc(test)` attribute `{$name}`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
323#[diag("unknown `doc(test)` attribute `{$name}`")]
324pub(crate) struct DocTestUnknown {
325    pub name: Symbol,
326}
327
328#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocTestLiteral {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocTestLiteral => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc(test(...)]` does not take a literal")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
329#[diag("`#![doc(test(...)]` does not take a literal")]
330pub(crate) struct DocTestLiteral;
331
332#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocInlineConflict {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
333#[diag("conflicting doc inlining attributes")]
334#[help("remove one of the conflicting attributes")]
335pub(crate) struct DocInlineConflict {
336    #[primary_span]
337    pub spans: MultiSpan,
338}
339
340#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocInlineOnlyUse {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
341#[diag("this attribute can only be applied to a `use` item")]
342#[note(
343    "read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information"
344)]
345pub(crate) struct DocInlineOnlyUse {
346    #[label("only applicable on `use` items")]
347    pub attr_span: Span,
348    #[label("not a `use` item")]
349    pub item_span: Span,
350}
351
352#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AttrCrateLevelOnly {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AttrCrateLevelOnly => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this attribute can only be applied at the crate level")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
353#[diag("this attribute can only be applied at the crate level")]
354#[note(
355    "read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information"
356)]
357pub(crate) struct AttrCrateLevelOnly;
358
359#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DoNotRecommendDoesNotExpectArgs {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DoNotRecommendDoesNotExpectArgs => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[diagnostic::do_not_recommend]` does not expect any arguments")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
360#[diag("`#[diagnostic::do_not_recommend]` does not expect any arguments")]
361pub(crate) struct DoNotRecommendDoesNotExpectArgs;
362
363#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            OpaqueDoesNotExpectArgs {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    OpaqueDoesNotExpectArgs => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[diagnostic::opaque]` does not expect any arguments")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
364#[diag("`#[diagnostic::opaque]` does not expect any arguments")]
365pub(crate) struct OpaqueDoesNotExpectArgs;
366
367#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnknownCrateTypes {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnknownCrateTypes { sugg: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid `crate_type` value")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
368#[diag("invalid `crate_type` value")]
369pub(crate) struct UnknownCrateTypes {
370    #[subdiagnostic]
371    pub sugg: Option<UnknownCrateTypesSuggestion>,
372}
373
374#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnknownCrateTypesSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnknownCrateTypesSuggestion {
                        span: __binding_0, snippet: __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();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did you mean")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_4, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
375#[suggestion("did you mean", code = r#""{snippet}""#, applicability = "maybe-incorrect")]
376pub(crate) struct UnknownCrateTypesSuggestion {
377    #[primary_span]
378    pub span: Span,
379    pub snippet: Symbol,
380}
381
382#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MalformedDoc {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MalformedDoc => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `doc` attribute input")));
                        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)]
383#[diag("malformed `doc` attribute input")]
384#[warning(
385    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
386)]
387pub(crate) struct MalformedDoc;
388
389#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectedNoArgs {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExpectedNoArgs => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("didn't expect any arguments here")));
                        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)]
390#[diag("didn't expect any arguments here")]
391#[warning(
392    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
393)]
394pub(crate) struct ExpectedNoArgs;
395
396#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectedNameValue {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExpectedNameValue => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected this to be of the form `... = \"...\"`")));
                        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)]
397#[diag("expected this to be of the form `... = \"...\"`")]
398#[warning(
399    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
400)]
401pub(crate) struct ExpectedNameValue;
402
403#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DuplicateNotableTraitColor {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DuplicateNotableTraitColor => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected either `doc(notable_trait)` or `doc(notable_trait(color=\"...\"))`")));
                        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.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only one color should be specified")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
404#[diag("expected either `doc(notable_trait)` or `doc(notable_trait(color=\"...\"))`")]
405#[warning(
406    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
407)]
408#[help("only one color should be specified")]
409pub(crate) struct DuplicateNotableTraitColor;
410
411#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidNotableTraitAttr {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidNotableTraitAttr => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected either `doc(notable_trait)` or `doc(notable_trait(color=\"...\"))`")));
                        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)]
412#[diag("expected either `doc(notable_trait)` or `doc(notable_trait(color=\"...\"))`")]
413#[warning(
414    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
415)]
416pub(crate) struct InvalidNotableTraitAttr;
417
418#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidNotableTraitColor {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidNotableTraitColor => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown color in `doc(notable_trait(color=\"...\"))`")));
                        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.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected grey, gray, red, green, yellow, blue, magenta, cyan, or transparent")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
419#[diag("unknown color in `doc(notable_trait(color=\"...\"))`")]
420#[warning(
421    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
422)]
423#[help("expected grey, gray, red, green, yellow, blue, magenta, cyan, or transparent")]
424pub(crate) struct InvalidNotableTraitColor;
425
426#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MalFormedDiagnosticAttributeLint {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MalFormedDiagnosticAttributeLint {
                        attribute: __binding_0,
                        options: __binding_1,
                        span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `{$attribute}` attribute")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$options}")));
                        ;
                        diag.arg("attribute", __binding_0);
                        diag.arg("options", __binding_1);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid option found here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
427#[diag("malformed `{$attribute}` attribute")]
428#[help("{$options}")]
429pub(crate) struct MalFormedDiagnosticAttributeLint {
430    pub attribute: &'static str,
431    pub options: &'static str,
432    #[label("invalid option found here")]
433    pub span: Span,
434}
435
436#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for WrappedParserError {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    WrappedParserError {
                        description: __binding_0,
                        span: __binding_1,
                        label: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$description}")));
                        ;
                        diag.arg("description", __binding_0);
                        diag.arg("label", __binding_2);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$label}")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
437#[diag("{$description}")]
438pub(crate) struct WrappedParserError {
439    pub description: String,
440    #[label("{$label}")]
441    pub span: Span,
442    pub label: String,
443}
444
445#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            IgnoredDiagnosticOption {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    IgnoredDiagnosticOption {
                        option_name: __binding_0,
                        first_span: __binding_1,
                        later_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$option_name}` is ignored due to previous definition of `{$option_name}`")));
                        ;
                        diag.arg("option_name", __binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$option_name}` is first declared here")));
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$option_name}` is later redundantly declared here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
446#[diag("`{$option_name}` is ignored due to previous definition of `{$option_name}`")]
447pub(crate) struct IgnoredDiagnosticOption {
448    pub option_name: Symbol,
449    #[label("`{$option_name}` is first declared here")]
450    pub first_span: Span,
451    #[label("`{$option_name}` is later redundantly declared here")]
452    pub later_span: Span,
453}
454
455#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MissingOptionsForDiagnosticAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingOptionsForDiagnosticAttribute {
                        attribute: __binding_0, options: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing options for `{$attribute}` attribute")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$options}")));
                        ;
                        diag.arg("attribute", __binding_0);
                        diag.arg("options", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
456#[diag("missing options for `{$attribute}` attribute")]
457#[help("{$options}")]
458pub(crate) struct MissingOptionsForDiagnosticAttribute {
459    pub attribute: &'static str,
460    pub options: &'static str,
461}
462
463#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NonMetaItemDiagnosticAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NonMetaItemDiagnosticAttribute => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a literal or missing delimiter")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only literals are allowed as values for the `message`, `note` and `label` options. These options must be separated by a comma")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
464#[diag("expected a literal or missing delimiter")]
465#[help(
466    "only literals are allowed as values for the `message`, `note` and `label` options. These options must be separated by a comma"
467)]
468pub(crate) struct NonMetaItemDiagnosticAttribute;
469
470#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for FormatWarning {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    FormatWarning::PositionalArgument { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("positional arguments are not permitted in diagnostic attributes")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you can print empty braces by escaping them")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this format argument")));
                        diag
                    }
                    FormatWarning::IndexedArgument { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("indexed format arguments are not permitted in diagnostic attributes")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this format argument")));
                        diag
                    }
                    FormatWarning::InvalidSpecifier { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("format specifiers are not permitted in diagnostic attributes")));
                        ;
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this format specifier")));
                        diag
                    }
                    FormatWarning::DisallowedPlaceholder {
                        span: __binding_0, attr: __binding_1, allowed: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this format argument is not allowed in `#[{$attr}]`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$allowed}")));
                        ;
                        diag.arg("attr", __binding_1);
                        diag.arg("allowed", __binding_2);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this format argument")));
                        diag
                    }
                }
            }
        }
    };Diagnostic, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for FormatWarning {
}
#[automatically_derived]impl ::core::clone::Clone for FormatWarning {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<&'static str>;
        let _: ::core::clone::AssertParamIsClone<&'static str>;
        *self
    }
}Clone, #[automatically_derived]impl ::core::marker::Copy for FormatWarning { }Copy)]
471pub(crate) enum FormatWarning {
472    #[diag("positional arguments are not permitted in diagnostic attributes")]
473    #[help("you can print empty braces by escaping them")]
474    PositionalArgument {
475        #[label("remove this format argument")]
476        span: Span,
477    },
478
479    #[diag("indexed format arguments are not permitted in diagnostic attributes")]
480    IndexedArgument {
481        #[label("remove this format argument")]
482        span: Span,
483    },
484
485    #[diag("format specifiers are not permitted in diagnostic attributes")]
486    InvalidSpecifier {
487        #[label("remove this format specifier")]
488        span: Span,
489    },
490
491    #[diag("this format argument is not allowed in `#[{$attr}]`")]
492    #[note("{$allowed}")]
493    DisallowedPlaceholder {
494        #[label("remove this format argument")]
495        span: Span,
496        attr: &'static str,
497        allowed: &'static str,
498    },
499}
500
501#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgCargoHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnexpectedCfgCargoHelp::LintCfg {
                        cargo_toml_lint_cfg: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("cargo_toml_lint_cfg".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 using a Cargo feature instead")),
                                &sub_args);
                        diag.help(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}")),
                                &sub_args);
                        diag.help(__message);
                    }
                    UnexpectedCfgCargoHelp::LintCfgAndBuildRs {
                        cargo_toml_lint_cfg: __binding_0,
                        build_rs_println: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("cargo_toml_lint_cfg".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("build_rs_println".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider using a Cargo feature instead")),
                                &sub_args);
                        diag.help(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}")),
                                &sub_args);
                        diag.help(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or consider adding `{$build_rs_println}` to the top of the `build.rs`")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
502pub(crate) enum UnexpectedCfgCargoHelp {
503    #[help("consider using a Cargo feature instead")]
504    #[help(
505        "or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}"
506    )]
507    LintCfg { cargo_toml_lint_cfg: String },
508    #[help("consider using a Cargo feature instead")]
509    #[help(
510        "or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}"
511    )]
512    #[help("or consider adding `{$build_rs_println}` to the top of the `build.rs`")]
513    LintCfgAndBuildRs { cargo_toml_lint_cfg: String, build_rs_println: String },
514}
515
516impl UnexpectedCfgCargoHelp {
517    fn cargo_toml_lint_cfg(unescaped: &str) -> String {
518        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = [\'{0}\'] }}",
                unescaped))
    })format!(
519            "\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = ['{unescaped}'] }}"
520        )
521    }
522
523    pub(crate) fn lint_cfg(unescaped: &str) -> Self {
524        UnexpectedCfgCargoHelp::LintCfg {
525            cargo_toml_lint_cfg: Self::cargo_toml_lint_cfg(unescaped),
526        }
527    }
528
529    pub(crate) fn lint_cfg_and_build_rs(unescaped: &str, escaped: &str) -> Self {
530        UnexpectedCfgCargoHelp::LintCfgAndBuildRs {
531            cargo_toml_lint_cfg: Self::cargo_toml_lint_cfg(unescaped),
532            build_rs_println: ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("println!(\"cargo::rustc-check-cfg={0}\");",
                escaped))
    })format!("println!(\"cargo::rustc-check-cfg={escaped}\");"),
533        }
534    }
535}
536
537#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgRustcHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnexpectedCfgRustcHelp { cmdline_arg: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("cmdline_arg".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("to expect this configuration use `{$cmdline_arg}`")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
538#[help("to expect this configuration use `{$cmdline_arg}`")]
539pub(crate) struct UnexpectedCfgRustcHelp {
540    pub cmdline_arg: String,
541}
542
543impl UnexpectedCfgRustcHelp {
544    pub(crate) fn new(unescaped: &str) -> Self {
545        Self { cmdline_arg: ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("--check-cfg={0}", unescaped))
    })format!("--check-cfg={unescaped}") }
546    }
547}
548
549#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgRustcMacroHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnexpectedCfgRustcMacroHelp {
                        macro_kind: __binding_0, macro_name: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("macro_kind".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("macro_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("using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate")),
                                &sub_args);
                        diag.note(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
550#[note(
551    "using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate"
552)]
553#[help("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")]
554pub(crate) struct UnexpectedCfgRustcMacroHelp {
555    pub macro_kind: &'static str,
556    pub macro_name: Symbol,
557}
558
559#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgCargoMacroHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnexpectedCfgCargoMacroHelp {
                        macro_kind: __binding_0, macro_name: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("macro_kind".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("macro_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("using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate")),
                                &sub_args);
                        diag.note(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
560#[note(
561    "using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate"
562)]
563#[help("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")]
564pub(crate) struct UnexpectedCfgCargoMacroHelp {
565    pub macro_kind: &'static str,
566    pub macro_name: Symbol,
567}
568
569#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnexpectedCfgName {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnexpectedCfgName {
                        code_sugg: __binding_0,
                        invocation_help: __binding_1,
                        name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected `cfg` condition name: `{$name}`")));
                        ;
                        diag.arg("name", __binding_2);
                        diag.subdiagnostic(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
570#[diag("unexpected `cfg` condition name: `{$name}`")]
571pub(crate) struct UnexpectedCfgName {
572    #[subdiagnostic]
573    pub code_sugg: unexpected_cfg_name::CodeSuggestion,
574    #[subdiagnostic]
575    pub invocation_help: unexpected_cfg_name::InvocationHelp,
576
577    pub name: Symbol,
578}
579
580pub(crate) mod unexpected_cfg_name {
581    use rustc_errors::DiagSymbolList;
582    use rustc_macros::Subdiagnostic;
583    use rustc_span::{Ident, Span, Symbol};
584
585    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CodeSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    CodeSuggestion::DefineFeatures => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider defining some features in `Cargo.toml`")),
                                &sub_args);
                        diag.help(__message);
                    }
                    CodeSuggestion::VersionSyntax {
                        between_name_and_value: __binding_0,
                        after_value: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_5 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_6 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_5));
                        suggestions.push((__binding_1, __code_6));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a similar config predicate: `version(\"..\")`")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    CodeSuggestion::SimilarNameAndValue {
                        span: __binding_0, code: __binding_1 } => {
                        let __code_7 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name and value")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_7, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    CodeSuggestion::SimilarNameNoValue {
                        span: __binding_0, code: __binding_1 } => {
                        let __code_8 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name and no value")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_8, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    CodeSuggestion::SimilarNameDifferentValues {
                        span: __binding_0, code: __binding_1, expected: __binding_2
                        } => {
                        let __code_9 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        if let Some(__binding_2) = __binding_2 {
                            __binding_2.add_to_diag(diag);
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name and different values")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_9, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    CodeSuggestion::SimilarName {
                        span: __binding_0, code: __binding_1, expected: __binding_2
                        } => {
                        let __code_10 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        if let Some(__binding_2) = __binding_2 {
                            __binding_2.add_to_diag(diag);
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a config with a similar name")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_10, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    CodeSuggestion::SimilarValues {
                        with_similar_values: __binding_0,
                        expected_names: __binding_1 } => {
                        for __binding_0 in __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                    }
                    CodeSuggestion::BooleanLiteral {
                        span: __binding_0, literal: __binding_1 } => {
                        let __code_11 =
                            [::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("literal".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("you may have meant to use `{$literal}` (notice the capitalization). Doing so makes this predicate evaluate to `{$literal}` unconditionally")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_11, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
586    pub(crate) enum CodeSuggestion {
587        #[help("consider defining some features in `Cargo.toml`")]
588        DefineFeatures,
589        #[multipart_suggestion(
590            "there is a similar config predicate: `version(\"..\")`",
591            applicability = "machine-applicable"
592        )]
593        VersionSyntax {
594            #[suggestion_part(code = "(")]
595            between_name_and_value: Span,
596            #[suggestion_part(code = ")")]
597            after_value: Span,
598        },
599        #[suggestion(
600            "there is a config with a similar name and value",
601            applicability = "maybe-incorrect",
602            code = "{code}"
603        )]
604        SimilarNameAndValue {
605            #[primary_span]
606            span: Span,
607            code: String,
608        },
609        #[suggestion(
610            "there is a config with a similar name and no value",
611            applicability = "maybe-incorrect",
612            code = "{code}"
613        )]
614        SimilarNameNoValue {
615            #[primary_span]
616            span: Span,
617            code: String,
618        },
619        #[suggestion(
620            "there is a config with a similar name and different values",
621            applicability = "maybe-incorrect",
622            code = "{code}"
623        )]
624        SimilarNameDifferentValues {
625            #[primary_span]
626            span: Span,
627            code: String,
628            #[subdiagnostic]
629            expected: Option<ExpectedValues>,
630        },
631        #[suggestion(
632            "there is a config with a similar name",
633            applicability = "maybe-incorrect",
634            code = "{code}"
635        )]
636        SimilarName {
637            #[primary_span]
638            span: Span,
639            code: String,
640            #[subdiagnostic]
641            expected: Option<ExpectedValues>,
642        },
643        SimilarValues {
644            #[subdiagnostic]
645            with_similar_values: Vec<FoundWithSimilarValue>,
646            #[subdiagnostic]
647            expected_names: Option<ExpectedNames>,
648        },
649        #[suggestion(
650            "you may have meant to use `{$literal}` (notice the capitalization). Doing so makes this predicate evaluate to `{$literal}` unconditionally",
651            applicability = "machine-applicable",
652            style = "verbose",
653            code = "{literal}"
654        )]
655        BooleanLiteral {
656            #[primary_span]
657            span: Span,
658            literal: bool,
659        },
660    }
661
662    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectedValues {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ExpectedValues {
                        best_match: __binding_0, possibilities: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("best_match".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("possibilities".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("expected values for `{$best_match}` are: {$possibilities}")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
663    #[help("expected values for `{$best_match}` are: {$possibilities}")]
664    pub(crate) struct ExpectedValues {
665        pub best_match: Symbol,
666        pub possibilities: DiagSymbolList,
667    }
668
669    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for FoundWithSimilarValue {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    FoundWithSimilarValue { span: __binding_0, code: __binding_1
                        } => {
                        let __code_12 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found config with similar value")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_12, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
670    #[suggestion(
671        "found config with similar value",
672        applicability = "maybe-incorrect",
673        code = "{code}"
674    )]
675    pub(crate) struct FoundWithSimilarValue {
676        #[primary_span]
677        pub span: Span,
678        pub code: String,
679    }
680
681    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectedNames {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ExpectedNames {
                        possibilities: __binding_0, and_more: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("possibilities".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("and_more".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("expected names are: {$possibilities}{$and_more ->\n            [0] {\"\"}\n            *[other] {\" \"}and {$and_more} more\n        }")),
                                &sub_args);
                        diag.help_once(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
682    #[help_once(
683        "expected names are: {$possibilities}{$and_more ->
684            [0] {\"\"}
685            *[other] {\" \"}and {$and_more} more
686        }"
687    )]
688    pub(crate) struct ExpectedNames {
689        pub possibilities: DiagSymbolList<Ident>,
690        pub and_more: usize,
691    }
692
693    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvocationHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvocationHelp::Cargo {
                        macro_help: __binding_0, help: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration")),
                                &sub_args);
                        diag.note(__message);
                    }
                    InvocationHelp::Rustc {
                        macro_help: __binding_0, help: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        __binding_1.add_to_diag(diag);
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
694    pub(crate) enum InvocationHelp {
695        #[note(
696            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration"
697        )]
698        Cargo {
699            #[subdiagnostic]
700            macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
701            #[subdiagnostic]
702            help: Option<super::UnexpectedCfgCargoHelp>,
703        },
704        #[note(
705            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration"
706        )]
707        Rustc {
708            #[subdiagnostic]
709            macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
710            #[subdiagnostic]
711            help: super::UnexpectedCfgRustcHelp,
712        },
713    }
714}
715
716#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnexpectedCfgValue {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnexpectedCfgValue {
                        code_sugg: __binding_0,
                        invocation_help: __binding_1,
                        has_value: __binding_2,
                        value: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected `cfg` condition value: {$has_value ->\n        [true] `{$value}`\n        *[false] (none)\n    }")));
                        ;
                        diag.arg("has_value", __binding_2);
                        diag.arg("value", __binding_3);
                        diag.subdiagnostic(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
717#[diag(
718    "unexpected `cfg` condition value: {$has_value ->
719        [true] `{$value}`
720        *[false] (none)
721    }"
722)]
723pub(crate) struct UnexpectedCfgValue {
724    #[subdiagnostic]
725    pub code_sugg: unexpected_cfg_value::CodeSuggestion,
726    #[subdiagnostic]
727    pub invocation_help: unexpected_cfg_value::InvocationHelp,
728
729    pub has_value: bool,
730    pub value: String,
731}
732
733pub(crate) mod unexpected_cfg_value {
734    use rustc_errors::DiagSymbolList;
735    use rustc_macros::Subdiagnostic;
736    use rustc_span::{Span, Symbol};
737
738    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CodeSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    CodeSuggestion::ChangeValue {
                        expected_values: __binding_0, suggestion: __binding_1 } => {
                        __binding_0.add_to_diag(diag);
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                    }
                    CodeSuggestion::RemoveValue {
                        suggestion: __binding_0, name: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no expected value for `{$name}`")),
                                &sub_args);
                        diag.note(__message);
                    }
                    CodeSuggestion::RemoveCondition {
                        suggestion: __binding_0, name: __binding_1 } => {
                        __binding_0.add_to_diag(diag);
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no expected values for `{$name}`")),
                                &sub_args);
                        diag.note(__message);
                    }
                    CodeSuggestion::ChangeName { suggestions: __binding_0 } => {
                        for __binding_0 in __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                    }
                }
            }
        }
    };Subdiagnostic)]
739    pub(crate) enum CodeSuggestion {
740        ChangeValue {
741            #[subdiagnostic]
742            expected_values: ExpectedValues,
743            #[subdiagnostic]
744            suggestion: Option<ChangeValueSuggestion>,
745        },
746        #[note("no expected value for `{$name}`")]
747        RemoveValue {
748            #[subdiagnostic]
749            suggestion: Option<RemoveValueSuggestion>,
750
751            name: Symbol,
752        },
753        #[note("no expected values for `{$name}`")]
754        RemoveCondition {
755            #[subdiagnostic]
756            suggestion: RemoveConditionSuggestion,
757
758            name: Symbol,
759        },
760        ChangeName {
761            #[subdiagnostic]
762            suggestions: Vec<ChangeNameSuggestion>,
763        },
764    }
765
766    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ChangeValueSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ChangeValueSuggestion::SimilarName {
                        span: __binding_0, best_match: __binding_1 } => {
                        let __code_13 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("\"{0}\"", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("there is a expected value with a similar name")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_13, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    ChangeValueSuggestion::SpecifyValue {
                        span: __binding_0, first_possibility: __binding_1 } => {
                        let __code_14 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(" = \"{0}\"",
                                                        __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("specify a config value")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_14, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
767    pub(crate) enum ChangeValueSuggestion {
768        #[suggestion(
769            "there is a expected value with a similar name",
770            code = r#""{best_match}""#,
771            applicability = "maybe-incorrect"
772        )]
773        SimilarName {
774            #[primary_span]
775            span: Span,
776            best_match: Symbol,
777        },
778        #[suggestion(
779            "specify a config value",
780            code = r#" = "{first_possibility}""#,
781            applicability = "maybe-incorrect"
782        )]
783        SpecifyValue {
784            #[primary_span]
785            span: Span,
786            first_possibility: Symbol,
787        },
788    }
789
790    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RemoveValueSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    RemoveValueSuggestion { span: __binding_0 } => {
                        let __code_15 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the value")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_15, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
791    #[suggestion("remove the value", code = "", applicability = "maybe-incorrect")]
792    pub(crate) struct RemoveValueSuggestion {
793        #[primary_span]
794        pub span: Span,
795    }
796
797    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RemoveConditionSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    RemoveConditionSuggestion { span: __binding_0 } => {
                        let __code_16 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the condition")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_16, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
798    #[suggestion("remove the condition", code = "", applicability = "maybe-incorrect")]
799    pub(crate) struct RemoveConditionSuggestion {
800        #[primary_span]
801        pub span: Span,
802    }
803
804    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectedValues {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ExpectedValues {
                        name: __binding_0,
                        have_none_possibility: __binding_1,
                        possibilities: __binding_2,
                        and_more: __binding_3 } => {
                        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("have_none_possibility".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("possibilities".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_2,
                                &mut diag.long_ty_path));
                        sub_args.insert("and_more".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_3,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected values for `{$name}` are: {$have_none_possibility ->\n            [true] {\"(none), \"}\n            *[false] {\"\"}\n        }{$possibilities}{$and_more ->\n            [0] {\"\"}\n            *[other] {\" \"}and {$and_more} more\n        }")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
805    #[note(
806        "expected values for `{$name}` are: {$have_none_possibility ->
807            [true] {\"(none), \"}
808            *[false] {\"\"}
809        }{$possibilities}{$and_more ->
810            [0] {\"\"}
811            *[other] {\" \"}and {$and_more} more
812        }"
813    )]
814    pub(crate) struct ExpectedValues {
815        pub name: Symbol,
816        pub have_none_possibility: bool,
817        pub possibilities: DiagSymbolList,
818        pub and_more: usize,
819    }
820
821    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ChangeNameSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    ChangeNameSuggestion {
                        span: __binding_0, name: __binding_1, value: __binding_2 }
                        => {
                        let __code_17 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        sub_args.insert("value".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("`{$value}` is an expected value for `{$name}`")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_17, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
822    #[suggestion(
823        "`{$value}` is an expected value for `{$name}`",
824        code = "{name}",
825        applicability = "maybe-incorrect",
826        style = "verbose"
827    )]
828    pub(crate) struct ChangeNameSuggestion {
829        #[primary_span]
830        pub span: Span,
831        pub name: Symbol,
832        pub value: Symbol,
833    }
834
835    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvocationHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvocationHelp::Cargo {
                        help: __binding_0, macro_help: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration")),
                                &sub_args);
                        diag.note(__message);
                    }
                    InvocationHelp::Rustc {
                        help: __binding_0, macro_help: __binding_1 } => {
                        if let Some(__binding_0) = __binding_0 {
                            __binding_0.add_to_diag(diag);
                        }
                        if let Some(__binding_1) = __binding_1 {
                            __binding_1.add_to_diag(diag);
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
836    pub(crate) enum InvocationHelp {
837        #[note(
838            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration"
839        )]
840        Cargo {
841            #[subdiagnostic]
842            help: Option<CargoHelp>,
843            #[subdiagnostic]
844            macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
845        },
846        #[note(
847            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration"
848        )]
849        Rustc {
850            #[subdiagnostic]
851            help: Option<super::UnexpectedCfgRustcHelp>,
852            #[subdiagnostic]
853            macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
854        },
855    }
856
857    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CargoHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    CargoHelp::AddFeature { value: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("value".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 adding `{$value}` as a feature in `Cargo.toml`")),
                                &sub_args);
                        diag.help(__message);
                    }
                    CargoHelp::DefineFeatures => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider defining some features in `Cargo.toml`")),
                                &sub_args);
                        diag.help(__message);
                    }
                    CargoHelp::Other(__binding_0) => {
                        __binding_0.add_to_diag(diag);
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                    }
                }
            }
        }
    };Subdiagnostic)]
858    pub(crate) enum CargoHelp {
859        #[help("consider adding `{$value}` as a feature in `Cargo.toml`")]
860        AddFeature {
861            value: Symbol,
862        },
863        #[help("consider defining some features in `Cargo.toml`")]
864        DefineFeatures,
865        Other(#[subdiagnostic] super::UnexpectedCfgCargoHelp),
866    }
867}
868
869#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidOnClause {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidOnClause::Empty { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty `on`-clause in `#[rustc_on_unimplemented]`")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty `on`-clause here")));
                        diag
                    }
                    InvalidOnClause::ExpectedOnePredInNot { span: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a single predicate in `not(..)`")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected quantity of predicates here")));
                        diag
                    }
                    InvalidOnClause::UnsupportedLiteral { span: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("literals inside `on`-clauses are not supported")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected literal here")));
                        diag
                    }
                    InvalidOnClause::ExpectedIdentifier {
                        span: __binding_0, path: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected an identifier inside this `on`-clause")));
                        ;
                        diag.arg("path", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected an identifier here, not `{$path}`")));
                        diag
                    }
                    InvalidOnClause::InvalidPredicate {
                        span: __binding_0, invalid_pred: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this predicate is invalid")));
                        ;
                        diag.arg("invalid_pred", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected one of `any`, `all` or `not` here, not `{$invalid_pred}`")));
                        diag
                    }
                    InvalidOnClause::InvalidFlag {
                        span: __binding_0, invalid_flag: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid flag in `on`-clause")));
                        ;
                        diag.arg("invalid_flag", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `{$invalid_flag}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
870pub(crate) enum InvalidOnClause {
871    #[diag("empty `on`-clause in `#[rustc_on_unimplemented]`")]
872    Empty {
873        #[primary_span]
874        #[label("empty `on`-clause here")]
875        span: Span,
876    },
877    #[diag("expected a single predicate in `not(..)`")]
878    ExpectedOnePredInNot {
879        #[primary_span]
880        #[label("unexpected quantity of predicates here")]
881        span: Span,
882    },
883    #[diag("literals inside `on`-clauses are not supported")]
884    UnsupportedLiteral {
885        #[primary_span]
886        #[label("unexpected literal here")]
887        span: Span,
888    },
889    #[diag("expected an identifier inside this `on`-clause")]
890    ExpectedIdentifier {
891        #[primary_span]
892        #[label("expected an identifier here, not `{$path}`")]
893        span: Span,
894        path: AttrPath,
895    },
896    #[diag("this predicate is invalid")]
897    InvalidPredicate {
898        #[primary_span]
899        #[label("expected one of `any`, `all` or `not` here, not `{$invalid_pred}`")]
900        span: Span,
901        invalid_pred: Symbol,
902    },
903    #[diag("invalid flag in `on`-clause")]
904    InvalidFlag {
905        #[primary_span]
906        #[label(
907            "expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `{$invalid_flag}`"
908        )]
909        span: Span,
910        invalid_flag: Symbol,
911    },
912}
913
914#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnsafeAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsafeAttribute { attr_path: __binding_0, note: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of the unsafe `{$attr_path}` attribute")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$note}")));
                        ;
                        diag.arg("attr_path", __binding_0);
                        diag.arg("note", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
915#[diag("usage of the unsafe `{$attr_path}` attribute")]
916#[note("{$note}")]
917pub(crate) struct UnsafeAttribute {
918    pub attr_path: AttrPath,
919    pub note: &'static str,
920}
921
922#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnknownExternLangItem {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
923#[diag("unknown external lang item: `{$lang_item}`", code = E0264)]
924pub(crate) struct UnknownExternLangItem {
925    #[primary_span]
926    pub span: Span,
927    pub lang_item: Symbol,
928}
929
930#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DuplicateTool {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DuplicateTool {
                        span: __binding_0,
                        tool: __binding_1,
                        old_ident_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate tool `{$tool}` registered")));
                        ;
                        diag.arg("tool", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("already registered here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
931#[diag("duplicate tool `{$tool}` registered")]
932pub(crate) struct DuplicateTool {
933    #[primary_span]
934    pub(crate) span: Span,
935    pub(crate) tool: Ident,
936    #[label("already registered here")]
937    pub(crate) old_ident_span: Span,
938}
939
940#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ToolReserved {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ToolReserved { span: __binding_0, tool: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("tool `{$tool}` is reserved and cannot be registered")));
                        ;
                        diag.arg("tool", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
941#[diag("tool `{$tool}` is reserved and cannot be registered")]
942pub(crate) struct ToolReserved {
943    #[primary_span]
944    pub(crate) span: Span,
945    pub(crate) tool: Ident,
946}
947
948#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnknownDiagnosticAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnknownDiagnosticAttribute { typo: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown diagnostic attribute")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
949#[diag("unknown diagnostic attribute")]
950pub(crate) struct UnknownDiagnosticAttribute {
951    #[subdiagnostic]
952    pub typo: Option<UnknownDiagnosticAttributeTypo>,
953}
954
955#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnknownDiagnosticAttributeTypo {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnknownDiagnosticAttributeTypo {
                        span: __binding_0, typo_name: __binding_1 } => {
                        let __code_18 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an attribute with a similar name exists")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_18, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                }
            }
        }
    };Subdiagnostic)]
956#[suggestion(
957    "an attribute with a similar name exists",
958    style = "verbose",
959    code = "{typo_name}",
960    applicability = "machine-applicable"
961)]
962pub(crate) struct UnknownDiagnosticAttributeTypo {
963    #[primary_span]
964    pub span: Span,
965    pub typo_name: Symbol,
966}
967
968#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnstableDiagnosticAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnstableDiagnosticAttribute {
                        nightly_build: __binding_0, feature: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown diagnostic attribute")));
                        ;
                        diag.arg("feature", __binding_1);
                        if __binding_0 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is an experimental diagnostic attribute")));
                        }
                        if __binding_0 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature({$feature})]` to the crate attributes to enable")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
969#[diag("unknown diagnostic attribute")]
970pub(crate) struct UnstableDiagnosticAttribute {
971    #[note("this is an experimental diagnostic attribute")]
972    #[help("add `#![feature({$feature})]` to the crate attributes to enable")]
973    pub nightly_build: bool,
974    pub feature: Symbol,
975}
976
977#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InlineForceInlineConflict {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InlineForceInlineConflict {
                        force_inline_span: __binding_0, inline_span: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[rustc_force_inline]` and `#[inline]` cannot be used together")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the inline attribute is specified here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
978#[diag("`#[rustc_force_inline]` and `#[inline]` cannot be used together")]
979pub(crate) struct InlineForceInlineConflict {
980    #[primary_span]
981    pub force_inline_span: Span,
982    #[label("the inline attribute is specified here")]
983    pub inline_span: Span,
984}
985
986#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InlineIgnoredForExported {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
987#[diag("`#[inline]` is ignored on externally exported functions")]
988#[help(
989    "externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`"
990)]
991pub(crate) struct InlineIgnoredForExported;
992
993#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for BothFfiConstAndPure
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
994#[diag("`#[ffi_const]` function cannot be `#[ffi_pure]`", code = E0757)]
995pub(crate) struct BothFfiConstAndPure {
996    #[primary_span]
997    pub attr_span: Span,
998}
999
1000#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for RustcPubTransparent
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
1001#[diag("attribute should be applied to `#[repr(transparent)]` types")]
1002pub(crate) struct RustcPubTransparent {
1003    #[primary_span]
1004    pub attr_span: Span,
1005    #[label("not a `#[repr(transparent)]` type")]
1006    pub span: Span,
1007}
1008
1009#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MacroOnlyAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
1010#[diag("attribute should be applied to a macro")]
1011pub(crate) struct MacroOnlyAttribute {
1012    #[primary_span]
1013    pub attr_span: Span,
1014    #[label("not a macro")]
1015    pub span: Span,
1016}
1017
1018#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            DocAliasEmpty<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAliasEmpty { span: __binding_0, attr_str: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$attr_str} attribute cannot have empty value")));
                        ;
                        diag.arg("attr_str", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1019#[diag("{$attr_str} attribute cannot have empty value")]
1020pub(crate) struct DocAliasEmpty<'a> {
1021    #[primary_span]
1022    pub span: Span,
1023    pub attr_str: &'a str,
1024}
1025
1026#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            DocAliasBadChar<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAliasBadChar {
                        span: __binding_0, attr_str: __binding_1, char_: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$char_} character isn't allowed in {$attr_str}")));
                        ;
                        diag.arg("attr_str", __binding_1);
                        diag.arg("char_", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1027#[diag("{$char_} character isn't allowed in {$attr_str}")]
1028pub(crate) struct DocAliasBadChar<'a> {
1029    #[primary_span]
1030    pub span: Span,
1031    pub attr_str: &'a str,
1032    pub char_: char,
1033}
1034
1035#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            DocAliasStartEnd<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAliasStartEnd { span: __binding_0, attr_str: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$attr_str} cannot start or end with ' '")));
                        ;
                        diag.arg("attr_str", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1036#[diag("{$attr_str} cannot start or end with ' '")]
1037pub(crate) struct DocAliasStartEnd<'a> {
1038    #[primary_span]
1039    pub span: Span,
1040    pub attr_str: &'a str,
1041}
1042
1043#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            CguFieldsMissing<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CguFieldsMissing {
                        span: __binding_0, name: __binding_1, field: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name})]` is missing a `{$field}` argument")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("field", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1044#[diag("`#[{$name})]` is missing a `{$field}` argument")]
1045pub(crate) struct CguFieldsMissing<'a> {
1046    #[primary_span]
1047    pub span: Span,
1048    pub name: &'a AttrPath,
1049    pub field: Symbol,
1050}
1051
1052#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAttrNotCrateLevel
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAttrNotCrateLevel {
                        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} = \"...\")]` isn't allowed as a crate-level attribute")));
                        ;
                        diag.arg("attr_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1053#[diag("`#![doc({$attr_name} = \"...\")]` isn't allowed as a crate-level attribute")]
1054pub(crate) struct DocAttrNotCrateLevel {
1055    #[primary_span]
1056    pub span: Span,
1057    pub attr_name: Symbol,
1058}
1059
1060#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAttrNotParameters
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAttrNotParameters { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[doc(...)]` isn't allowed on parameters")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1061#[diag("`#[doc(...)]` isn't allowed on parameters")]
1062pub(crate) struct DocAttrNotParameters {
1063    #[primary_span]
1064    pub span: Span,
1065}
1066
1067#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocKeywordNotKeyword
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocKeywordNotKeyword {
                        span: __binding_0, keyword: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nonexistent keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only existing keywords are allowed in core/std")));
                        ;
                        diag.arg("keyword", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1068#[diag("nonexistent keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`")]
1069#[help("only existing keywords are allowed in core/std")]
1070pub(crate) struct DocKeywordNotKeyword {
1071    #[primary_span]
1072    pub span: Span,
1073    pub keyword: Symbol,
1074}
1075
1076#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DocAttributeNotAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAttributeNotAttribute {
                        span: __binding_0, attribute: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = \"...\")]`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only existing builtin attributes are allowed in core/std")));
                        ;
                        diag.arg("attribute", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1077#[diag("nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = \"...\")]`")]
1078#[help("only existing builtin attributes are allowed in core/std")]
1079pub(crate) struct DocAttributeNotAttribute {
1080    #[primary_span]
1081    pub span: Span,
1082    pub attribute: Symbol,
1083}
1084
1085#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAttrNotTraitLevel
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAttrNotTraitLevel {
                        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})]` must be a trait attribute")));
                        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.arg("attr_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1086#[diag("`#![doc({$attr_name})]` must be a trait attribute")]
1087#[warning(
1088    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1089)]
1090pub(crate) struct DocAttrNotTraitLevel {
1091    #[primary_span]
1092    pub span: Span,
1093    pub attr_name: Symbol,
1094}
1095
1096#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            TargetFeatureOnLangItem {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TargetFeatureOnLangItem {
                        attr_span: __binding_0,
                        kind: __binding_1,
                        item_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[target_feature]` cannot be applied to a {$kind ->\n        [panic_handler] `#[panic_handler]`\n        *[other] lang item\n    } function")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind ->\n            [panic_handler] `#[panic_handler]`\n            *[other] lang item\n        } function is not allowed to have `#[target_feature]`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1097#[diag(
1098    "`#[target_feature]` cannot be applied to a {$kind ->
1099        [panic_handler] `#[panic_handler]`
1100        *[other] lang item
1101    } function"
1102)]
1103pub(crate) struct TargetFeatureOnLangItem {
1104    #[primary_span]
1105    pub attr_span: Span,
1106    pub kind: Symbol,
1107    #[label(
1108        "{$kind ->
1109            [panic_handler] `#[panic_handler]`
1110            *[other] lang item
1111        } function is not allowed to have `#[target_feature]`"
1112    )]
1113    pub item_span: Span,
1114}
1115
1116#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            TrackCallerOnLangItem {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    TrackCallerOnLangItem {
                        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)]
1117#[diag(
1118    "{$name ->
1119    [panic_impl] `#[panic_handler]`
1120    *[other] `{$name}` lang item
1121} function is not allowed to have `#[track_caller]`"
1122)]
1123pub(crate) struct TrackCallerOnLangItem {
1124    #[primary_span]
1125    pub attr_span: Span,
1126    pub name: Symbol,
1127    #[label(
1128        "{$name ->
1129            [panic_impl] `#[panic_handler]`
1130            *[other] `{$name}` lang item
1131        } function is not allowed to have `#[track_caller]`"
1132    )]
1133    pub sig_span: Span,
1134}
1135
1136#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingSince {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingSince { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'since'")));
                        diag.code(E0542);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1137#[diag("missing 'since'", code = E0542)]
1138pub(crate) struct MissingSince {
1139    #[primary_span]
1140    pub span: Span,
1141}
1142
1143#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingNote {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingNote { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'note'")));
                        diag.code(E0543);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1144#[diag("missing 'note'", code = E0543)]
1145pub(crate) struct MissingNote {
1146    #[primary_span]
1147    pub span: Span,
1148}
1149
1150#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MultipleStabilityLevels {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MultipleStabilityLevels { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple stability levels")));
                        diag.code(E0544);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1151#[diag("multiple stability levels", code = E0544)]
1152pub(crate) struct MultipleStabilityLevels {
1153    #[primary_span]
1154    pub span: Span,
1155}
1156
1157#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidIssueString {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidIssueString { span: __binding_0, cause: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`issue` must be a non-zero numeric string or \"none\"")));
                        diag.code(E0545);
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1158#[diag("`issue` must be a non-zero numeric string or \"none\"", code = E0545)]
1159pub(crate) struct InvalidIssueString {
1160    #[primary_span]
1161    pub span: Span,
1162
1163    #[subdiagnostic]
1164    pub cause: Option<InvalidIssueStringCause>,
1165}
1166
1167// The error kinds of `IntErrorKind` are duplicated here in order to allow the messages to be
1168// translatable.
1169#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidIssueStringCause {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvalidIssueStringCause::MustNotBeZero { 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("`issue` must not be \"0\", use \"none\" instead")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    InvalidIssueStringCause::Empty { 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("cannot parse integer from empty string")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    InvalidIssueStringCause::InvalidDigit { 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("invalid digit found in string")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    InvalidIssueStringCause::PosOverflow { 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("number too large to fit in target type")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    InvalidIssueStringCause::NegOverflow { 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("number too small to fit in target type")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1170pub(crate) enum InvalidIssueStringCause {
1171    #[label("`issue` must not be \"0\", use \"none\" instead")]
1172    MustNotBeZero {
1173        #[primary_span]
1174        span: Span,
1175    },
1176
1177    #[label("cannot parse integer from empty string")]
1178    Empty {
1179        #[primary_span]
1180        span: Span,
1181    },
1182
1183    #[label("invalid digit found in string")]
1184    InvalidDigit {
1185        #[primary_span]
1186        span: Span,
1187    },
1188
1189    #[label("number too large to fit in target type")]
1190    PosOverflow {
1191        #[primary_span]
1192        span: Span,
1193    },
1194
1195    #[label("number too small to fit in target type")]
1196    NegOverflow {
1197        #[primary_span]
1198        span: Span,
1199    },
1200}
1201
1202impl InvalidIssueStringCause {
1203    pub(crate) fn from_int_error_kind(span: Span, kind: &IntErrorKind) -> Option<Self> {
1204        match kind {
1205            IntErrorKind::Empty => Some(Self::Empty { span }),
1206            IntErrorKind::InvalidDigit => Some(Self::InvalidDigit { span }),
1207            IntErrorKind::PosOverflow => Some(Self::PosOverflow { span }),
1208            IntErrorKind::NegOverflow => Some(Self::NegOverflow { span }),
1209            IntErrorKind::Zero => Some(Self::MustNotBeZero { span }),
1210            _ => None,
1211        }
1212    }
1213}
1214
1215#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingFeature {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingFeature { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'feature'")));
                        diag.code(E0546);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1216#[diag("missing 'feature'", code = E0546)]
1217pub(crate) struct MissingFeature {
1218    #[primary_span]
1219    pub span: Span,
1220}
1221
1222#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NonIdentFeature {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NonIdentFeature { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("'feature' is not an identifier")));
                        diag.code(E0546);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1223#[diag("'feature' is not an identifier", code = E0546)]
1224pub(crate) struct NonIdentFeature {
1225    #[primary_span]
1226    pub span: Span,
1227}
1228
1229#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MissingIssue {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MissingIssue { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'issue'")));
                        diag.code(E0547);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1230#[diag("missing 'issue'", code = E0547)]
1231pub(crate) struct MissingIssue {
1232    #[primary_span]
1233    pub span: Span,
1234}
1235
1236#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RustcPromotablePairing {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RustcPromotablePairing { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute")));
                        diag.code(E0717);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1237#[diag("`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute", code = E0717)]
1238pub(crate) struct RustcPromotablePairing {
1239    #[primary_span]
1240    pub span: Span,
1241}
1242
1243#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RustcAllowedUnstablePairing {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RustcAllowedUnstablePairing { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute")));
                        diag.code(E0789);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1244#[diag("`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute", code = E0789)]
1245pub(crate) struct RustcAllowedUnstablePairing {
1246    #[primary_span]
1247    pub span: Span,
1248}
1249
1250#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RustcAtumMissingParams {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RustcAtumMissingParams { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_allowed_through_unstable_modules` attribute must have `message` and `module` params")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1251#[diag(
1252    "`rustc_allowed_through_unstable_modules` attribute must have `message` and `module` params"
1253)]
1254pub(crate) struct RustcAtumMissingParams {
1255    #[primary_span]
1256    pub span: Span,
1257}
1258
1259#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DeprecatedItemSuggestion {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DeprecatedItemSuggestion {
                        span: __binding_0,
                        is_nightly: __binding_1,
                        details: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suggestions on deprecated items are unstable")));
                        ;
                        diag.span(__binding_0);
                        if __binding_1 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(deprecated_suggestion)]` to the crate root")));
                        }
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see #94785 for more details")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1260#[diag("suggestions on deprecated items are unstable")]
1261pub(crate) struct DeprecatedItemSuggestion {
1262    #[primary_span]
1263    pub span: Span,
1264
1265    #[help("add `#![feature(deprecated_suggestion)]` to the crate root")]
1266    pub is_nightly: bool,
1267
1268    #[note("see #94785 for more details")]
1269    pub details: (),
1270}
1271
1272#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DeprecatedAnnotationHasNoEffect {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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_19 =
                            [::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_19, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1273#[diag("this `#[deprecated]` annotation has no effect")]
1274pub(crate) struct DeprecatedAnnotationHasNoEffect {
1275    #[suggestion(
1276        "remove the unnecessary deprecation attribute",
1277        applicability = "machine-applicable",
1278        code = ""
1279    )]
1280    pub span: Span,
1281}
1282
1283#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NonExhaustiveWithDefaultFieldValues {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
1284#[diag("`#[non_exhaustive]` can't be used to annotate items with default field values")]
1285pub(crate) struct NonExhaustiveWithDefaultFieldValues {
1286    #[primary_span]
1287    pub attr_span: Span,
1288    #[label("this struct has default field values")]
1289    pub defn_span: Span,
1290}
1291
1292#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ExpectedSingleVersionLiteral {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExpectedSingleVersionLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected single version literal")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1293#[diag("expected single version literal")]
1294pub(crate) struct ExpectedSingleVersionLiteral {
1295    #[primary_span]
1296    pub span: Span,
1297}
1298
1299#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ExpectedVersionLiteral {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExpectedVersionLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a version literal")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1300#[diag("expected a version literal")]
1301pub(crate) struct ExpectedVersionLiteral {
1302    #[primary_span]
1303    pub span: Span,
1304}
1305
1306#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectsFeatureList {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExpectsFeatureList { span: __binding_0, name: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` expects a list of feature names")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1307#[diag("`{$name}` expects a list of feature names")]
1308pub(crate) struct ExpectsFeatureList {
1309    #[primary_span]
1310    pub span: Span,
1311
1312    pub name: String,
1313}
1314
1315#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectsFeatures {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExpectsFeatures { span: __binding_0, name: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` expects feature names")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1316#[diag("`{$name}` expects feature names")]
1317pub(crate) struct ExpectsFeatures {
1318    #[primary_span]
1319    pub span: Span,
1320
1321    pub name: String,
1322}
1323
1324#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidSince {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidSince { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("'since' must be a Rust version number, such as \"1.31.0\"")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1325#[diag("'since' must be a Rust version number, such as \"1.31.0\"")]
1326pub(crate) struct InvalidSince {
1327    #[primary_span]
1328    pub span: Span,
1329}
1330
1331#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnknownVersionLiteral {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnknownVersionLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown version literal format, assuming it refers to a future version")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1332#[diag("unknown version literal format, assuming it refers to a future version")]
1333pub(crate) struct UnknownVersionLiteral {
1334    #[primary_span]
1335    pub span: Span,
1336}
1337
1338// FIXME(jdonszelmann) duplicated from `rustc_passes`, remove once `check_attr` is integrated.
1339#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnusedMultiple {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedMultiple {
                        this: __binding_0, other: __binding_1, name: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `{$name}` attributes")));
                        let __code_20 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
                            __code_20, rustc_errors::Applicability::Unspecified,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1340#[diag("multiple `{$name}` attributes")]
1341pub(crate) struct UnusedMultiple {
1342    #[primary_span]
1343    #[suggestion("remove this attribute", code = "", applicability = "unspecified")]
1344    pub this: Span,
1345    #[note("attribute also specified here")]
1346    pub other: Span,
1347    pub name: Symbol,
1348}
1349
1350#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptyExportName {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EmptyExportName { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`export_name` may not be empty")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1351#[diag("`export_name` may not be empty")]
1352pub(crate) struct EmptyExportName {
1353    #[primary_span]
1354    pub span: Span,
1355}
1356
1357#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptySection {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EmptySection { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`section` may not be empty")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1358#[diag("`section` may not be empty")]
1359pub(crate) struct EmptySection {
1360    #[primary_span]
1361    pub span: Span,
1362}
1363
1364#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnExport {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NullOnExport { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`export_name` may not contain null characters")));
                        diag.code(E0648);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1365#[diag("`export_name` may not contain null characters", code = E0648)]
1366pub(crate) struct NullOnExport {
1367    #[primary_span]
1368    pub span: Span,
1369}
1370
1371#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnLinkSection {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NullOnLinkSection { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`link_section` may not contain null characters")));
                        diag.code(E0648);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1372#[diag("`link_section` may not contain null characters", code = E0648)]
1373pub(crate) struct NullOnLinkSection {
1374    #[primary_span]
1375    pub span: Span,
1376}
1377
1378#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnLinkName {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NullOnLinkName { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link name may not contain null characters")));
                        diag.code(E0648);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1379#[diag("link name may not contain null characters", code = E0648)]
1380pub(crate) struct NullOnLinkName {
1381    #[primary_span]
1382    pub span: Span,
1383}
1384
1385#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnObjcClass {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NullOnObjcClass { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::class!` may not contain null characters")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1386#[diag("`objc::class!` may not contain null characters")]
1387pub(crate) struct NullOnObjcClass {
1388    #[primary_span]
1389    pub span: Span,
1390}
1391
1392#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnObjcSelector {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NullOnObjcSelector { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::selector!` may not contain null characters")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1393#[diag("`objc::selector!` may not contain null characters")]
1394pub(crate) struct NullOnObjcSelector {
1395    #[primary_span]
1396    pub span: Span,
1397}
1398
1399#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NullOnSection {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NullOnSection { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`section` may not contain null characters")));
                        diag.code(E0648);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1400#[diag("`section` may not contain null characters", code = E0648)]
1401pub(crate) struct NullOnSection {
1402    #[primary_span]
1403    pub span: Span,
1404}
1405
1406#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ObjcClassExpectedStringLiteral {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ObjcClassExpectedStringLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::class!` expected a string literal")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1407#[diag("`objc::class!` expected a string literal")]
1408pub(crate) struct ObjcClassExpectedStringLiteral {
1409    #[primary_span]
1410    pub span: Span,
1411}
1412
1413#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ObjcSelectorExpectedStringLiteral {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ObjcSelectorExpectedStringLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::selector!` expected a string literal")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1414#[diag("`objc::selector!` expected a string literal")]
1415pub(crate) struct ObjcSelectorExpectedStringLiteral {
1416    #[primary_span]
1417    pub span: Span,
1418}
1419
1420#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptyConfusables {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EmptyConfusables { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected at least one confusable name")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1421#[diag("expected at least one confusable name")]
1422pub(crate) struct EmptyConfusables {
1423    #[primary_span]
1424    pub span: Span,
1425}
1426
1427#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidTarget {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidTarget {
                        span: __binding_0,
                        attr_span: __binding_1,
                        name: __binding_2,
                        target: __binding_3,
                        target_span: __binding_4,
                        applied: __binding_5,
                        only: __binding_6,
                        attribute_args: __binding_7,
                        help: __binding_8,
                        previously_accepted: __binding_9,
                        on_macro_call: __binding_10 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$name}{$attribute_args}` attribute cannot be used on {$target}")));
                        let __code_21 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$name}{$attribute_args}` attribute can {$only}be applied to {$applied}")));
                        ;
                        diag.arg("name", __binding_2);
                        diag.arg("target", __binding_3);
                        diag.arg("applied", __binding_5);
                        diag.arg("only", __binding_6);
                        diag.arg("attribute_args", __binding_7);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
                            __code_21, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag.span_context(__binding_4);
                        if let Some(__binding_8) = __binding_8 {
                            diag.subdiagnostic(__binding_8);
                        }
                        if __binding_9 {
                            diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        }
                        if __binding_10 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1428#[help("the `{$name}{$attribute_args}` attribute can {$only}be applied to {$applied}")]
1429#[diag("the `{$name}{$attribute_args}` attribute cannot be used on {$target}")]
1430pub(crate) struct InvalidTarget {
1431    #[primary_span]
1432    pub span: Span,
1433    #[suggestion(
1434        "remove the attribute",
1435        code = "",
1436        applicability = "machine-applicable",
1437        style = "tool-only"
1438    )]
1439    pub attr_span: Span,
1440    pub name: AttrPath,
1441    pub target: &'static str,
1442    #[context]
1443    pub target_span: Span,
1444    pub applied: DiagArgValue,
1445    pub only: &'static str,
1446    pub attribute_args: String,
1447    #[subdiagnostic]
1448    pub help: Option<InvalidTargetHelp>,
1449    #[warning(
1450        "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1451    )]
1452    pub previously_accepted: bool,
1453    #[note(
1454        "placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute"
1455    )]
1456    pub on_macro_call: bool,
1457}
1458
1459#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidTargetHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvalidTargetHelp::UseExportName {
                        unsafe_open: __binding_0,
                        name: __binding_1,
                        unsafe_close: __binding_2 } => {
                        let mut suggestions = Vec::new();
                        let __code_22 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("unsafe("))
                                });
                        let __code_23 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("export_name"))
                                });
                        let __code_24 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        if let Some(__binding_0) = __binding_0 {
                            suggestions.push((__binding_0, __code_22));
                        }
                        suggestions.push((__binding_1, __code_23));
                        if let Some(__binding_2) = __binding_2 {
                            suggestions.push((__binding_2, __code_24));
                        }
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did you mean to use `#[export_name]`?")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                    InvalidTargetHelp::UseRustcAlign => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#[rustc_align(...)]` instead")),
                                &sub_args);
                        diag.help(__message);
                    }
                    InvalidTargetHelp::UseRustcAlignStatic => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#[rustc_align_static(...)]` instead")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1460pub(crate) enum InvalidTargetHelp {
1461    #[multipart_suggestion(
1462        "did you mean to use `#[export_name]`?",
1463        applicability = "maybe-incorrect"
1464    )]
1465    UseExportName {
1466        #[suggestion_part(code = "unsafe(")]
1467        unsafe_open: Option<Span>,
1468        #[suggestion_part(code = "export_name")]
1469        name: Span,
1470        #[suggestion_part(code = ")")]
1471        unsafe_close: Option<Span>,
1472    },
1473    #[help("use `#[rustc_align(...)]` instead")]
1474    UseRustcAlign,
1475    #[help("use `#[rustc_align_static(...)]` instead")]
1476    UseRustcAlignStatic,
1477}
1478
1479#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            InvalidAlignmentValue {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAlignmentValue {
                        span: __binding_0, error_part: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid alignment value: {$error_part}")));
                        diag.code(E0589);
                        ;
                        diag.arg("error_part", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1480#[diag("invalid alignment value: {$error_part}", code = E0589)]
1481pub(crate) struct InvalidAlignmentValue {
1482    #[primary_span]
1483    pub span: Span,
1484    pub error_part: String,
1485}
1486
1487#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnstableFeatureBoundIncompatibleStability {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnstableFeatureBoundIncompatibleStability {
                        span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("item annotated with `#[unstable_feature_bound]` should not be stable")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1488#[diag("item annotated with `#[unstable_feature_bound]` should not be stable")]
1489#[help(
1490    "if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`"
1491)]
1492pub(crate) struct UnstableFeatureBoundIncompatibleStability {
1493    #[primary_span]
1494    pub span: Span,
1495}
1496
1497#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            NakedFunctionIncompatibleAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NakedFunctionIncompatibleAttribute {
                        span: __binding_0,
                        naked_span: __binding_1,
                        attr: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute incompatible with `#[unsafe(naked)]`")));
                        diag.code(E0736);
                        ;
                        diag.arg("attr", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function marked with `#[unsafe(naked)]` here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1498#[diag("attribute incompatible with `#[unsafe(naked)]`", code = E0736)]
1499pub(crate) struct NakedFunctionIncompatibleAttribute {
1500    #[primary_span]
1501    #[label("the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`")]
1502    pub span: Span,
1503    #[label("function marked with `#[unsafe(naked)]` here")]
1504    pub naked_span: Span,
1505    pub attr: String,
1506}
1507
1508#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            LinkOrdinalOutOfRange {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    LinkOrdinalOutOfRange {
                        span: __binding_0, ordinal: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ordinal value in `link_ordinal` is too large: `{$ordinal}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the value may not exceed `u16::MAX`")));
                        ;
                        diag.arg("ordinal", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1509#[diag("ordinal value in `link_ordinal` is too large: `{$ordinal}`")]
1510#[note("the value may not exceed `u16::MAX`")]
1511pub(crate) struct LinkOrdinalOutOfRange {
1512    #[primary_span]
1513    pub span: Span,
1514    pub ordinal: u128,
1515}
1516
1517#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            RustcScalableVectorCountOutOfRange {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RustcScalableVectorCountOutOfRange {
                        span: __binding_0, n: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("element count in `rustc_scalable_vector` is too large: `{$n}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the value may not exceed `u16::MAX`")));
                        ;
                        diag.arg("n", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1518#[diag("element count in `rustc_scalable_vector` is too large: `{$n}`")]
1519#[note("the value may not exceed `u16::MAX`")]
1520pub(crate) struct RustcScalableVectorCountOutOfRange {
1521    #[primary_span]
1522    pub span: Span,
1523    pub n: u128,
1524}
1525
1526#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for AttributeRequiresOpt
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AttributeRequiresOpt { span: __binding_0, opt: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute requires {$opt} to be enabled")));
                        ;
                        diag.arg("opt", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1527#[diag("attribute requires {$opt} to be enabled")]
1528pub(crate) struct AttributeRequiresOpt {
1529    #[primary_span]
1530    pub span: Span,
1531    pub opt: &'static str,
1532}
1533
1534pub(crate) enum AttributeParseErrorReason<'a> {
1535    ExpectedNoArgs,
1536    ExpectedStringLiteral {
1537        byte_string: Option<Span>,
1538    },
1539    ExpectedFilenameLiteral,
1540    ExpectedIntegerLiteral,
1541    ExpectedIntegerLiteralInRange {
1542        lower_bound: isize,
1543        upper_bound: isize,
1544    },
1545    ExpectedAtLeastOneArgument,
1546    ExpectedArgument,
1547    ExpectedSingleArgument,
1548    ExpectedList,
1549    ExpectedListOrNoArgs,
1550    ExpectedListWithNumArgsOrMore {
1551        args: usize,
1552    },
1553    ExpectedNameValueOrNoArgs,
1554    ExpectedNonEmptyStringLiteral,
1555    ExpectedNotLiteral,
1556    ExpectedNameValue(Option<Symbol>),
1557    MissingNameValue(Symbol),
1558    DuplicateKey(Symbol),
1559    ExpectedSpecificArgument {
1560        possibilities: &'a [Symbol],
1561        strings: bool,
1562        /// Should we tell the user to write a list when they didn't?
1563        list: bool,
1564    },
1565    ExpectedIdentifier,
1566}
1567
1568/// A description of a thing that can be parsed using an attribute parser.
1569#[derive(#[automatically_derived]impl ::core::marker::Copy for ParsedDescription { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for ParsedDescription {
}
#[automatically_derived]impl ::core::clone::Clone for ParsedDescription {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone)]
1570pub enum ParsedDescription {
1571    /// Used when parsing attributes.
1572    Attribute,
1573    /// Used when parsing some macros, such as the `cfg!()` macro.
1574    Macro,
1575}
1576
1577pub(crate) struct AttributeParseError<'a> {
1578    pub(crate) span: Span,
1579    pub(crate) inner_span: Span,
1580    pub(crate) template: AttributeTemplate,
1581    pub(crate) path: AttrPath,
1582    pub(crate) description: ParsedDescription,
1583    pub(crate) reason: AttributeParseErrorReason<'a>,
1584    pub(crate) suggestions: AttributeParseErrorSuggestions,
1585}
1586
1587pub(crate) enum AttributeParseErrorSuggestions {
1588    CreatedByTemplate(Vec<String>),
1589    CreatedByParser(Vec<Suggestion>),
1590}
1591
1592impl<'a> AttributeParseError<'a> {
1593    fn render_expected_specific_argument(
1594        &self,
1595        diag: &mut Diag<'_>,
1596        possibilities: &[Symbol],
1597        strings: bool,
1598    ) {
1599        let quote = if strings { '"' } else { '`' };
1600        match possibilities {
1601            &[] => {}
1602            &[x] => {
1603                diag.span_label(
1604                    self.span,
1605                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("the only valid argument here is {0}{1}{0}",
                quote, x))
    })format!("the only valid argument here is {quote}{x}{quote}"),
1606                );
1607            }
1608            [first, second] => {
1609                diag.span_label(
1610                    self.span,
1611                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("valid arguments are {0}{1}{0} or {0}{2}{0}",
                quote, first, second))
    })format!("valid arguments are {quote}{first}{quote} or {quote}{second}{quote}"),
1612                );
1613            }
1614            [first @ .., second_to_last, last] => {
1615                let mut res = String::new();
1616                for i in first {
1617                    res.push_str(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{0}, ", quote, i))
    })format!("{quote}{i}{quote}, "));
1618                }
1619                res.push_str(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{0} or {0}{2}{0}", quote,
                second_to_last, last))
    })format!("{quote}{second_to_last}{quote} or {quote}{last}{quote}"));
1620
1621                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("valid arguments are {0}", res))
    })format!("valid arguments are {res}"));
1622            }
1623        }
1624    }
1625
1626    fn render_expected_specific_argument_list(
1627        &self,
1628        diag: &mut Diag<'_>,
1629        possibilities: &[Symbol],
1630        strings: bool,
1631    ) {
1632        let description = self.description();
1633
1634        let quote = if strings { '"' } else { '`' };
1635        match possibilities {
1636            &[] => {}
1637            &[x] => {
1638                diag.span_label(
1639                    self.span,
1640                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("this {0} is only valid with {1}{2}{1} as an argument",
                description, quote, x))
    })format!(
1641                        "this {description} is only valid with {quote}{x}{quote} as an argument"
1642                    ),
1643                );
1644            }
1645            [first, second] => {
1646                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("this {0} is only valid with either {1}{2}{1} or {1}{3}{1} as an argument",
                description, quote, first, second))
    })format!("this {description} is only valid with either {quote}{first}{quote} or {quote}{second}{quote} as an argument"));
1647            }
1648            [first @ .., second_to_last, last] => {
1649                let mut res = String::new();
1650                for i in first {
1651                    res.push_str(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{0}, ", quote, i))
    })format!("{quote}{i}{quote}, "));
1652                }
1653                res.push_str(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{0} or {0}{2}{0}", quote,
                second_to_last, last))
    })format!("{quote}{second_to_last}{quote} or {quote}{last}{quote}"));
1654
1655                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("this {0} is only valid with one of the following arguments: {1}",
                description, res))
    })format!("this {description} is only valid with one of the following arguments: {res}"));
1656            }
1657        }
1658    }
1659
1660    fn render_suggestions(&self, diag: &mut Diag<'_>) {
1661        let description = self.description();
1662
1663        match &self.suggestions {
1664            AttributeParseErrorSuggestions::CreatedByTemplate(suggestions) => {
1665                diag.span_suggestions(
1666                    self.inner_span,
1667                    if suggestions.len() == 1 {
1668                        "must be of the form".to_string()
1669                    } else {
1670                        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("try changing it to one of the following valid forms of the {0}",
                description))
    })format!(
1671                            "try changing it to one of the following valid forms of the {description}"
1672                        )
1673                    },
1674                    suggestions.iter().cloned(),
1675                    Applicability::HasPlaceholders,
1676                );
1677            }
1678
1679            AttributeParseErrorSuggestions::CreatedByParser(suggestions) => {
1680                for Suggestion { msg, sp, code } in suggestions {
1681                    diag.span_suggestion_verbose(
1682                        *sp,
1683                        msg.clone(),
1684                        code.clone(),
1685                        Applicability::MaybeIncorrect,
1686                    );
1687                }
1688            }
1689        }
1690    }
1691
1692    fn description(&self) -> &'static str {
1693        match self.description {
1694            ParsedDescription::Attribute => "attribute",
1695            ParsedDescription::Macro => "macro",
1696        }
1697    }
1698}
1699
1700impl AttributeParseErrorSuggestions {
1701    fn len(&self) -> usize {
1702        match self {
1703            AttributeParseErrorSuggestions::CreatedByTemplate(items) => items.len(),
1704            AttributeParseErrorSuggestions::CreatedByParser(items) => items.len(),
1705        }
1706    }
1707}
1708
1709impl<'a> Diagnostic<'a> for AttributeParseError<'_> {
1710    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a> {
1711        let name = self.path.to_string();
1712
1713        let description = self.description();
1714
1715        let mut diag = Diag::new(dcx, level, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("malformed `{0}` {1} input", name,
                description))
    })format!("malformed `{name}` {description} input"));
1716        diag.span(self.inner_span);
1717        diag.code(E0539);
1718        match &self.reason {
1719            AttributeParseErrorReason::ExpectedStringLiteral { byte_string } => {
1720                if let Some(start_point_span) = byte_string {
1721                    diag.span_suggestion_short(
1722                        *start_point_span,
1723                        "consider removing the prefix",
1724                        "",
1725                        Applicability::MaybeIncorrect,
1726                    );
1727                    diag.note("expected a normal string literal, not a byte string literal");
1728
1729                    // Avoid emitting an "attribute must be of the form" suggestion, as the
1730                    // attribute is likely to be well-formed already.
1731                    return diag;
1732                }
1733                diag.span_label(self.span, "expected a string literal here");
1734            }
1735            AttributeParseErrorReason::ExpectedFilenameLiteral => {
1736                diag.span_label(self.span, "expected a filename string literal here");
1737            }
1738            AttributeParseErrorReason::ExpectedIntegerLiteral => {
1739                diag.span_label(self.span, "expected an integer literal here");
1740            }
1741            AttributeParseErrorReason::ExpectedIntegerLiteralInRange {
1742                lower_bound,
1743                upper_bound,
1744            } => {
1745                diag.span_label(
1746                    self.span,
1747                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("expected an integer literal in the range of {0}..={1}",
                lower_bound, upper_bound))
    })format!(
1748                        "expected an integer literal in the range of {lower_bound}..={upper_bound}"
1749                    ),
1750                );
1751            }
1752            AttributeParseErrorReason::ExpectedSingleArgument => {
1753                diag.span_label(self.span, "expected a single argument here");
1754                diag.code(E0805);
1755            }
1756            AttributeParseErrorReason::ExpectedArgument => {
1757                diag.span_label(self.span, "expected an argument here");
1758                diag.code(E0805);
1759            }
1760            AttributeParseErrorReason::ExpectedAtLeastOneArgument => {
1761                diag.span_label(self.span, "expected at least 1 argument here");
1762            }
1763            AttributeParseErrorReason::ExpectedList => {
1764                diag.span_label(self.span, "expected this to be a list");
1765            }
1766            AttributeParseErrorReason::ExpectedListOrNoArgs => {
1767                diag.span_label(self.span, "expected a list or no arguments here");
1768            }
1769            AttributeParseErrorReason::ExpectedListWithNumArgsOrMore { args } => {
1770                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("expected {0} or more items", args))
    })format!("expected {args} or more items"));
1771            }
1772            AttributeParseErrorReason::ExpectedNameValueOrNoArgs => {
1773                diag.span_label(self.span, "didn't expect a list here");
1774            }
1775            AttributeParseErrorReason::ExpectedNonEmptyStringLiteral => {
1776                diag.span_label(self.span, "string is not allowed to be empty");
1777            }
1778            AttributeParseErrorReason::DuplicateKey(key) => {
1779                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("found `{0}` used as a key more than once",
                key))
    })format!("found `{key}` used as a key more than once"));
1780                diag.code(E0538);
1781            }
1782            AttributeParseErrorReason::ExpectedNotLiteral => {
1783                diag.span_label(self.span, "didn't expect a literal here");
1784                diag.code(E0565);
1785            }
1786            AttributeParseErrorReason::ExpectedNoArgs => {
1787                diag.span_label(self.span, "didn't expect any arguments here");
1788                diag.code(E0565);
1789            }
1790            AttributeParseErrorReason::ExpectedNameValue(None) => {
1791                // If the span is the entire attribute inner, the suggestion we add below this
1792                // match already contains enough information.
1793                if self.span != self.inner_span {
1794                    diag.span_label(self.span, "expected this to be of the form `... = \"...\"`");
1795                }
1796            }
1797            AttributeParseErrorReason::ExpectedNameValue(Some(name)) => {
1798                diag.span_label(
1799                    self.span,
1800                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("expected this to be of the form `{0} = \"...\"`",
                name))
    })format!("expected this to be of the form `{name} = \"...\"`"),
1801                );
1802            }
1803            AttributeParseErrorReason::MissingNameValue(name) => {
1804                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("missing argument `{0} = \"...\"`",
                name))
    })format!("missing argument `{name} = \"...\"`"));
1805            }
1806            AttributeParseErrorReason::ExpectedSpecificArgument {
1807                possibilities,
1808                strings,
1809                list: false,
1810            } => {
1811                self.render_expected_specific_argument(&mut diag, possibilities, *strings);
1812            }
1813            AttributeParseErrorReason::ExpectedSpecificArgument {
1814                possibilities,
1815                strings,
1816                list: true,
1817            } => {
1818                self.render_expected_specific_argument_list(&mut diag, possibilities, *strings);
1819            }
1820            AttributeParseErrorReason::ExpectedIdentifier => {
1821                diag.span_label(self.span, "expected a valid identifier here");
1822                diag.code(E0565);
1823            }
1824        }
1825
1826        if let Some(link) = self.template.docs {
1827            diag.note(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("for more information, visit <{0}>",
                link))
    })format!("for more information, visit <{link}>"));
1828        }
1829
1830        if self.suggestions.len() < 4 {
1831            self.render_suggestions(&mut diag);
1832        }
1833
1834        diag
1835    }
1836}
1837
1838#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidAttrUnsafe {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidAttrUnsafe { span: __binding_0, name: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` is not an unsafe attribute")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extraneous unsafe is not allowed in attributes")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is not an unsafe attribute")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1839#[diag("`{$name}` is not an unsafe attribute")]
1840#[note("extraneous unsafe is not allowed in attributes")]
1841pub(crate) struct InvalidAttrUnsafe {
1842    #[primary_span]
1843    #[label("this is not an unsafe attribute")]
1844    pub span: Span,
1845    pub name: AttrPath,
1846}
1847
1848#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnsafeAttrOutsideUnsafe {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsafeAttrOutsideUnsafe {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe attribute used without unsafe")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of unsafe attribute")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1849#[diag("unsafe attribute used without unsafe")]
1850pub(crate) struct UnsafeAttrOutsideUnsafe {
1851    #[primary_span]
1852    #[label("usage of unsafe attribute")]
1853    pub span: Span,
1854    #[subdiagnostic]
1855    pub suggestion: Option<UnsafeAttrOutsideUnsafeSuggestion>,
1856}
1857
1858#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnsafeAttrOutsideUnsafeSuggestion
            {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    UnsafeAttrOutsideUnsafeSuggestion {
                        left: __binding_0, right: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_25 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("unsafe("))
                                });
                        let __code_26 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_25));
                        suggestions.push((__binding_1, __code_26));
                        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)]
1859#[multipart_suggestion("wrap the attribute in `unsafe(...)`", applicability = "machine-applicable")]
1860pub(crate) struct UnsafeAttrOutsideUnsafeSuggestion {
1861    #[suggestion_part(code = "unsafe(")]
1862    pub left: Span,
1863    #[suggestion_part(code = ")")]
1864    pub right: Span,
1865}
1866
1867#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MetaBadDelim {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MetaBadDelim { span: __binding_0, sugg: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrong meta list delimiters")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1868#[diag("wrong meta list delimiters")]
1869pub(crate) struct MetaBadDelim {
1870    #[primary_span]
1871    pub span: Span,
1872    #[subdiagnostic]
1873    pub sugg: MetaBadDelimSugg,
1874}
1875
1876#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MetaBadDelimSugg {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    MetaBadDelimSugg { open: __binding_0, close: __binding_1 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_27 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_28 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_27));
                        suggestions.push((__binding_1, __code_28));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the delimiters should be `(` and `)`")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1877#[multipart_suggestion(
1878    "the delimiters should be `(` and `)`",
1879    applicability = "machine-applicable"
1880)]
1881pub(crate) struct MetaBadDelimSugg {
1882    #[suggestion_part(code = "(")]
1883    pub open: Span,
1884    #[suggestion_part(code = ")")]
1885    pub close: Span,
1886}
1887
1888#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidMetaItem {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidMetaItem {
                        span: __binding_0,
                        descr: __binding_1,
                        quote_ident_sugg: __binding_2,
                        remove_neg_sugg: __binding_3,
                        label: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a literal (`1u8`, `1.0f32`, `\"string\"`, etc.) here, found {$descr}")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.span(__binding_0);
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        if let Some(__binding_4) = __binding_4 {
                            diag.span_label(__binding_4,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$descr}s are not allowed here")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1889#[diag("expected a literal (`1u8`, `1.0f32`, `\"string\"`, etc.) here, found {$descr}")]
1890pub(crate) struct InvalidMetaItem {
1891    #[primary_span]
1892    pub span: Span,
1893    pub descr: String,
1894    #[subdiagnostic]
1895    pub quote_ident_sugg: Option<InvalidMetaItemQuoteIdentSugg>,
1896    #[subdiagnostic]
1897    pub remove_neg_sugg: Option<InvalidMetaItemRemoveNegSugg>,
1898    #[label("{$descr}s are not allowed here")]
1899    pub label: Option<Span>,
1900}
1901
1902#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidMetaItemQuoteIdentSugg {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvalidMetaItemQuoteIdentSugg {
                        before: __binding_0, after: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_29 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("\""))
                                });
                        let __code_30 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("\""))
                                });
                        suggestions.push((__binding_0, __code_29));
                        suggestions.push((__binding_1, __code_30));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("surround the identifier with quotation marks to make it into a string literal")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1903#[multipart_suggestion(
1904    "surround the identifier with quotation marks to make it into a string literal",
1905    applicability = "machine-applicable"
1906)]
1907pub(crate) struct InvalidMetaItemQuoteIdentSugg {
1908    #[suggestion_part(code = "\"")]
1909    pub before: Span,
1910    #[suggestion_part(code = "\"")]
1911    pub after: Span,
1912}
1913
1914#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidMetaItemRemoveNegSugg {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvalidMetaItemRemoveNegSugg { negative_sign: __binding_0 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_31 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        suggestions.push((__binding_0, __code_31));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative numbers are not literals, try removing the `-` sign")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
1915#[multipart_suggestion(
1916    "negative numbers are not literals, try removing the `-` sign",
1917    applicability = "machine-applicable"
1918)]
1919pub(crate) struct InvalidMetaItemRemoveNegSugg {
1920    #[suggestion_part(code = "")]
1921    pub negative_sign: Span,
1922}
1923
1924#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            SuffixedLiteralInAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SuffixedLiteralInAttribute { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suffixed literals are not allowed in attributes")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1925#[diag("suffixed literals are not allowed in attributes")]
1926#[help(
1927    "instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)"
1928)]
1929pub(crate) struct SuffixedLiteralInAttribute {
1930    #[primary_span]
1931    pub span: Span,
1932}
1933
1934#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for EmptyLinkName {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    EmptyLinkName { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link name must not be empty")));
                        diag.code(E0454);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty link name")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1935#[diag("link name must not be empty", code = E0454)]
1936pub(crate) struct EmptyLinkName {
1937    #[primary_span]
1938    #[label("empty link name")]
1939    pub span: Span,
1940}
1941
1942#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for Link {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
1943#[diag("attribute should be applied to an `extern` block with non-Rust ABI")]
1944#[warning(
1945    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1946)]
1947pub(crate) struct Link;
1948
1949#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for LinkFrameworkApple {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    LinkFrameworkApple { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link kind `framework` is only supported on Apple targets")));
                        diag.code(E0455);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1950#[diag("link kind `framework` is only supported on Apple targets", code = E0455)]
1951pub(crate) struct LinkFrameworkApple {
1952    #[primary_span]
1953    pub span: Span,
1954}
1955
1956#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for IncompatibleWasmLink
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    IncompatibleWasmLink { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`wasm_import_module` is incompatible with other arguments in `#[link]` attributes")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1957#[diag("`wasm_import_module` is incompatible with other arguments in `#[link]` attributes")]
1958pub(crate) struct IncompatibleWasmLink {
1959    #[primary_span]
1960    pub span: Span,
1961}
1962
1963#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for LinkRequiresName {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    LinkRequiresName { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[link]` attribute requires a `name = \"string\"` argument")));
                        diag.code(E0459);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing `name` argument")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1964#[diag("`#[link]` attribute requires a `name = \"string\"` argument", code = E0459)]
1965pub(crate) struct LinkRequiresName {
1966    #[primary_span]
1967    #[label("missing `name` argument")]
1968    pub span: Span,
1969}
1970
1971#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for RawDylibOnlyWindows
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    RawDylibOnlyWindows { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link kind `raw-dylib` is only supported on Windows targets")));
                        diag.code(E0455);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1972#[diag("link kind `raw-dylib` is only supported on Windows targets", code = E0455)]
1973pub(crate) struct RawDylibOnlyWindows {
1974    #[primary_span]
1975    pub span: Span,
1976}
1977
1978#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidLinkModifier
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidLinkModifier { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1979#[diag(
1980    "invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols"
1981)]
1982pub(crate) struct InvalidLinkModifier {
1983    #[primary_span]
1984    pub span: Span,
1985}
1986
1987#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MultipleModifiers {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MultipleModifiers { span: __binding_0, modifier: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `{$modifier}` modifiers in a single `modifiers` argument")));
                        ;
                        diag.arg("modifier", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1988#[diag("multiple `{$modifier}` modifiers in a single `modifiers` argument")]
1989pub(crate) struct MultipleModifiers {
1990    #[primary_span]
1991    pub span: Span,
1992    pub modifier: Symbol,
1993}
1994
1995#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ImportNameTypeX86 {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ImportNameTypeX86 { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import name type is only supported on x86")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1996#[diag("import name type is only supported on x86")]
1997pub(crate) struct ImportNameTypeX86 {
1998    #[primary_span]
1999    pub span: Span,
2000}
2001
2002#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for BundleNeedsStatic {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    BundleNeedsStatic { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `bundle` is only compatible with `static` linking kind")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2003#[diag("linking modifier `bundle` is only compatible with `static` linking kind")]
2004pub(crate) struct BundleNeedsStatic {
2005    #[primary_span]
2006    pub span: Span,
2007}
2008
2009#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            ExportSymbolsNeedsStatic {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExportSymbolsNeedsStatic { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `export-symbols` is only compatible with `static` linking kind")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2010#[diag("linking modifier `export-symbols` is only compatible with `static` linking kind")]
2011pub(crate) struct ExportSymbolsNeedsStatic {
2012    #[primary_span]
2013    pub span: Span,
2014}
2015
2016#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            WholeArchiveNeedsStatic {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    WholeArchiveNeedsStatic { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `whole-archive` is only compatible with `static` linking kind")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2017#[diag("linking modifier `whole-archive` is only compatible with `static` linking kind")]
2018pub(crate) struct WholeArchiveNeedsStatic {
2019    #[primary_span]
2020    pub span: Span,
2021}
2022
2023#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            AsNeededCompatibility {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    AsNeededCompatibility { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2024#[diag(
2025    "linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds"
2026)]
2027pub(crate) struct AsNeededCompatibility {
2028    #[primary_span]
2029    pub span: Span,
2030}
2031
2032#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ImportNameTypeRaw {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ImportNameTypeRaw { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import name type can only be used with link kind `raw-dylib`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2033#[diag("import name type can only be used with link kind `raw-dylib`")]
2034pub(crate) struct ImportNameTypeRaw {
2035    #[primary_span]
2036    pub span: Span,
2037}
2038
2039#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for LimitInvalid<'a>
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    LimitInvalid {
                        span: __binding_0,
                        value_span: __binding_1,
                        error_str: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`limit` must be a non-negative integer")));
                        ;
                        diag.arg("error_str", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error_str}")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2040#[diag("`limit` must be a non-negative integer")]
2041pub(crate) struct LimitInvalid<'a> {
2042    #[primary_span]
2043    pub span: Span,
2044    #[label("{$error_str}")]
2045    pub value_span: Span,
2046    pub error_str: &'a str,
2047}
2048
2049#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for CfgAttrBadDelim {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CfgAttrBadDelim { span: __binding_0, sugg: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrong `cfg_attr` delimiters")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2050#[diag("wrong `cfg_attr` delimiters")]
2051pub(crate) struct CfgAttrBadDelim {
2052    #[primary_span]
2053    pub span: Span,
2054    #[subdiagnostic]
2055    pub sugg: MetaBadDelimSugg,
2056}
2057
2058#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for DocAliasMalformed {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocAliasMalformed { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("doc alias attribute expects a string `#[doc(alias = \"a\")]` or a list of strings `#[doc(alias(\"a\", \"b\"))]`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2059#[diag(
2060    "doc alias attribute expects a string `#[doc(alias = \"a\")]` or a list of strings `#[doc(alias(\"a\", \"b\"))]`"
2061)]
2062pub(crate) struct DocAliasMalformed {
2063    #[primary_span]
2064    pub span: Span,
2065}
2066
2067#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnknownLangItem {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnknownLangItem { span: __binding_0, name: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("definition of an unknown lang item: `{$name}`")));
                        diag.code(E0522);
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("definition of unknown lang item `{$name}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2068#[diag("definition of an unknown lang item: `{$name}`", code = E0522)]
2069pub(crate) struct UnknownLangItem {
2070    #[primary_span]
2071    #[label("definition of unknown lang item `{$name}`")]
2072    pub span: Span,
2073    pub name: Symbol,
2074}
2075
2076#[derive(const _: () =
    {
        impl<'_sess, 'a> rustc_errors::Diagnostic<'_sess> for
            UnsupportedInstructionSet<'a> {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnsupportedInstructionSet {
                        span: __binding_0,
                        instruction_set: __binding_1,
                        current_target: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`")));
                        ;
                        diag.arg("instruction_set", __binding_1);
                        diag.arg("current_target", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2077#[diag("target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`")]
2078pub(crate) struct UnsupportedInstructionSet<'a> {
2079    #[primary_span]
2080    pub span: Span,
2081    pub instruction_set: Symbol,
2082    pub current_target: &'a TargetTuple,
2083}
2084
2085#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CustomMirPhaseRequiresDialect {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CustomMirPhaseRequiresDialect {
                        attr_span: __binding_0, phase_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`dialect` key required")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`phase` argument requires a `dialect` argument")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2086#[diag("`dialect` key required")]
2087pub(crate) struct CustomMirPhaseRequiresDialect {
2088    #[primary_span]
2089    pub attr_span: Span,
2090    #[label("`phase` argument requires a `dialect` argument")]
2091    pub phase_span: Span,
2092}
2093
2094#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            CustomMirIncompatibleDialectAndPhase {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    CustomMirIncompatibleDialectAndPhase {
                        dialect: __binding_0,
                        phase: __binding_1,
                        attr_span: __binding_2,
                        dialect_span: __binding_3,
                        phase_span: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$dialect} dialect is not compatible with the {$phase} phase")));
                        ;
                        diag.arg("dialect", __binding_0);
                        diag.arg("phase", __binding_1);
                        diag.span(__binding_2);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this dialect...")));
                        diag.span_label(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("... is not compatible with this phase")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2095#[diag("the {$dialect} dialect is not compatible with the {$phase} phase")]
2096pub(crate) struct CustomMirIncompatibleDialectAndPhase {
2097    pub dialect: MirDialect,
2098    pub phase: MirPhase,
2099    #[primary_span]
2100    pub attr_span: Span,
2101    #[label("this dialect...")]
2102    pub dialect_span: Span,
2103    #[label("... is not compatible with this phase")]
2104    pub phase_span: Span,
2105}
2106
2107#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            UnstableAttrForAlreadyStableFeature {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnstableAttrForAlreadyStableFeature {
                        attr_span: __binding_0, item_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't mark as unstable using an already stable feature")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this feature is already stable")));
                        diag.span_help(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing the attribute")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the stability attribute annotates this item")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2108#[diag("can't mark as unstable using an already stable feature")]
2109pub(crate) struct UnstableAttrForAlreadyStableFeature {
2110    #[primary_span]
2111    #[label("this feature is already stable")]
2112    #[help("consider removing the attribute")]
2113    pub attr_span: Span,
2114    #[label("the stability attribute annotates this item")]
2115    pub item_span: Span,
2116}
2117
2118#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for InvalidMachoSection
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    InvalidMachoSection {
                        name_span: __binding_0, reason: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid Mach-O section specifier")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a valid Mach-O section specifier")));
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2119#[diag("invalid Mach-O section specifier")]
2120pub(crate) struct InvalidMachoSection {
2121    #[primary_span]
2122    #[label("not a valid Mach-O section specifier")]
2123    pub name_span: Span,
2124    #[subdiagnostic]
2125    pub reason: InvalidMachoSectionReason,
2126}
2127
2128#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidMachoSectionReason {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    InvalidMachoSectionReason::MissingSection => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a Mach-O section specifier requires a segment and a section, separated by a comma")),
                                &sub_args);
                        diag.note(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an example of a valid Mach-O section specifier is `__TEXT,__cstring`")),
                                &sub_args);
                        diag.help(__message);
                    }
                    InvalidMachoSectionReason::SectionTooLong {
                        section: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("section".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("section name `{$section}` is longer than 16 bytes")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
2129pub(crate) enum InvalidMachoSectionReason {
2130    #[note("a Mach-O section specifier requires a segment and a section, separated by a comma")]
2131    #[help("an example of a valid Mach-O section specifier is `__TEXT,__cstring`")]
2132    MissingSection,
2133    #[note("section name `{$section}` is longer than 16 bytes")]
2134    SectionTooLong { section: String },
2135}
2136
2137#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            SanitizeInvalidStatic {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    SanitizeInvalidStatic {
                        span: __binding_0, field: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[sanitize({$field} = ...)]` attribute cannot be used on statics")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[sanitize]` can be used on statics if only the address is sanitized")));
                        ;
                        diag.arg("field", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2138#[diag("`#[sanitize({$field} = ...)]` attribute cannot be used on statics")]
2139#[help("`#[sanitize]` can be used on statics if only the address is sanitized")]
2140pub(crate) struct SanitizeInvalidStatic {
2141    #[primary_span]
2142    pub span: Span,
2143    pub field: &'static str,
2144}
2145
2146#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for ExpectedComma {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    ExpectedComma { span: __binding_0, additional: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute items not separated with `,`")));
                        let __code_32 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(","))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding `,` here")),
                            __code_32, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        for __binding_1 in __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2147#[diag("attribute items not separated with `,`")]
2148pub(crate) struct ExpectedComma {
2149    #[primary_span]
2150    #[suggestion(
2151        "try adding `,` here",
2152        code = ",",
2153        applicability = "maybe-incorrect",
2154        style = "short"
2155    )]
2156    pub span: Span,
2157    #[subdiagnostic]
2158    pub additional: Vec<AdditionalCommaSuggestion>,
2159}
2160
2161#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for AdditionalCommaSuggestion {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    AdditionalCommaSuggestion { span: __binding_0 } => {
                        let __code_33 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(","))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding `,` here")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_33, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                    }
                }
            }
        }
    };Subdiagnostic)]
2162#[suggestion("try adding `,` here", code = ",", applicability = "maybe-incorrect", style = "short")]
2163pub(crate) struct AdditionalCommaSuggestion {
2164    #[primary_span]
2165    pub span: Span,
2166}
2167
2168#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnusedDuplicate {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnusedDuplicate {
                        this: __binding_0, other: __binding_1, warning: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
                        let __code_34 =
                            [::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_34, rustc_errors::Applicability::Unspecified,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
                        if __binding_2 {
                            diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2169#[diag("unused attribute")]
2170pub(crate) struct UnusedDuplicate {
2171    #[suggestion("remove this attribute", code = "", applicability = "unspecified")]
2172    pub this: Span,
2173    #[note("attribute also specified here")]
2174    pub other: Span,
2175    #[warning(
2176        "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
2177    )]
2178    pub warning: bool,
2179}
2180
2181#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MacroExport {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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)]
2182pub(crate) enum MacroExport {
2183    #[diag("`#[macro_export]` has no effect on declarative macro definitions")]
2184    #[note("declarative macros follow the same exporting rules as regular items")]
2185    OnDeclMacro,
2186}
2187
2188#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for MalformedAttribute {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MalformedAttribute { span: __binding_0, kind: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed lint attribute input")));
                        diag.code(E0452);
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2189#[diag("malformed lint attribute input", code = E0452)]
2190pub(crate) struct MalformedAttribute {
2191    #[primary_span]
2192    pub span: Span,
2193    #[subdiagnostic]
2194    pub kind: MalformedAttributeKind,
2195}
2196
2197#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MalformedAttributeKind {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    MalformedAttributeKind::ReasonMustComeLast(__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("reason in lint attribute must come last")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
2198pub(crate) enum MalformedAttributeKind {
2199    #[label("reason in lint attribute must come last")]
2200    ReasonMustComeLast(#[primary_span] Span),
2201}
2202
2203#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            MalformedLintAttributeInput {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    MalformedLintAttributeInput {
                        span: __binding_0, kind: __binding_1, help: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("malformed `{$kind}` attribute input")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not the name of a lint")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2204#[diag("malformed `{$kind}` attribute input")]
2205pub(crate) struct MalformedLintAttributeInput {
2206    #[primary_span]
2207    #[label("not the name of a lint")]
2208    pub span: Span,
2209    pub kind: Symbol,
2210    #[subdiagnostic]
2211    pub help: MalformedLintAttributeInputHelp,
2212}
2213
2214#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MalformedLintAttributeInputHelp {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                match self {
                    MalformedLintAttributeInputHelp::StrLit {
                        sym: __binding_0, kind: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("sym".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("kind".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try using `#[{$kind}({$sym})]`")),
                                &sub_args);
                        diag.help(__message);
                    }
                    MalformedLintAttributeInputHelp::Other { kind: __binding_0 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("kind".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("for example, write `#[{$kind}(dead_code)]` for `dead_code`")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
2215pub(crate) enum MalformedLintAttributeInputHelp {
2216    #[help("try using `#[{$kind}({$sym})]`")]
2217    StrLit { sym: Symbol, kind: Symbol },
2218    #[help("for example, write `#[{$kind}(dead_code)]` for `dead_code`")]
2219    Other { kind: Symbol },
2220}
2221
2222#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnusedNote {
            fn add_to_diag(self, diag: &mut rustc_errors::Diag<'_>) {
                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);
                    }
                }
            }
        }
    };Subdiagnostic)]
2223pub(crate) enum UnusedNote {
2224    #[note("attribute `{$name}` with an empty list has no effect")]
2225    EmptyList { name: Symbol },
2226    #[note("attribute `{$name}` without any lints has no effect")]
2227    NoLints { name: Symbol },
2228}
2229
2230#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for Unused {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                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_35 =
                            [::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_35, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2231#[diag("unused attribute")]
2232pub(crate) struct Unused {
2233    #[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
2234    pub attr_span: Span,
2235    #[subdiagnostic]
2236    pub note: UnusedNote,
2237}
2238
2239#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for NoLinkAttrUsed {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    NoLinkAttrUsed => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use of deprecated `no_link` attribute")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2240#[diag("use of deprecated `no_link` attribute")]
2241pub(crate) struct NoLinkAttrUsed;
2242
2243#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for
            DocKeywordAttributeNotAnonConst {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    DocKeywordAttributeNotAnonConst {
                        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 anonymous constants")));
                        ;
                        diag.arg("attr_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2244#[diag("`#[doc({$attr_name} = \"...\")]` should be used on anonymous constants")]
2245pub(crate) struct DocKeywordAttributeNotAnonConst {
2246    #[primary_span]
2247    pub span: Span,
2248    pub attr_name: Symbol,
2249}
2250
2251#[derive(const _: () =
    {
        impl<'_sess> rustc_errors::Diagnostic<'_sess> for UnknownLintHelper {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess> {
                match self {
                    UnknownLintHelper { span: __binding_0, unknown: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `lint::{$unknown}` attribute is not recognized")));
                        ;
                        diag.arg("unknown", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
2252#[diag("the `lint::{$unknown}` attribute is not recognized")]
2253pub(crate) struct UnknownLintHelper {
2254    #[primary_span]
2255    pub span: Span,
2256    pub unknown: Symbol,
2257}