Skip to main content

rustc_attr_parsing/
diagnostics.rs

1use rustc_errors::{Applicability, DiagArgValue, E0232, E0264, MultiSpan};
2use rustc_hir::AttrPath;
3use rustc_macros::{Diagnostic, Subdiagnostic};
4use rustc_span::{Span, Symbol};
5
6#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidAttrAtCrateLevel where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
7#[diag("`{$name}` attribute cannot be used at crate level")]
8pub(crate) struct InvalidAttrAtCrateLevel {
9    #[primary_span]
10    pub span: Span,
11    #[suggestion(
12        "perhaps you meant to use an outer attribute",
13        code = "#[",
14        applicability = "machine-applicable",
15        style = "verbose"
16    )]
17    pub pound_to_opening_bracket: Span,
18    pub name: Symbol,
19    #[subdiagnostic]
20    pub item: Option<ItemFollowingInnerAttr>,
21}
22
23#[derive(#[automatically_derived]
impl ::core::clone::Clone for ItemFollowingInnerAttr {
    #[inline]
    fn clone(&self) -> ItemFollowingInnerAttr {
        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<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
24#[label("the inner attribute doesn't annotate this item")]
25pub(crate) struct ItemFollowingInnerAttr {
26    #[primary_span]
27    pub span: Span,
28}
29
30#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnreachableCfgSelectPredicate where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
31#[diag("unreachable configuration predicate")]
32pub(crate) struct UnreachableCfgSelectPredicate {
33    #[label("this configuration predicate is never reached")]
34    pub span: Span,
35}
36
37#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsupportedAttributesInWhere where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsupportedAttributesInWhere { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("most attributes are not supported in `where` clauses")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only `#[cfg]` and `#[cfg_attr]` are supported")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
38#[diag("most attributes are not supported in `where` clauses")]
39#[help("only `#[cfg]` and `#[cfg_attr]` are supported")]
40pub(crate) struct UnsupportedAttributesInWhere {
41    #[primary_span]
42    pub span: MultiSpan,
43}
44
45#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnreachableCfgSelectPredicateWildcard where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
46#[diag("unreachable configuration predicate")]
47pub(crate) struct UnreachableCfgSelectPredicateWildcard {
48    #[label("this configuration predicate is never reached")]
49    pub span: Span,
50
51    #[label("always matches")]
52    pub wildcard_span: Span,
53}
54
55#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MustBeNameOfAssociatedFunction where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
56#[diag("must be a name of an associated function")]
57pub(crate) struct MustBeNameOfAssociatedFunction {
58    #[primary_span]
59    pub span: Span,
60}
61
62#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeAttrOutsideUnsafeLint where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
63#[diag("unsafe attribute used without unsafe")]
64pub(crate) struct UnsafeAttrOutsideUnsafeLint {
65    #[label("usage of unsafe attribute")]
66    pub span: Span,
67    #[subdiagnostic]
68    pub suggestion: Option<crate::session_diagnostics::UnsafeAttrOutsideUnsafeSuggestion>,
69}
70
71#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IllFormedAttributeInput where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
72#[diag(
73    "{$num_suggestions ->
74        [1] attribute must be of the form {$suggestions}
75        *[other] valid forms for the attribute are {$suggestions}
76    }"
77)]
78pub(crate) struct IllFormedAttributeInput {
79    pub num_suggestions: usize,
80    pub suggestions: DiagArgValue,
81    #[note("for more information, visit <{$docs}>")]
82    pub has_docs: bool,
83    pub docs: &'static str,
84    #[subdiagnostic]
85    help: Option<IllFormedAttributeInputHelp>,
86}
87
88impl IllFormedAttributeInput {
89    pub(crate) fn new(
90        suggestions: &[String],
91        docs: Option<&'static str>,
92        help: Option<&str>,
93    ) -> Self {
94        Self {
95            num_suggestions: suggestions.len(),
96            suggestions: DiagArgValue::StrListSepByAnd(
97                suggestions.into_iter().map(|s| ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("`{0}`", s))
    })format!("`{s}`").into()).collect(),
98            ),
99            has_docs: docs.is_some(),
100            docs: docs.unwrap_or(""),
101            help: help.map(|h| IllFormedAttributeInputHelp { lint: h.to_string() }),
102        }
103    }
104}
105
106#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for IllFormedAttributeInputHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
107#[help(
108    "if you meant to silence a warning, consider using #![allow({$lint})] or #![expect({$lint})]"
109)]
110struct IllFormedAttributeInputHelp {
111    pub lint: String,
112}
113
114#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EmptyAttributeList where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
115#[diag("unused attribute")]
116#[note(
117    "{$valid_without_list ->
118        [true] using `{$attr_path}` with an empty list is equivalent to not using a list at all
119        *[other] using `{$attr_path}` with an empty list has no effect
120    }"
121)]
122pub(crate) struct EmptyAttributeList {
123    #[suggestion(
124        "{$valid_without_list ->
125            [true] remove these parentheses
126            *[other] remove this attribute
127        }",
128        code = "",
129        applicability = "machine-applicable"
130    )]
131    pub attr_span: Span,
132    pub attr_path: String,
133    pub valid_without_list: bool,
134}
135
136#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidAttrStyle where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
137#[diag(
138    "{$is_used_as_inner ->
139        [false] crate-level attribute should be an inner attribute: add an exclamation mark: `#![{$name}]`
140        *[other] the `#![{$name}]` attribute can only be used at the crate root
141    }"
142)]
143pub(crate) struct InvalidAttrStyle {
144    pub name: String,
145    pub is_used_as_inner: bool,
146    #[note("this attribute does not have an `!`, which means it is applied to this {$target}")]
147    pub target_span: Option<Span>,
148    pub target: &'static str,
149    pub crate_root_path: String,
150    #[help("the crate root is at `{$crate_root_path}`")]
151    pub show_crate_root_help: bool,
152    #[primary_span]
153    pub span: Span,
154}
155
156#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAliasDuplicated where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
157#[diag("doc alias is duplicated")]
158pub(crate) struct DocAliasDuplicated {
159    #[label("first defined here")]
160    pub first_definition: Span,
161}
162
163#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAutoCfgExpectsHideOrShow where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
164#[diag("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")]
165pub(crate) struct DocAutoCfgExpectsHideOrShow;
166
167#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AmbiguousDeriveHelpers where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
168#[diag("there exists a built-in attribute with the same name")]
169pub(crate) struct AmbiguousDeriveHelpers;
170
171#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAutoCfgHideShowUnexpectedItem where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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 key/value items")));
                        ;
                        diag.arg("attr_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
172#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items")]
173pub(crate) struct DocAutoCfgHideShowUnexpectedItem {
174    pub attr_name: Symbol,
175}
176
177#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAutoCfgHideShowExpectsList where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
178#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")]
179pub(crate) struct DocAutoCfgHideShowExpectsList {
180    pub attr_name: Symbol,
181}
182
183#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocUnknownInclude where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
184#[diag("unknown `doc` attribute `include`")]
185pub(crate) struct DocUnknownInclude {
186    pub inner: &'static str,
187    pub value: Symbol,
188    #[suggestion(
189        "use `doc = include_str!` instead",
190        code = "#{inner}[doc = include_str!(\"{value}\")]"
191    )]
192    pub sugg: (Span, Applicability),
193}
194
195#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocUnknownSpotlight where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
196#[diag("unknown `doc` attribute `spotlight`")]
197#[note("`doc(spotlight)` was renamed to `doc(notable_trait)`")]
198#[note("`doc(spotlight)` is now a no-op")]
199pub(crate) struct DocUnknownSpotlight {
200    #[suggestion(
201        "use `notable_trait` instead",
202        style = "short",
203        applicability = "machine-applicable",
204        code = "notable_trait"
205    )]
206    pub sugg_span: Span,
207}
208
209#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocUnknownPasses where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
210#[diag("unknown `doc` attribute `{$name}`")]
211#[note(
212    "`doc` attribute `{$name}` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>"
213)]
214#[note("`doc({$name})` is now a no-op")]
215pub(crate) struct DocUnknownPasses {
216    pub name: Symbol,
217    #[label("no longer functions")]
218    pub note_span: Span,
219}
220
221#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocUnknownPlugins where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
222#[diag("unknown `doc` attribute `plugins`")]
223#[note(
224    "`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>"
225)]
226#[note("`doc(plugins)` is now a no-op")]
227pub(crate) struct DocUnknownPlugins {
228    #[label("no longer functions")]
229    pub label_span: Span,
230}
231
232#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for DocUnknownAny
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
233#[diag("unknown `doc` attribute `{$name}`")]
234pub(crate) struct DocUnknownAny {
235    pub name: Symbol,
236}
237
238#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAutoCfgWrongLiteral where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
239#[diag("expected boolean for `#[doc(auto_cfg = ...)]`")]
240pub(crate) struct DocAutoCfgWrongLiteral;
241
242#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocTestTakesList where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
243#[diag("`#[doc(test(...)]` takes a list of attributes")]
244pub(crate) struct DocTestTakesList;
245
246#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for DocTestUnknown
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
247#[diag("unknown `doc(test)` attribute `{$name}`")]
248pub(crate) struct DocTestUnknown {
249    pub name: Symbol,
250}
251
252#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for DocTestLiteral
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
253#[diag("`#![doc(test(...)]` does not take a literal")]
254pub(crate) struct DocTestLiteral;
255
256#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AttrCrateLevelOnly where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
257#[diag("this attribute can only be applied at the crate level")]
258#[note(
259    "read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information"
260)]
261pub(crate) struct AttrCrateLevelOnly;
262
263#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DoNotRecommendDoesNotExpectArgs where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
264#[diag("`#[diagnostic::do_not_recommend]` does not expect any arguments")]
265pub(crate) struct DoNotRecommendDoesNotExpectArgs;
266
267#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownCrateTypes where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
268#[diag("invalid `crate_type` value")]
269pub(crate) struct UnknownCrateTypes {
270    #[subdiagnostic]
271    pub sugg: Option<UnknownCrateTypesSuggestion>,
272}
273
274#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnknownCrateTypesSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
275#[suggestion("did you mean", code = r#""{snippet}""#, applicability = "maybe-incorrect")]
276pub(crate) struct UnknownCrateTypesSuggestion {
277    #[primary_span]
278    pub span: Span,
279    pub snippet: Symbol,
280}
281
282#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MalformedDoc
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
283#[diag("malformed `doc` attribute input")]
284#[warning(
285    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
286)]
287pub(crate) struct MalformedDoc;
288
289#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for ExpectedNoArgs
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
290#[diag("didn't expect any arguments here")]
291#[warning(
292    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
293)]
294pub(crate) struct ExpectedNoArgs;
295
296#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExpectedNameValue where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
297#[diag("expected this to be of the form `... = \"...\"`")]
298#[warning(
299    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
300)]
301pub(crate) struct ExpectedNameValue;
302
303#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MalFormedDiagnosticAttributeLint where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
304#[diag("malformed `{$attribute}` attribute")]
305#[help("{$options}")]
306pub(crate) struct MalFormedDiagnosticAttributeLint {
307    pub attribute: &'static str,
308    pub options: &'static str,
309    #[label("invalid option found here")]
310    pub span: Span,
311}
312
313#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            WrappedParserError where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
314#[diag("{$description}")]
315pub(crate) struct WrappedParserError {
316    pub description: String,
317    #[label("{$label}")]
318    pub span: Span,
319    pub label: String,
320}
321
322#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IgnoredDiagnosticOption where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
323#[diag("`{$option_name}` is ignored due to previous definition of `{$option_name}`")]
324pub(crate) struct IgnoredDiagnosticOption {
325    pub option_name: Symbol,
326    #[label("`{$option_name}` is first declared here")]
327    pub first_span: Span,
328    #[label("`{$option_name}` is later redundantly declared here")]
329    pub later_span: Span,
330}
331
332#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingOptionsForDiagnosticAttribute where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
333#[diag("missing options for `{$attribute}` attribute")]
334#[help("{$options}")]
335pub(crate) struct MissingOptionsForDiagnosticAttribute {
336    pub attribute: &'static str,
337    pub options: &'static str,
338}
339
340#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NonMetaItemDiagnosticAttribute where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
341#[diag("expected a literal or missing delimiter")]
342#[help(
343    "only literals are allowed as values for the `message`, `note` and `label` options. These options must be separated by a comma"
344)]
345pub(crate) struct NonMetaItemDiagnosticAttribute;
346
347#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for FormatWarning
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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]
impl ::core::clone::Clone for FormatWarning {
    #[inline]
    fn clone(&self) -> FormatWarning {
        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)]
