Skip to main content

rustc_attr_parsing/
errors.rs

1use rustc_errors::{Applicability, DiagArgValue, MultiSpan};
2use rustc_macros::{Diagnostic, Subdiagnostic};
3use rustc_span::{Span, Symbol};
4
5#[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)]
6#[diag("`{$name}` attribute cannot be used at crate level")]
7pub(crate) struct InvalidAttrAtCrateLevel {
8    #[primary_span]
9    pub span: Span,
10    #[suggestion(
11        "perhaps you meant to use an outer attribute",
12        code = "#[",
13        applicability = "machine-applicable",
14        style = "verbose"
15    )]
16    pub pound_to_opening_bracket: Span,
17    pub name: Symbol,
18    #[subdiagnostic]
19    pub item: Option<ItemFollowingInnerAttr>,
20}
21
22#[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)]
23#[label("the inner attribute doesn't annotate this item")]
24pub(crate) struct ItemFollowingInnerAttr {
25    #[primary_span]
26    pub span: Span,
27}
28
29#[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)]
30#[diag("unreachable configuration predicate")]
31pub(crate) struct UnreachableCfgSelectPredicate {
32    #[label("this configuration predicate is never reached")]
33    pub span: Span,
34}
35
36#[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)]
37#[diag("most attributes are not supported in `where` clauses")]
38#[help("only `#[cfg]` and `#[cfg_attr]` are supported")]
39pub(crate) struct UnsupportedAttributesInWhere {
40    #[primary_span]
41    pub span: MultiSpan,
42}
43
44#[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)]
45#[diag("unreachable configuration predicate")]
46pub(crate) struct UnreachableCfgSelectPredicateWildcard {
47    #[label("this configuration predicate is never reached")]
48    pub span: Span,
49
50    #[label("always matches")]
51    pub wildcard_span: Span,
52}
53
54#[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)]
55#[diag("must be a name of an associated function")]
56pub(crate) struct MustBeNameOfAssociatedFunction {
57    #[primary_span]
58    pub span: Span,
59}
60
61#[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)]
62#[diag("unsafe attribute used without unsafe")]
63pub(crate) struct UnsafeAttrOutsideUnsafeLint {
64    #[label("usage of unsafe attribute")]
65    pub span: Span,
66    #[subdiagnostic]
67    pub suggestion: Option<crate::session_diagnostics::UnsafeAttrOutsideUnsafeSuggestion>,
68}
69
70#[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)]
71#[diag(
72    "{$num_suggestions ->
73        [1] attribute must be of the form {$suggestions}
74        *[other] valid forms for the attribute are {$suggestions}
75    }"
76)]
77pub(crate) struct IllFormedAttributeInput {
78    pub num_suggestions: usize,
79    pub suggestions: DiagArgValue,
80    #[note("for more information, visit <{$docs}>")]
81    pub has_docs: bool,
82    pub docs: &'static str,
83    #[subdiagnostic]
84    help: Option<IllFormedAttributeInputHelp>,
85}
86
87impl IllFormedAttributeInput {
88    pub(crate) fn new(
89        suggestions: &[String],
90        docs: Option<&'static str>,
91        help: Option<&str>,
92    ) -> Self {
93        Self {
94            num_suggestions: suggestions.len(),
95            suggestions: DiagArgValue::StrListSepByAnd(
96                suggestions.into_iter().map(|s| ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("`{0}`", s))
    })format!("`{s}`").into()).collect(),
97            ),
98            has_docs: docs.is_some(),
99            docs: docs.unwrap_or(""),
100            help: help.map(|h| IllFormedAttributeInputHelp { lint: h.to_string() }),
101        }
102    }
103}
104
105#[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)]
106#[help(
107    "if you meant to silence a warning, consider using #![allow({$lint})] or #![expect({$lint})]"
108)]
109struct IllFormedAttributeInputHelp {
110    pub lint: String,
111}
112
113#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            EmptyAttributeList<'a> where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    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)]
114#[diag("unused attribute")]
115#[note(
116    "{$valid_without_list ->
117        [true] using `{$attr_path}` with an empty list is equivalent to not using a list at all
118        *[other] using `{$attr_path}` with an empty list has no effect
119    }"
120)]
121pub(crate) struct EmptyAttributeList<'a> {
122    #[suggestion(
123        "{$valid_without_list ->
124            [true] remove these parentheses
125            *[other] remove this attribute
126        }",
127        code = "",
128        applicability = "machine-applicable"
129    )]
130    pub attr_span: Span,
131    pub attr_path: &'a str,
132    pub valid_without_list: bool,
133}
134
135#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidTargetLint where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidTargetLint {
                        name: __binding_0,
                        target: __binding_1,
                        applied: __binding_2,
                        only: __binding_3,
                        attr_span: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` attribute cannot be used on {$target}")));
                        let __code_2 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` can {$only}be applied to {$applied}")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.arg("target", __binding_1);
                        diag.arg("applied", __binding_2);
                        diag.arg("only", __binding_3);
                        diag.span_suggestions_with_style(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
                            __code_2, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
136#[diag("`#[{$name}]` attribute cannot be used on {$target}")]
137#[warning(
138    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
139)]
140#[help("`#[{$name}]` can {$only}be applied to {$applied}")]
141pub(crate) struct InvalidTargetLint {
142    pub name: String,
143    pub target: &'static str,
144    pub applied: DiagArgValue,
145    pub only: &'static str,
146    #[suggestion(
147        "remove the attribute",
148        code = "",
149        applicability = "machine-applicable",
150        style = "tool-only"
151    )]
152    pub attr_span: Span,
153}
154
155#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidAttrStyle<'a> where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidAttrStyle {
                        name: __binding_0,
                        is_used_as_inner: __binding_1,
                        target_span: __binding_2,
                        target: __binding_3 } => {
                        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);
                        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}")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