348pub(crate) enum FormatWarning {
349    #[diag("positional arguments are not permitted in diagnostic attributes")]
350    #[help("you can print empty braces by escaping them")]
351    PositionalArgument {
352        #[label("remove this format argument")]
353        span: Span,
354    },
355
356    #[diag("indexed format arguments are not permitted in diagnostic attributes")]
357    IndexedArgument {
358        #[label("remove this format argument")]
359        span: Span,
360    },
361
362    #[diag("format specifiers are not permitted in diagnostic attributes")]
363    InvalidSpecifier {
364        #[label("remove this format specifier")]
365        span: Span,
366    },
367
368    #[diag("this format argument is not allowed in `#[{$attr}]`")]
369    #[note("{$allowed}")]
370    DisallowedPlaceholder {
371        #[label("remove this format argument")]
372        span: Span,
373        attr: &'static str,
374        allowed: &'static str,
375    },
376}
377
378#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgCargoHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
379pub(crate) enum UnexpectedCfgCargoHelp {
380    #[help("consider using a Cargo feature instead")]
381    #[help(
382        "or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}"
383    )]
384    LintCfg { cargo_toml_lint_cfg: String },
385    #[help("consider using a Cargo feature instead")]
386    #[help(
387        "or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg}"
388    )]
389    #[help("or consider adding `{$build_rs_println}` to the top of the `build.rs`")]
390    LintCfgAndBuildRs { cargo_toml_lint_cfg: String, build_rs_println: String },
391}
392
393impl UnexpectedCfgCargoHelp {
394    fn cargo_toml_lint_cfg(unescaped: &str) -> String {
395        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = [\'{0}\'] }}",
                unescaped))
    })format!(
396            "\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = ['{unescaped}'] }}"
397        )
398    }
399
400    pub(crate) fn lint_cfg(unescaped: &str) -> Self {
401        UnexpectedCfgCargoHelp::LintCfg {
402            cargo_toml_lint_cfg: Self::cargo_toml_lint_cfg(unescaped),
403        }
404    }
405
406    pub(crate) fn lint_cfg_and_build_rs(unescaped: &str, escaped: &str) -> Self {
407        UnexpectedCfgCargoHelp::LintCfgAndBuildRs {
408            cargo_toml_lint_cfg: Self::cargo_toml_lint_cfg(unescaped),
409            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}\");"),
410        }
411    }
412}
413
414#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgRustcHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
415#[help("to expect this configuration use `{$cmdline_arg}`")]
416pub(crate) struct UnexpectedCfgRustcHelp {
417    pub cmdline_arg: String,
418}
419
420impl UnexpectedCfgRustcHelp {
421    pub(crate) fn new(unescaped: &str) -> Self {
422        Self { cmdline_arg: ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("--check-cfg={0}", unescaped))
    })format!("--check-cfg={unescaped}") }
423    }
424}
425
426#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgRustcMacroHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
427#[note(
428    "using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate"
429)]
430#[help("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")]
431pub(crate) struct UnexpectedCfgRustcMacroHelp {
432    pub macro_kind: &'static str,
433    pub macro_name: Symbol,
434}
435
436#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnexpectedCfgCargoMacroHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
437#[note(
438    "using a cfg inside a {$macro_kind} will use the cfgs from the destination crate and not the ones from the defining crate"
439)]
440#[help("try referring to `{$macro_name}` crate for guidance on how handle this unexpected cfg")]
441pub(crate) struct UnexpectedCfgCargoMacroHelp {
442    pub macro_kind: &'static str,
443    pub macro_name: Symbol,
444}
445
446#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnexpectedCfgName where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
447#[diag("unexpected `cfg` condition name: `{$name}`")]
448pub(crate) struct UnexpectedCfgName {
449    #[subdiagnostic]
450    pub code_sugg: unexpected_cfg_name::CodeSuggestion,
451    #[subdiagnostic]
452    pub invocation_help: unexpected_cfg_name::InvocationHelp,
453
454    pub name: Symbol,
455}
456
457pub(crate) mod unexpected_cfg_name {
458    use rustc_errors::DiagSymbolList;
459    use rustc_macros::Subdiagnostic;
460    use rustc_span::{Ident, Span, Symbol};
461
462    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CodeSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
463    pub(crate) enum CodeSuggestion {
464        #[help("consider defining some features in `Cargo.toml`")]
465        DefineFeatures,
466        #[multipart_suggestion(
467            "there is a similar config predicate: `version(\"..\")`",
468            applicability = "machine-applicable"
469        )]
470        VersionSyntax {
471            #[suggestion_part(code = "(")]
472            between_name_and_value: Span,
473            #[suggestion_part(code = ")")]
474            after_value: Span,
475        },
476        #[suggestion(
477            "there is a config with a similar name and value",
478            applicability = "maybe-incorrect",
479            code = "{code}"
480        )]
481        SimilarNameAndValue {
482            #[primary_span]
483            span: Span,
484            code: String,
485        },
486        #[suggestion(
487            "there is a config with a similar name and no value",
488            applicability = "maybe-incorrect",
489            code = "{code}"
490        )]
491        SimilarNameNoValue {
492            #[primary_span]
493            span: Span,
494            code: String,
495        },
496        #[suggestion(
497            "there is a config with a similar name and different values",
498            applicability = "maybe-incorrect",
499            code = "{code}"
500        )]
501        SimilarNameDifferentValues {
502            #[primary_span]
503            span: Span,
504            code: String,
505            #[subdiagnostic]
506            expected: Option<ExpectedValues>,
507        },
508        #[suggestion(
509            "there is a config with a similar name",
510            applicability = "maybe-incorrect",
511            code = "{code}"
512        )]
513        SimilarName {
514            #[primary_span]
515            span: Span,
516            code: String,
517            #[subdiagnostic]
518            expected: Option<ExpectedValues>,
519        },
520        SimilarValues {
521            #[subdiagnostic]
522            with_similar_values: Vec<FoundWithSimilarValue>,
523            #[subdiagnostic]
524            expected_names: Option<ExpectedNames>,
525        },
526        #[suggestion(
527            "you may have meant to use `{$literal}` (notice the capitalization). Doing so makes this predicate evaluate to `{$literal}` unconditionally",
528            applicability = "machine-applicable",
529            style = "verbose",
530            code = "{literal}"
531        )]
532        BooleanLiteral {
533            #[primary_span]
534            span: Span,
535            literal: bool,
536        },
537    }
538
539    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectedValues {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
540    #[help("expected values for `{$best_match}` are: {$possibilities}")]
541    pub(crate) struct ExpectedValues {
542        pub best_match: Symbol,
543        pub possibilities: DiagSymbolList,
544    }
545
546    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for FoundWithSimilarValue {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
547    #[suggestion(
548        "found config with similar value",
549        applicability = "maybe-incorrect",
550        code = "{code}"
551    )]
552    pub(crate) struct FoundWithSimilarValue {
553        #[primary_span]
554        pub span: Span,
555        pub code: String,
556    }
557
558    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectedNames {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
559    #[help_once(
560        "expected names are: {$possibilities}{$and_more ->
561            [0] {\"\"}
562            *[other] {\" \"}and {$and_more} more
563        }"
564    )]
565    pub(crate) struct ExpectedNames {
566        pub possibilities: DiagSymbolList<Ident>,
567        pub and_more: usize,
568    }
569
570    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvocationHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
571    pub(crate) enum InvocationHelp {
572        #[note(
573            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration"
574        )]
575        Cargo {
576            #[subdiagnostic]
577            macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
578            #[subdiagnostic]
579            help: Option<super::UnexpectedCfgCargoHelp>,
580        },
581        #[note(
582            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration"
583        )]
584        Rustc {
585            #[subdiagnostic]
586            macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
587            #[subdiagnostic]
588            help: super::UnexpectedCfgRustcHelp,
589        },
590    }
591}
592
593#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnexpectedCfgValue where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
594#[diag(
595    "unexpected `cfg` condition value: {$has_value ->
596        [true] `{$value}`
597        *[false] (none)
598    }"
599)]
600pub(crate) struct UnexpectedCfgValue {
601    #[subdiagnostic]
602    pub code_sugg: unexpected_cfg_value::CodeSuggestion,
603    #[subdiagnostic]
604    pub invocation_help: unexpected_cfg_value::InvocationHelp,
605
606    pub has_value: bool,
607    pub value: String,
608}
609
610pub(crate) mod unexpected_cfg_value {
611    use rustc_errors::DiagSymbolList;
612    use rustc_macros::Subdiagnostic;
613    use rustc_span::{Span, Symbol};
614
615    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CodeSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
616    pub(crate) enum CodeSuggestion {
617        ChangeValue {
618            #[subdiagnostic]
619            expected_values: ExpectedValues,
620            #[subdiagnostic]
621            suggestion: Option<ChangeValueSuggestion>,
622        },
623        #[note("no expected value for `{$name}`")]
624        RemoveValue {
625            #[subdiagnostic]
626            suggestion: Option<RemoveValueSuggestion>,
627
628            name: Symbol,
629        },
630        #[note("no expected values for `{$name}`")]
631        RemoveCondition {
632            #[subdiagnostic]
633            suggestion: RemoveConditionSuggestion,
634
635            name: Symbol,
636        },
637        ChangeName {
638            #[subdiagnostic]
639            suggestions: Vec<ChangeNameSuggestion>,
640        },
641    }
642
643    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ChangeValueSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
644    pub(crate) enum ChangeValueSuggestion {
645        #[suggestion(
646            "there is a expected value with a similar name",
647            code = r#""{best_match}""#,
648            applicability = "maybe-incorrect"
649        )]
650        SimilarName {
651            #[primary_span]
652            span: Span,
653            best_match: Symbol,
654        },
655        #[suggestion(
656            "specify a config value",
657            code = r#" = "{first_possibility}""#,
658            applicability = "maybe-incorrect"
659        )]
660        SpecifyValue {
661            #[primary_span]
662            span: Span,
663            first_possibility: Symbol,
664        },
665    }
666
667    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RemoveValueSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
668    #[suggestion("remove the value", code = "", applicability = "maybe-incorrect")]
669    pub(crate) struct RemoveValueSuggestion {
670        #[primary_span]
671        pub span: Span,
672    }
673
674    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for RemoveConditionSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
675    #[suggestion("remove the condition", code = "", applicability = "maybe-incorrect")]
676    pub(crate) struct RemoveConditionSuggestion {
677        #[primary_span]
678        pub span: Span,
679    }
680
681    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExpectedValues {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
682    #[note(
683        "expected values for `{$name}` are: {$have_none_possibility ->
684            [true] {\"(none), \"}
685            *[false] {\"\"}
686        }{$possibilities}{$and_more ->
687            [0] {\"\"}
688            *[other] {\" \"}and {$and_more} more
689        }"
690    )]
691    pub(crate) struct ExpectedValues {
692        pub name: Symbol,
693        pub have_none_possibility: bool,
694        pub possibilities: DiagSymbolList,
695        pub and_more: usize,
696    }
697
698    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ChangeNameSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
699    #[suggestion(
700        "`{$value}` is an expected value for `{$name}`",
701        code = "{name}",
702        applicability = "maybe-incorrect",
703        style = "verbose"
704    )]
705    pub(crate) struct ChangeNameSuggestion {
706        #[primary_span]
707        pub span: Span,
708        pub name: Symbol,
709        pub value: Symbol,
710    }
711
712    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvocationHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
713    pub(crate) enum InvocationHelp {
714        #[note(
715            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration"
716        )]
717        Cargo {
718            #[subdiagnostic]
719            help: Option<CargoHelp>,
720            #[subdiagnostic]
721            macro_help: Option<super::UnexpectedCfgCargoMacroHelp>,
722        },
723        #[note(
724            "see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration"
725        )]
726        Rustc {
727            #[subdiagnostic]
728            help: Option<super::UnexpectedCfgRustcHelp>,
729            #[subdiagnostic]
730            macro_help: Option<super::UnexpectedCfgRustcMacroHelp>,
731        },
732    }
733
734    #[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CargoHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                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)]
735    pub(crate) enum CargoHelp {
736        #[help("consider adding `{$value}` as a feature in `Cargo.toml`")]
737        AddFeature {
738            value: Symbol,
739        },
740        #[help("consider defining some features in `Cargo.toml`")]
741        DefineFeatures,
742        Other(#[subdiagnostic] super::UnexpectedCfgCargoHelp),
743    }
744}
745
746#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidOnClause where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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.code(E0232);
                        ;
                        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.code(E0232);
                        ;
                        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.code(E0232);
                        ;
                        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.code(E0232);
                        ;
                        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.code(E0232);
                        ;
                        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.code(E0232);
                        ;
                        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)]