156#[diag(
157    "{$is_used_as_inner ->
158        [false] crate-level attribute should be an inner attribute: add an exclamation mark: `#![{$name}]`
159        *[other] the `#![{$name}]` attribute can only be used at the crate root
160    }"
161)]
162pub(crate) struct InvalidAttrStyle<'a> {
163    pub name: &'a str,
164    pub is_used_as_inner: bool,
165    #[note("this attribute does not have an `!`, which means it is applied to this {$target}")]
166    pub target_span: Option<Span>,
167    pub target: &'static str,
168}
169
170#[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)]
171#[diag("doc alias is duplicated")]
172pub(crate) struct DocAliasDuplicated {
173    #[label("first defined here")]
174    pub first_definition: Span,
175}
176
177#[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)]
178#[diag("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")]
179pub(crate) struct DocAutoCfgExpectsHideOrShow;
180
181#[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)]
182#[diag("there exists a built-in attribute with the same name")]
183pub(crate) struct AmbiguousDeriveHelpers;
184
185#[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)]
186#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items")]
187pub(crate) struct DocAutoCfgHideShowUnexpectedItem {
188    pub attr_name: Symbol,
189}
190
191#[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)]
192#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")]
193pub(crate) struct DocAutoCfgHideShowExpectsList {
194    pub attr_name: Symbol,
195}
196
197#[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_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("#{0}[doc = include_str!(\"{1}\")]",
                                                        __binding_0, __binding_1))
                                            })].into_iter();
                        ;
                        diag.arg("inner", __binding_0);
                        diag.arg("value", __binding_1);
                        diag.span_suggestions_with_style(__binding_2.0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `doc = include_str!` instead")),
                            __code_3, __binding_2.1,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
198#[diag("unknown `doc` attribute `include`")]
199pub(crate) struct DocUnknownInclude {
200    pub inner: &'static str,
201    pub value: Symbol,
202    #[suggestion(
203        "use `doc = include_str!` instead",
204        code = "#{inner}[doc = include_str!(\"{value}\")]"
205    )]
206    pub sugg: (Span, Applicability),
207}
208
209#[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_4 =
                            [::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_4, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
210#[diag("unknown `doc` attribute `spotlight`")]
211#[note("`doc(spotlight)` was renamed to `doc(notable_trait)`")]
212#[note("`doc(spotlight)` is now a no-op")]
213pub(crate) struct DocUnknownSpotlight {
214    #[suggestion(
215        "use `notable_trait` instead",
216        style = "short",
217        applicability = "machine-applicable",
218        code = "notable_trait"
219    )]
220    pub sugg_span: Span,
221}
222
223#[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)]
224#[diag("unknown `doc` attribute `{$name}`")]
225#[note(
226    "`doc` attribute `{$name}` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>"
227)]
228#[note("`doc({$name})` is now a no-op")]
229pub(crate) struct DocUnknownPasses {
230    pub name: Symbol,
231    #[label("no longer functions")]
232    pub note_span: Span,
233}
234
235#[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)]
236#[diag("unknown `doc` attribute `plugins`")]
237#[note(
238    "`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>"
239)]
240#[note("`doc(plugins)` is now a no-op")]
241pub(crate) struct DocUnknownPlugins {
242    #[label("no longer functions")]
243    pub label_span: Span,
244}
245
246#[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)]
247#[diag("unknown `doc` attribute `{$name}`")]
248pub(crate) struct DocUnknownAny {
249    pub name: Symbol,
250}
251
252#[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)]
253#[diag("expected boolean for `#[doc(auto_cfg = ...)]`")]
254pub(crate) struct DocAutoCfgWrongLiteral;