747pub(crate) enum InvalidOnClause {
748    #[diag("empty `on`-clause in `#[rustc_on_unimplemented]`", code = E0232)]
749    Empty {
750        #[primary_span]
751        #[label("empty `on`-clause here")]
752        span: Span,
753    },
754    #[diag("expected a single predicate in `not(..)`", code = E0232)]
755    ExpectedOnePredInNot {
756        #[primary_span]
757        #[label("unexpected quantity of predicates here")]
758        span: Span,
759    },
760    #[diag("literals inside `on`-clauses are not supported", code = E0232)]
761    UnsupportedLiteral {
762        #[primary_span]
763        #[label("unexpected literal here")]
764        span: Span,
765    },
766    #[diag("expected an identifier inside this `on`-clause", code = E0232)]
767    ExpectedIdentifier {
768        #[primary_span]
769        #[label("expected an identifier here, not `{$path}`")]
770        span: Span,
771        path: AttrPath,
772    },
773    #[diag("this predicate is invalid", code = E0232)]
774    InvalidPredicate {
775        #[primary_span]
776        #[label("expected one of `any`, `all` or `not` here, not `{$invalid_pred}`")]
777        span: Span,
778        invalid_pred: Symbol,
779    },
780    #[diag("invalid flag in `on`-clause", code = E0232)]
781    InvalidFlag {
782        #[primary_span]
783        #[label(
784            "expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `{$invalid_flag}`"
785        )]
786        span: Span,
787        invalid_flag: Symbol,
788    },
789}
790
791#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DupesNotAllowed where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DupesNotAllowed => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using multiple `rustc_on_unimplemented` (or mixing it with `diagnostic::on_unimplemented`) is not supported")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
792#[diag(
793    "using multiple `rustc_on_unimplemented` (or mixing it with `diagnostic::on_unimplemented`) is not supported"
794)]
795pub(crate) struct DupesNotAllowed;
796
797#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeAttribute where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                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)]
798#[diag("usage of the unsafe `#[{$attr_path}]` attribute")]
799#[note("{$note}")]
800pub(crate) struct UnsafeAttribute {
801    pub attr_path: AttrPath,
802    pub note: &'static str,
803}
804
805#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownExternLangItem where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnknownExternLangItem {
                        span: __binding_0, lang_item: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown external lang item: `{$lang_item}`")));
                        diag.code(E0264);
                        ;
                        diag.arg("lang_item", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
806#[diag("unknown external lang item: `{$lang_item}`", code = E0264)]
807pub(crate) struct UnknownExternLangItem {
808    #[primary_span]
809    pub span: Span,
810    pub lang_item: Symbol,
811}