Skip to main content

rustc_attr_parsing/
session_diagnostics.rs

1use std::num::IntErrorKind;
2
3use rustc_errors::codes::*;
4use rustc_errors::{
5    Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
6};
7use rustc_hir::AttrPath;
8use rustc_hir::attrs::{MirDialect, MirPhase};
9use rustc_macros::{Diagnostic, Subdiagnostic};
10use rustc_span::{Span, Symbol};
11use rustc_target::spec::TargetTuple;
12
13use crate::AttributeTemplate;
14use crate::context::Suggestion;
15
16#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BothFfiConstAndPure where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BothFfiConstAndPure { attr_span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[ffi_const]` function cannot be `#[ffi_pure]`")));
                        diag.code(E0757);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
17#[diag("`#[ffi_const]` function cannot be `#[ffi_pure]`", code = E0757)]
18pub(crate) struct BothFfiConstAndPure {
19    #[primary_span]
20    pub attr_span: Span,
21}
22
23#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAliasEmpty<'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 {
                    DocAliasEmpty { span: __binding_0, attr_str: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$attr_str} attribute cannot have empty value")));
                        ;
                        diag.arg("attr_str", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
24#[diag("{$attr_str} attribute cannot have empty value")]
25pub(crate) struct DocAliasEmpty<'a> {
26    #[primary_span]
27    pub span: Span,
28    pub attr_str: &'a str,
29}
30
31#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAliasBadChar<'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 {
                    DocAliasBadChar {
                        span: __binding_0, attr_str: __binding_1, char_: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$char_} character isn't allowed in {$attr_str}")));
                        ;
                        diag.arg("attr_str", __binding_1);
                        diag.arg("char_", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
32#[diag("{$char_} character isn't allowed in {$attr_str}")]
33pub(crate) struct DocAliasBadChar<'a> {
34    #[primary_span]
35    pub span: Span,
36    pub attr_str: &'a str,
37    pub char_: char,
38}
39
40#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAliasStartEnd<'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 {
                    DocAliasStartEnd { span: __binding_0, attr_str: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$attr_str} cannot start or end with ' '")));
                        ;
                        diag.arg("attr_str", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
41#[diag("{$attr_str} cannot start or end with ' '")]
42pub(crate) struct DocAliasStartEnd<'a> {
43    #[primary_span]
44    pub span: Span,
45    pub attr_str: &'a str,
46}
47
48#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            CguFieldsMissing<'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 {
                    CguFieldsMissing {
                        span: __binding_0, name: __binding_1, field: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name})]` is missing a `{$field}` argument")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("field", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
49#[diag("`#[{$name})]` is missing a `{$field}` argument")]
50pub(crate) struct CguFieldsMissing<'a> {
51    #[primary_span]
52    pub span: Span,
53    pub name: &'a AttrPath,
54    pub field: Symbol,
55}
56
57#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAttrNotCrateLevel 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 {
                    DocAttrNotCrateLevel {
                        span: __binding_0, attr_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc({$attr_name} = \"...\")]` isn't allowed as a crate-level attribute")));
                        ;
                        diag.arg("attr_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
58#[diag("`#![doc({$attr_name} = \"...\")]` isn't allowed as a crate-level attribute")]
59pub(crate) struct DocAttrNotCrateLevel {
60    #[primary_span]
61    pub span: Span,
62    pub attr_name: Symbol,
63}
64
65#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocKeywordNotKeyword 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 {
                    DocKeywordNotKeyword {
                        span: __binding_0, keyword: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nonexistent keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only existing keywords are allowed in core/std")));
                        ;
                        diag.arg("keyword", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
66#[diag("nonexistent keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`")]
67#[help("only existing keywords are allowed in core/std")]
68pub(crate) struct DocKeywordNotKeyword {
69    #[primary_span]
70    pub span: Span,
71    pub keyword: Symbol,
72}
73
74#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAttributeNotAttribute 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 {
                    DocAttributeNotAttribute {
                        span: __binding_0, attribute: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = \"...\")]`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only existing builtin attributes are allowed in core/std")));
                        ;
                        diag.arg("attribute", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
75#[diag("nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = \"...\")]`")]
76#[help("only existing builtin attributes are allowed in core/std")]
77pub(crate) struct DocAttributeNotAttribute {
78    #[primary_span]
79    pub span: Span,
80    pub attribute: Symbol,
81}
82
83#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TargetFeatureOnLangItem 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 {
                    TargetFeatureOnLangItem {
                        attr_span: __binding_0,
                        kind: __binding_1,
                        item_span: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[target_feature]` cannot be applied to a {$kind ->\n        [panic_handler] `#[panic_handler]`\n        *[other] lang item\n    } function")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$kind ->\n            [panic_handler] `#[panic_handler]`\n            *[other] lang item\n        } function is not allowed to have `#[target_feature]`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
84#[diag(
85    "`#[target_feature]` cannot be applied to a {$kind ->
86        [panic_handler] `#[panic_handler]`
87        *[other] lang item
88    } function"
89)]
90pub(crate) struct TargetFeatureOnLangItem {
91    #[primary_span]
92    pub attr_span: Span,
93    pub kind: Symbol,
94    #[label(
95        "{$kind ->
96            [panic_handler] `#[panic_handler]`
97            *[other] lang item
98        } function is not allowed to have `#[target_feature]`"
99    )]
100    pub item_span: Span,
101}
102
103#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MissingSince
            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 {
                    MissingSince { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'since'")));
                        diag.code(E0542);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
104#[diag("missing 'since'", code = E0542)]
105pub(crate) struct MissingSince {
106    #[primary_span]
107    pub span: Span,
108}
109
110#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MissingNote
            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 {
                    MissingNote { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'note'")));
                        diag.code(E0543);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
111#[diag("missing 'note'", code = E0543)]
112pub(crate) struct MissingNote {
113    #[primary_span]
114    pub span: Span,
115}
116
117#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleStabilityLevels 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 {
                    MultipleStabilityLevels { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple stability levels")));
                        diag.code(E0544);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
118#[diag("multiple stability levels", code = E0544)]
119pub(crate) struct MultipleStabilityLevels {
120    #[primary_span]
121    pub span: Span,
122}
123
124#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidIssueString 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 {
                    InvalidIssueString { span: __binding_0, cause: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`issue` must be a non-zero numeric string or \"none\"")));
                        diag.code(E0545);
                        ;
                        diag.span(__binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
125#[diag("`issue` must be a non-zero numeric string or \"none\"", code = E0545)]
126pub(crate) struct InvalidIssueString {
127    #[primary_span]
128    pub span: Span,
129
130    #[subdiagnostic]
131    pub cause: Option<InvalidIssueStringCause>,
132}
133
134// The error kinds of `IntErrorKind` are duplicated here in order to allow the messages to be
135// translatable.
136#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidIssueStringCause {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InvalidIssueStringCause::MustNotBeZero { span: __binding_0 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`issue` must not be \"0\", use \"none\" instead")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    InvalidIssueStringCause::Empty { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot parse integer from empty string")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    InvalidIssueStringCause::InvalidDigit { span: __binding_0 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid digit found in string")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    InvalidIssueStringCause::PosOverflow { span: __binding_0 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("number too large to fit in target type")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    InvalidIssueStringCause::NegOverflow { span: __binding_0 }
                        => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("number too small to fit in target type")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
137pub(crate) enum InvalidIssueStringCause {
138    #[label("`issue` must not be \"0\", use \"none\" instead")]
139    MustNotBeZero {
140        #[primary_span]
141        span: Span,
142    },
143
144    #[label("cannot parse integer from empty string")]
145    Empty {
146        #[primary_span]
147        span: Span,
148    },
149
150    #[label("invalid digit found in string")]
151    InvalidDigit {
152        #[primary_span]
153        span: Span,
154    },
155
156    #[label("number too large to fit in target type")]
157    PosOverflow {
158        #[primary_span]
159        span: Span,
160    },
161
162    #[label("number too small to fit in target type")]
163    NegOverflow {
164        #[primary_span]
165        span: Span,
166    },
167}
168
169impl InvalidIssueStringCause {
170    pub(crate) fn from_int_error_kind(span: Span, kind: &IntErrorKind) -> Option<Self> {
171        match kind {
172            IntErrorKind::Empty => Some(Self::Empty { span }),
173            IntErrorKind::InvalidDigit => Some(Self::InvalidDigit { span }),
174            IntErrorKind::PosOverflow => Some(Self::PosOverflow { span }),
175            IntErrorKind::NegOverflow => Some(Self::NegOverflow { span }),
176            IntErrorKind::Zero => Some(Self::MustNotBeZero { span }),
177            _ => None,
178        }
179    }
180}
181
182#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MissingFeature
            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 {
                    MissingFeature { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'feature'")));
                        diag.code(E0546);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
183#[diag("missing 'feature'", code = E0546)]
184pub(crate) struct MissingFeature {
185    #[primary_span]
186    pub span: Span,
187}
188
189#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NonIdentFeature 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 {
                    NonIdentFeature { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("'feature' is not an identifier")));
                        diag.code(E0546);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
190#[diag("'feature' is not an identifier", code = E0546)]
191pub(crate) struct NonIdentFeature {
192    #[primary_span]
193    pub span: Span,
194}
195
196#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MissingIssue
            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 {
                    MissingIssue { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'issue'")));
                        diag.code(E0547);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
197#[diag("missing 'issue'", code = E0547)]
198pub(crate) struct MissingIssue {
199    #[primary_span]
200    pub span: Span,
201}
202
203#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcPromotablePairing 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 {
                    RustcPromotablePairing { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute")));
                        diag.code(E0717);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
204#[diag("`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute", code = E0717)]
205pub(crate) struct RustcPromotablePairing {
206    #[primary_span]
207    pub span: Span,
208}
209
210#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcAllowedUnstablePairing 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 {
                    RustcAllowedUnstablePairing { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute")));
                        diag.code(E0789);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
211#[diag("`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute", code = E0789)]
212pub(crate) struct RustcAllowedUnstablePairing {
213    #[primary_span]
214    pub span: Span,
215}
216
217#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DeprecatedItemSuggestion 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 {
                    DeprecatedItemSuggestion {
                        span: __binding_0,
                        is_nightly: __binding_1,
                        details: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suggestions on deprecated items are unstable")));
                        ;
                        diag.span(__binding_0);
                        if __binding_1 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(deprecated_suggestion)]` to the crate root")));
                        }
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see #94785 for more details")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
218#[diag("suggestions on deprecated items are unstable")]
219pub(crate) struct DeprecatedItemSuggestion {
220    #[primary_span]
221    pub span: Span,
222
223    #[help("add `#![feature(deprecated_suggestion)]` to the crate root")]
224    pub is_nightly: bool,
225
226    #[note("see #94785 for more details")]
227    pub details: (),
228}
229
230#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExpectedSingleVersionLiteral 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 {
                    ExpectedSingleVersionLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected single version literal")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
231#[diag("expected single version literal")]
232pub(crate) struct ExpectedSingleVersionLiteral {
233    #[primary_span]
234    pub span: Span,
235}
236
237#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExpectedVersionLiteral 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 {
                    ExpectedVersionLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a version literal")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
238#[diag("expected a version literal")]
239pub(crate) struct ExpectedVersionLiteral {
240    #[primary_span]
241    pub span: Span,
242}
243
244#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExpectsFeatureList 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 {
                    ExpectsFeatureList { span: __binding_0, name: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` expects a list of feature names")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
245#[diag("`{$name}` expects a list of feature names")]
246pub(crate) struct ExpectsFeatureList {
247    #[primary_span]
248    pub span: Span,
249
250    pub name: String,
251}
252
253#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExpectsFeatures 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 {
                    ExpectsFeatures { span: __binding_0, name: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` expects feature names")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
254#[diag("`{$name}` expects feature names")]
255pub(crate) struct ExpectsFeatures {
256    #[primary_span]
257    pub span: Span,
258
259    pub name: String,
260}
261
262#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for InvalidSince
            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 {
                    InvalidSince { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("'since' must be a Rust version number, such as \"1.31.0\"")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
263#[diag("'since' must be a Rust version number, such as \"1.31.0\"")]
264pub(crate) struct InvalidSince {
265    #[primary_span]
266    pub span: Span,
267}
268
269#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownVersionLiteral 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 {
                    UnknownVersionLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown version literal format, assuming it refers to a future version")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
270#[diag("unknown version literal format, assuming it refers to a future version")]
271pub(crate) struct UnknownVersionLiteral {
272    #[primary_span]
273    pub span: Span,
274}
275
276// FIXME(jdonszelmann) duplicated from `rustc_passes`, remove once `check_attr` is integrated.
277#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for UnusedMultiple
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnusedMultiple {
                        this: __binding_0, other: __binding_1, name: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `{$name}` attributes")));
                        let __code_18 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.arg("name", __binding_2);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
                            __code_18, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
278#[diag("multiple `{$name}` attributes")]
279pub(crate) struct UnusedMultiple {
280    #[primary_span]
281    #[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
282    pub this: Span,
283    #[note("attribute also specified here")]
284    pub other: Span,
285    pub name: Symbol,
286}
287
288#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EmptyExportName 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 {
                    EmptyExportName { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`export_name` may not be empty")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
289#[diag("`export_name` may not be empty")]
290pub(crate) struct EmptyExportName {
291    #[primary_span]
292    pub span: Span,
293}
294
295#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for EmptySection
            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 {
                    EmptySection { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`section` may not be empty")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
296#[diag("`section` may not be empty")]
297pub(crate) struct EmptySection {
298    #[primary_span]
299    pub span: Span,
300}
301
302#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NullOnExport
            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 {
                    NullOnExport { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`export_name` may not contain null characters")));
                        diag.code(E0648);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
303#[diag("`export_name` may not contain null characters", code = E0648)]
304pub(crate) struct NullOnExport {
305    #[primary_span]
306    pub span: Span,
307}
308
309#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NullOnLinkSection 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 {
                    NullOnLinkSection { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`link_section` may not contain null characters")));
                        diag.code(E0648);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
310#[diag("`link_section` may not contain null characters", code = E0648)]
311pub(crate) struct NullOnLinkSection {
312    #[primary_span]
313    pub span: Span,
314}
315
316#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NullOnLinkName
            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 {
                    NullOnLinkName { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link name may not contain null characters")));
                        diag.code(E0648);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
317#[diag("link name may not contain null characters", code = E0648)]
318pub(crate) struct NullOnLinkName {
319    #[primary_span]
320    pub span: Span,
321}
322
323#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NullOnObjcClass 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 {
                    NullOnObjcClass { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::class!` may not contain null characters")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
324#[diag("`objc::class!` may not contain null characters")]
325pub(crate) struct NullOnObjcClass {
326    #[primary_span]
327    pub span: Span,
328}
329
330#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NullOnObjcSelector 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 {
                    NullOnObjcSelector { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::selector!` may not contain null characters")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
331#[diag("`objc::selector!` may not contain null characters")]
332pub(crate) struct NullOnObjcSelector {
333    #[primary_span]
334    pub span: Span,
335}
336
337#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NullOnSection
            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 {
                    NullOnSection { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`section` may not contain null characters")));
                        diag.code(E0648);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
338#[diag("`section` may not contain null characters", code = E0648)]
339pub(crate) struct NullOnSection {
340    #[primary_span]
341    pub span: Span,
342}
343
344#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ObjcClassExpectedStringLiteral 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 {
                    ObjcClassExpectedStringLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::class!` expected a string literal")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
345#[diag("`objc::class!` expected a string literal")]
346pub(crate) struct ObjcClassExpectedStringLiteral {
347    #[primary_span]
348    pub span: Span,
349}
350
351#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ObjcSelectorExpectedStringLiteral 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 {
                    ObjcSelectorExpectedStringLiteral { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::selector!` expected a string literal")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
352#[diag("`objc::selector!` expected a string literal")]
353pub(crate) struct ObjcSelectorExpectedStringLiteral {
354    #[primary_span]
355    pub span: Span,
356}
357
358#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EmptyConfusables 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 {
                    EmptyConfusables { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected at least one confusable name")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
359#[diag("expected at least one confusable name")]
360pub(crate) struct EmptyConfusables {
361    #[primary_span]
362    pub span: Span,
363}
364
365#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for InvalidTarget
            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 {
                    InvalidTarget {
                        span: __binding_0,
                        name: __binding_1,
                        target: __binding_2,
                        applied: __binding_3,
                        only: __binding_4,
                        attribute_args: __binding_5,
                        help: __binding_6,
                        previously_accepted: __binding_7,
                        on_macro_call: __binding_8 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}{$attribute_args}]` attribute cannot be used on {$target}")));
                        let __code_19 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}{$attribute_args}]` can {$only}be applied to {$applied}")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("target", __binding_2);
                        diag.arg("applied", __binding_3);
                        diag.arg("only", __binding_4);
                        diag.arg("attribute_args", __binding_5);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
                            __code_19, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::CompletelyHidden);
                        if let Some(__binding_6) = __binding_6 {
                            diag.subdiagnostic(__binding_6);
                        }
                        if __binding_7 {
                            diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        }
                        if __binding_8 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
366#[help("`#[{$name}{$attribute_args}]` can {$only}be applied to {$applied}")]
367#[diag("`#[{$name}{$attribute_args}]` attribute cannot be used on {$target}")]
368pub(crate) struct InvalidTarget {
369    #[primary_span]
370    #[suggestion(
371        "remove the attribute",
372        code = "",
373        applicability = "machine-applicable",
374        style = "tool-only"
375    )]
376    pub span: Span,
377    pub name: AttrPath,
378    pub target: &'static str,
379    pub applied: DiagArgValue,
380    pub only: &'static str,
381    pub attribute_args: String,
382    #[subdiagnostic]
383    pub help: Option<InvalidTargetHelp>,
384    #[warning(
385        "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
386    )]
387    pub previously_accepted: bool,
388    #[note(
389        "placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute"
390    )]
391    pub on_macro_call: bool,
392}
393
394#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidTargetHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InvalidTargetHelp::UseRustcAlign => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#[rustc_align(...)]` instead")),
                                &sub_args);
                        diag.help(__message);
                    }
                    InvalidTargetHelp::UseRustcAlignStatic => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#[rustc_align_static(...)]` instead")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
395pub(crate) enum InvalidTargetHelp {
396    #[help("use `#[rustc_align(...)]` instead")]
397    UseRustcAlign,
398    #[help("use `#[rustc_align_static(...)]` instead")]
399    UseRustcAlignStatic,
400}
401
402#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidAlignmentValue 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 {
                    InvalidAlignmentValue {
                        span: __binding_0, error_part: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid alignment value: {$error_part}")));
                        diag.code(E0589);
                        ;
                        diag.arg("error_part", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
403#[diag("invalid alignment value: {$error_part}", code = E0589)]
404pub(crate) struct InvalidAlignmentValue {
405    #[primary_span]
406    pub span: Span,
407    pub error_part: String,
408}
409
410#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnstableFeatureBoundIncompatibleStability 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 {
                    UnstableFeatureBoundIncompatibleStability {
                        span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("item annotated with `#[unstable_feature_bound]` should not be stable")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
411#[diag("item annotated with `#[unstable_feature_bound]` should not be stable")]
412#[help(
413    "if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`"
414)]
415pub(crate) struct UnstableFeatureBoundIncompatibleStability {
416    #[primary_span]
417    pub span: Span,
418}
419
420#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NakedFunctionIncompatibleAttribute 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 {
                    NakedFunctionIncompatibleAttribute {
                        span: __binding_0,
                        naked_span: __binding_1,
                        attr: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute incompatible with `#[unsafe(naked)]`")));
                        diag.code(E0736);
                        ;
                        diag.arg("attr", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function marked with `#[unsafe(naked)]` here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
421#[diag("attribute incompatible with `#[unsafe(naked)]`", code = E0736)]
422pub(crate) struct NakedFunctionIncompatibleAttribute {
423    #[primary_span]
424    #[label("the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`")]
425    pub span: Span,
426    #[label("function marked with `#[unsafe(naked)]` here")]
427    pub naked_span: Span,
428    pub attr: String,
429}
430
431#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LinkOrdinalOutOfRange 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 {
                    LinkOrdinalOutOfRange {
                        span: __binding_0, ordinal: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ordinal value in `link_ordinal` is too large: `{$ordinal}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the value may not exceed `u16::MAX`")));
                        ;
                        diag.arg("ordinal", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
432#[diag("ordinal value in `link_ordinal` is too large: `{$ordinal}`")]
433#[note("the value may not exceed `u16::MAX`")]
434pub(crate) struct LinkOrdinalOutOfRange {
435    #[primary_span]
436    pub span: Span,
437    pub ordinal: u128,
438}
439
440#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcScalableVectorCountOutOfRange 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 {
                    RustcScalableVectorCountOutOfRange {
                        span: __binding_0, n: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("element count in `rustc_scalable_vector` is too large: `{$n}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the value may not exceed `u16::MAX`")));
                        ;
                        diag.arg("n", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
441#[diag("element count in `rustc_scalable_vector` is too large: `{$n}`")]
442#[note("the value may not exceed `u16::MAX`")]
443pub(crate) struct RustcScalableVectorCountOutOfRange {
444    #[primary_span]
445    pub span: Span,
446    pub n: u128,
447}
448
449#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AttributeRequiresOpt 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 {
                    AttributeRequiresOpt { span: __binding_0, opt: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute requires {$opt} to be enabled")));
                        ;
                        diag.arg("opt", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
450#[diag("attribute requires {$opt} to be enabled")]
451pub(crate) struct AttributeRequiresOpt {
452    #[primary_span]
453    pub span: Span,
454    pub opt: &'static str,
455}
456
457pub(crate) enum AttributeParseErrorReason<'a> {
458    ExpectedNoArgs,
459    ExpectedStringLiteral {
460        byte_string: Option<Span>,
461    },
462    ExpectedFilenameLiteral,
463    ExpectedIntegerLiteral,
464    ExpectedIntegerLiteralInRange {
465        lower_bound: isize,
466        upper_bound: isize,
467    },
468    ExpectedAtLeastOneArgument,
469    ExpectedArgument,
470    ExpectedSingleArgument,
471    ExpectedList,
472    ExpectedListOrNoArgs,
473    ExpectedListWithNumArgsOrMore {
474        args: usize,
475    },
476    ExpectedNameValueOrNoArgs,
477    ExpectedNonEmptyStringLiteral,
478    ExpectedNotLiteral,
479    ExpectedNameValue(Option<Symbol>),
480    MissingNameValue(Symbol),
481    DuplicateKey(Symbol),
482    ExpectedSpecificArgument {
483        possibilities: &'a [Symbol],
484        strings: bool,
485        /// Should we tell the user to write a list when they didn't?
486        list: bool,
487    },
488    ExpectedIdentifier,
489}
490
491/// A description of a thing that can be parsed using an attribute parser.
492#[derive(#[automatically_derived]
impl ::core::marker::Copy for ParsedDescription { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ParsedDescription {
    #[inline]
    fn clone(&self) -> ParsedDescription { *self }
}Clone)]
493pub enum ParsedDescription {
494    /// Used when parsing attributes.
495    Attribute,
496    /// Used when parsing some macros, such as the `cfg!()` macro.
497    Macro,
498}
499
500pub(crate) struct AttributeParseError<'a> {
501    pub(crate) span: Span,
502    pub(crate) attr_span: Span,
503    pub(crate) template: AttributeTemplate,
504    pub(crate) path: AttrPath,
505    pub(crate) description: ParsedDescription,
506    pub(crate) reason: AttributeParseErrorReason<'a>,
507    pub(crate) suggestions: AttributeParseErrorSuggestions,
508}
509
510pub(crate) enum AttributeParseErrorSuggestions {
511    CreatedByTemplate(Vec<String>),
512    CreatedByParser(Vec<Suggestion>),
513}
514
515impl<'a> AttributeParseError<'a> {
516    fn render_expected_specific_argument<G>(
517        &self,
518        diag: &mut Diag<'_, G>,
519        possibilities: &[Symbol],
520        strings: bool,
521    ) where
522        G: EmissionGuarantee,
523    {
524        let quote = if strings { '"' } else { '`' };
525        match possibilities {
526            &[] => {}
527            &[x] => {
528                diag.span_label(
529                    self.span,
530                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("the only valid argument here is {0}{1}{0}",
                quote, x))
    })format!("the only valid argument here is {quote}{x}{quote}"),
531                );
532            }
533            [first, second] => {
534                diag.span_label(
535                    self.span,
536                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("valid arguments are {0}{1}{0} or {0}{2}{0}",
                quote, first, second))
    })format!("valid arguments are {quote}{first}{quote} or {quote}{second}{quote}"),
537                );
538            }
539            [first @ .., second_to_last, last] => {
540                let mut res = String::new();
541                for i in first {
542                    res.push_str(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{0}, ", quote, i))
    })format!("{quote}{i}{quote}, "));
543                }
544                res.push_str(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{0} or {0}{2}{0}", quote,
                second_to_last, last))
    })format!("{quote}{second_to_last}{quote} or {quote}{last}{quote}"));
545
546                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("valid arguments are {0}", res))
    })format!("valid arguments are {res}"));
547            }
548        }
549    }
550
551    fn render_expected_specific_argument_list<G>(
552        &self,
553        diag: &mut Diag<'_, G>,
554        possibilities: &[Symbol],
555        strings: bool,
556    ) where
557        G: EmissionGuarantee,
558    {
559        let description = self.description();
560
561        let quote = if strings { '"' } else { '`' };
562        match possibilities {
563            &[] => {}
564            &[x] => {
565                diag.span_label(
566                    self.span,
567                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("this {0} is only valid with {1}{2}{1} as an argument",
                description, quote, x))
    })format!(
568                        "this {description} is only valid with {quote}{x}{quote} as an argument"
569                    ),
570                );
571            }
572            [first, second] => {
573                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("this {0} is only valid with either {1}{2}{1} or {1}{3}{1} as an argument",
                description, quote, first, second))
    })format!("this {description} is only valid with either {quote}{first}{quote} or {quote}{second}{quote} as an argument"));
574            }
575            [first @ .., second_to_last, last] => {
576                let mut res = String::new();
577                for i in first {
578                    res.push_str(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{0}, ", quote, i))
    })format!("{quote}{i}{quote}, "));
579                }
580                res.push_str(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{0} or {0}{2}{0}", quote,
                second_to_last, last))
    })format!("{quote}{second_to_last}{quote} or {quote}{last}{quote}"));
581
582                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("this {0} is only valid with one of the following arguments: {1}",
                description, res))
    })format!("this {description} is only valid with one of the following arguments: {res}"));
583            }
584        }
585    }
586
587    fn render_suggestions<G>(&self, diag: &mut Diag<'_, G>)
588    where
589        G: EmissionGuarantee,
590    {
591        let description = self.description();
592
593        match &self.suggestions {
594            AttributeParseErrorSuggestions::CreatedByTemplate(suggestions) => {
595                diag.span_suggestions(
596                        self.attr_span,
597                        if suggestions.len() == 1 {
598                            "must be of the form".to_string()
599                        } else {
600                            ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("try changing it to one of the following valid forms of the {0}",
                description))
    })format!(
601                                "try changing it to one of the following valid forms of the {description}"
602                            )
603                        },
604                        suggestions.iter().cloned(),
605                        Applicability::HasPlaceholders,
606                    );
607            }
608
609            AttributeParseErrorSuggestions::CreatedByParser(suggestions) => {
610                for Suggestion { msg, sp, code } in suggestions {
611                    diag.span_suggestion_verbose(
612                        *sp,
613                        msg.clone(),
614                        code.clone(),
615                        Applicability::MaybeIncorrect,
616                    );
617                }
618            }
619        }
620    }
621
622    fn description(&self) -> &'static str {
623        match self.description {
624            ParsedDescription::Attribute => "attribute",
625            ParsedDescription::Macro => "macro",
626        }
627    }
628}
629
630impl AttributeParseErrorSuggestions {
631    fn len(&self) -> usize {
632        match self {
633            AttributeParseErrorSuggestions::CreatedByTemplate(items) => items.len(),
634            AttributeParseErrorSuggestions::CreatedByParser(items) => items.len(),
635        }
636    }
637}
638
639impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError<'_> {
640    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
641        let name = self.path.to_string();
642
643        let description = self.description();
644
645        let mut diag = Diag::new(dcx, level, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("malformed `{0}` {1} input", name,
                description))
    })format!("malformed `{name}` {description} input"));
646        diag.span(self.attr_span);
647        diag.code(E0539);
648        match &self.reason {
649            AttributeParseErrorReason::ExpectedStringLiteral { byte_string } => {
650                if let Some(start_point_span) = byte_string {
651                    diag.span_suggestion(
652                        *start_point_span,
653                        "consider removing the prefix",
654                        "",
655                        Applicability::MaybeIncorrect,
656                    );
657                    diag.note("expected a normal string literal, not a byte string literal");
658
659                    // Avoid emitting an "attribute must be of the form" suggestion, as the
660                    // attribute is likely to be well-formed already.
661                    return diag;
662                }
663                diag.span_label(self.span, "expected a string literal here");
664            }
665            AttributeParseErrorReason::ExpectedFilenameLiteral => {
666                diag.span_label(self.span, "expected a filename string literal here");
667            }
668            AttributeParseErrorReason::ExpectedIntegerLiteral => {
669                diag.span_label(self.span, "expected an integer literal here");
670            }
671            AttributeParseErrorReason::ExpectedIntegerLiteralInRange {
672                lower_bound,
673                upper_bound,
674            } => {
675                diag.span_label(
676                    self.span,
677                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("expected an integer literal in the range of {0}..={1}",
                lower_bound, upper_bound))
    })format!(
678                        "expected an integer literal in the range of {lower_bound}..={upper_bound}"
679                    ),
680                );
681            }
682            AttributeParseErrorReason::ExpectedSingleArgument => {
683                diag.span_label(self.span, "expected a single argument here");
684                diag.code(E0805);
685            }
686            AttributeParseErrorReason::ExpectedArgument => {
687                diag.span_label(self.span, "expected an argument here");
688                diag.code(E0805);
689            }
690            AttributeParseErrorReason::ExpectedAtLeastOneArgument => {
691                diag.span_label(self.span, "expected at least 1 argument here");
692            }
693            AttributeParseErrorReason::ExpectedList => {
694                diag.span_label(self.span, "expected this to be a list");
695            }
696            AttributeParseErrorReason::ExpectedListOrNoArgs => {
697                diag.span_label(self.span, "expected a list or no arguments here");
698            }
699            AttributeParseErrorReason::ExpectedListWithNumArgsOrMore { args } => {
700                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("expected {0} or more items", args))
    })format!("expected {args} or more items"));
701            }
702            AttributeParseErrorReason::ExpectedNameValueOrNoArgs => {
703                diag.span_label(self.span, "didn't expect a list here");
704            }
705            AttributeParseErrorReason::ExpectedNonEmptyStringLiteral => {
706                diag.span_label(self.span, "string is not allowed to be empty");
707            }
708            AttributeParseErrorReason::DuplicateKey(key) => {
709                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("found `{0}` used as a key more than once",
                key))
    })format!("found `{key}` used as a key more than once"));
710                diag.code(E0538);
711            }
712            AttributeParseErrorReason::ExpectedNotLiteral => {
713                diag.span_label(self.span, "didn't expect a literal here");
714                diag.code(E0565);
715            }
716            AttributeParseErrorReason::ExpectedNoArgs => {
717                diag.span_label(self.span, "didn't expect any arguments here");
718                diag.code(E0565);
719            }
720            AttributeParseErrorReason::ExpectedNameValue(None) => {
721                // If the span is the entire attribute, the suggestion we add below this match already contains enough information
722                if self.span != self.attr_span {
723                    diag.span_label(self.span, "expected this to be of the form `... = \"...\"`");
724                }
725            }
726            AttributeParseErrorReason::ExpectedNameValue(Some(name)) => {
727                diag.span_label(
728                    self.span,
729                    ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("expected this to be of the form `{0} = \"...\"`",
                name))
    })format!("expected this to be of the form `{name} = \"...\"`"),
730                );
731            }
732            AttributeParseErrorReason::MissingNameValue(name) => {
733                diag.span_label(self.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("missing argument `{0} = \"...\"`",
                name))
    })format!("missing argument `{name} = \"...\"`"));
734            }
735            AttributeParseErrorReason::ExpectedSpecificArgument {
736                possibilities,
737                strings,
738                list: false,
739            } => {
740                self.render_expected_specific_argument(&mut diag, possibilities, *strings);
741            }
742            AttributeParseErrorReason::ExpectedSpecificArgument {
743                possibilities,
744                strings,
745                list: true,
746            } => {
747                self.render_expected_specific_argument_list(&mut diag, possibilities, *strings);
748            }
749            AttributeParseErrorReason::ExpectedIdentifier => {
750                diag.span_label(self.span, "expected a valid identifier here");
751                diag.code(E0565);
752            }
753        }
754
755        if let Some(link) = self.template.docs {
756            diag.note(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("for more information, visit <{0}>",
                link))
    })format!("for more information, visit <{link}>"));
757        }
758
759        if self.suggestions.len() < 4 {
760            self.render_suggestions(&mut diag);
761        }
762
763        diag
764    }
765}
766
767#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidAttrUnsafe 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 {
                    InvalidAttrUnsafe { span: __binding_0, name: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` is not an unsafe attribute")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extraneous unsafe is not allowed in attributes")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is not an unsafe attribute")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
768#[diag("`{$name}` is not an unsafe attribute")]
769#[note("extraneous unsafe is not allowed in attributes")]
770pub(crate) struct InvalidAttrUnsafe {
771    #[primary_span]
772    #[label("this is not an unsafe attribute")]
773    pub span: Span,
774    pub name: AttrPath,
775}
776
777#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsafeAttrOutsideUnsafe 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 {
                    UnsafeAttrOutsideUnsafe {
                        span: __binding_0, suggestion: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe attribute used without unsafe")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of unsafe attribute")));
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
778#[diag("unsafe attribute used without unsafe")]
779pub(crate) struct UnsafeAttrOutsideUnsafe {
780    #[primary_span]
781    #[label("usage of unsafe attribute")]
782    pub span: Span,
783    #[subdiagnostic]
784    pub suggestion: Option<UnsafeAttrOutsideUnsafeSuggestion>,
785}
786
787#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnsafeAttrOutsideUnsafeSuggestion
            {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnsafeAttrOutsideUnsafeSuggestion {
                        left: __binding_0, right: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_20 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("unsafe("))
                                });
                        let __code_21 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_20));
                        suggestions.push((__binding_1, __code_21));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrap the attribute in `unsafe(...)`")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
788#[multipart_suggestion("wrap the attribute in `unsafe(...)`", applicability = "machine-applicable")]
789pub(crate) struct UnsafeAttrOutsideUnsafeSuggestion {
790    #[suggestion_part(code = "unsafe(")]
791    pub left: Span,
792    #[suggestion_part(code = ")")]
793    pub right: Span,
794}
795
796#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MetaBadDelim
            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 {
                    MetaBadDelim { span: __binding_0, sugg: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrong meta list delimiters")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
797#[diag("wrong meta list delimiters")]
798pub(crate) struct MetaBadDelim {
799    #[primary_span]
800    pub span: Span,
801    #[subdiagnostic]
802    pub sugg: MetaBadDelimSugg,
803}
804
805#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MetaBadDelimSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MetaBadDelimSugg { open: __binding_0, close: __binding_1 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_22 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_23 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_22));
                        suggestions.push((__binding_1, __code_23));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the delimiters should be `(` and `)`")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
806#[multipart_suggestion(
807    "the delimiters should be `(` and `)`",
808    applicability = "machine-applicable"
809)]
810pub(crate) struct MetaBadDelimSugg {
811    #[suggestion_part(code = "(")]
812    pub open: Span,
813    #[suggestion_part(code = ")")]
814    pub close: Span,
815}
816
817#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidMetaItem 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 {
                    InvalidMetaItem {
                        span: __binding_0,
                        descr: __binding_1,
                        quote_ident_sugg: __binding_2,
                        remove_neg_sugg: __binding_3,
                        label: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a literal (`1u8`, `1.0f32`, `\"string\"`, etc.) here, found {$descr}")));
                        ;
                        diag.arg("descr", __binding_1);
                        diag.span(__binding_0);
                        if let Some(__binding_2) = __binding_2 {
                            diag.subdiagnostic(__binding_2);
                        }
                        if let Some(__binding_3) = __binding_3 {
                            diag.subdiagnostic(__binding_3);
                        }
                        if let Some(__binding_4) = __binding_4 {
                            diag.span_label(__binding_4,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$descr}s are not allowed here")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
818#[diag("expected a literal (`1u8`, `1.0f32`, `\"string\"`, etc.) here, found {$descr}")]
819pub(crate) struct InvalidMetaItem {
820    #[primary_span]
821    pub span: Span,
822    pub descr: String,
823    #[subdiagnostic]
824    pub quote_ident_sugg: Option<InvalidMetaItemQuoteIdentSugg>,
825    #[subdiagnostic]
826    pub remove_neg_sugg: Option<InvalidMetaItemRemoveNegSugg>,
827    #[label("{$descr}s are not allowed here")]
828    pub label: Option<Span>,
829}
830
831#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidMetaItemQuoteIdentSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InvalidMetaItemQuoteIdentSugg {
                        before: __binding_0, after: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_24 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("\""))
                                });
                        let __code_25 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("\""))
                                });
                        suggestions.push((__binding_0, __code_24));
                        suggestions.push((__binding_1, __code_25));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("surround the identifier with quotation marks to make it into a string literal")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
832#[multipart_suggestion(
833    "surround the identifier with quotation marks to make it into a string literal",
834    applicability = "machine-applicable"
835)]
836pub(crate) struct InvalidMetaItemQuoteIdentSugg {
837    #[suggestion_part(code = "\"")]
838    pub before: Span,
839    #[suggestion_part(code = "\"")]
840    pub after: Span,
841}
842
843#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidMetaItemRemoveNegSugg {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InvalidMetaItemRemoveNegSugg { negative_sign: __binding_0 }
                        => {
                        let mut suggestions = Vec::new();
                        let __code_26 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(""))
                                });
                        suggestions.push((__binding_0, __code_26));
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative numbers are not literals, try removing the `-` sign")),
                                &sub_args);
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                    }
                }
            }
        }
    };Subdiagnostic)]
844#[multipart_suggestion(
845    "negative numbers are not literals, try removing the `-` sign",
846    applicability = "machine-applicable"
847)]
848pub(crate) struct InvalidMetaItemRemoveNegSugg {
849    #[suggestion_part(code = "")]
850    pub negative_sign: Span,
851}
852
853#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SuffixedLiteralInAttribute 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 {
                    SuffixedLiteralInAttribute { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suffixed literals are not allowed in attributes")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
854#[diag("suffixed literals are not allowed in attributes")]
855#[help(
856    "instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)"
857)]
858pub(crate) struct SuffixedLiteralInAttribute {
859    #[primary_span]
860    pub span: Span,
861}
862
863#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for EmptyLinkName
            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 {
                    EmptyLinkName { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link name must not be empty")));
                        diag.code(E0454);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty link name")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
864#[diag("link name must not be empty", code = E0454)]
865pub(crate) struct EmptyLinkName {
866    #[primary_span]
867    #[label("empty link name")]
868    pub span: Span,
869}
870
871#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LinkFrameworkApple 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 {
                    LinkFrameworkApple { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link kind `framework` is only supported on Apple targets")));
                        diag.code(E0455);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
872#[diag("link kind `framework` is only supported on Apple targets", code = E0455)]
873pub(crate) struct LinkFrameworkApple {
874    #[primary_span]
875    pub span: Span,
876}
877
878#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncompatibleWasmLink 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 {
                    IncompatibleWasmLink { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`wasm_import_module` is incompatible with other arguments in `#[link]` attributes")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
879#[diag("`wasm_import_module` is incompatible with other arguments in `#[link]` attributes")]
880pub(crate) struct IncompatibleWasmLink {
881    #[primary_span]
882    pub span: Span,
883}
884
885#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LinkRequiresName 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 {
                    LinkRequiresName { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[link]` attribute requires a `name = \"string\"` argument")));
                        diag.code(E0459);
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing `name` argument")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
886#[diag("`#[link]` attribute requires a `name = \"string\"` argument", code = E0459)]
887pub(crate) struct LinkRequiresName {
888    #[primary_span]
889    #[label("missing `name` argument")]
890    pub span: Span,
891}
892
893#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RawDylibOnlyWindows 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 {
                    RawDylibOnlyWindows { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link kind `raw-dylib` is only supported on Windows targets")));
                        diag.code(E0455);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
894#[diag("link kind `raw-dylib` is only supported on Windows targets", code = E0455)]
895pub(crate) struct RawDylibOnlyWindows {
896    #[primary_span]
897    pub span: Span,
898}
899
900#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidLinkModifier 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 {
                    InvalidLinkModifier { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
901#[diag(
902    "invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols"
903)]
904pub(crate) struct InvalidLinkModifier {
905    #[primary_span]
906    pub span: Span,
907}
908
909#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleModifiers 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 {
                    MultipleModifiers { span: __binding_0, modifier: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `{$modifier}` modifiers in a single `modifiers` argument")));
                        ;
                        diag.arg("modifier", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
910#[diag("multiple `{$modifier}` modifiers in a single `modifiers` argument")]
911pub(crate) struct MultipleModifiers {
912    #[primary_span]
913    pub span: Span,
914    pub modifier: Symbol,
915}
916
917#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ImportNameTypeX86 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 {
                    ImportNameTypeX86 { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import name type is only supported on x86")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
918#[diag("import name type is only supported on x86")]
919pub(crate) struct ImportNameTypeX86 {
920    #[primary_span]
921    pub span: Span,
922}
923
924#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BundleNeedsStatic 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 {
                    BundleNeedsStatic { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `bundle` is only compatible with `static` linking kind")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
925#[diag("linking modifier `bundle` is only compatible with `static` linking kind")]
926pub(crate) struct BundleNeedsStatic {
927    #[primary_span]
928    pub span: Span,
929}
930
931#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ExportSymbolsNeedsStatic 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 {
                    ExportSymbolsNeedsStatic { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `export-symbols` is only compatible with `static` linking kind")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
932#[diag("linking modifier `export-symbols` is only compatible with `static` linking kind")]
933pub(crate) struct ExportSymbolsNeedsStatic {
934    #[primary_span]
935    pub span: Span,
936}
937
938#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            WholeArchiveNeedsStatic 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 {
                    WholeArchiveNeedsStatic { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `whole-archive` is only compatible with `static` linking kind")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
939#[diag("linking modifier `whole-archive` is only compatible with `static` linking kind")]
940pub(crate) struct WholeArchiveNeedsStatic {
941    #[primary_span]
942    pub span: Span,
943}
944
945#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AsNeededCompatibility 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 {
                    AsNeededCompatibility { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
946#[diag(
947    "linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds"
948)]
949pub(crate) struct AsNeededCompatibility {
950    #[primary_span]
951    pub span: Span,
952}
953
954#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ImportNameTypeRaw 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 {
                    ImportNameTypeRaw { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import name type can only be used with link kind `raw-dylib`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
955#[diag("import name type can only be used with link kind `raw-dylib`")]
956pub(crate) struct ImportNameTypeRaw {
957    #[primary_span]
958    pub span: Span,
959}
960
961#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            LimitInvalid<'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 {
                    LimitInvalid {
                        span: __binding_0,
                        value_span: __binding_1,
                        error_str: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`limit` must be a non-negative integer")));
                        ;
                        diag.arg("error_str", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error_str}")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
962#[diag("`limit` must be a non-negative integer")]
963pub(crate) struct LimitInvalid<'a> {
964    #[primary_span]
965    pub span: Span,
966    #[label("{$error_str}")]
967    pub value_span: Span,
968    pub error_str: &'a str,
969}
970
971#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CfgAttrBadDelim 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 {
                    CfgAttrBadDelim { span: __binding_0, sugg: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrong `cfg_attr` delimiters")));
                        ;
                        diag.span(__binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
972#[diag("wrong `cfg_attr` delimiters")]
973pub(crate) struct CfgAttrBadDelim {
974    #[primary_span]
975    pub span: Span,
976    #[subdiagnostic]
977    pub sugg: MetaBadDelimSugg,
978}
979
980#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DocAliasMalformed 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 {
                    DocAliasMalformed { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("doc alias attribute expects a string `#[doc(alias = \"a\")]` or a list of strings `#[doc(alias(\"a\", \"b\"))]`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
981#[diag(
982    "doc alias attribute expects a string `#[doc(alias = \"a\")]` or a list of strings `#[doc(alias(\"a\", \"b\"))]`"
983)]
984pub(crate) struct DocAliasMalformed {
985    #[primary_span]
986    pub span: Span,
987}
988
989#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownLangItem 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 {
                    UnknownLangItem { span: __binding_0, name: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("definition of an unknown lang item: `{$name}`")));
                        diag.code(E0522);
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("definition of unknown lang item `{$name}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
990#[diag("definition of an unknown lang item: `{$name}`", code = E0522)]
991pub(crate) struct UnknownLangItem {
992    #[primary_span]
993    #[label("definition of unknown lang item `{$name}`")]
994    pub span: Span,
995    pub name: Symbol,
996}
997
998#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsupportedInstructionSet<'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 {
                    UnsupportedInstructionSet {
                        span: __binding_0,
                        instruction_set: __binding_1,
                        current_target: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`")));
                        ;
                        diag.arg("instruction_set", __binding_1);
                        diag.arg("current_target", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
999#[diag("target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`")]
1000pub(crate) struct UnsupportedInstructionSet<'a> {
1001    #[primary_span]
1002    pub span: Span,
1003    pub instruction_set: Symbol,
1004    pub current_target: &'a TargetTuple,
1005}
1006
1007#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CustomMirPhaseRequiresDialect 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 {
                    CustomMirPhaseRequiresDialect {
                        attr_span: __binding_0, phase_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`dialect` key required")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`phase` argument requires a `dialect` argument")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1008#[diag("`dialect` key required")]
1009pub(crate) struct CustomMirPhaseRequiresDialect {
1010    #[primary_span]
1011    pub attr_span: Span,
1012    #[label("`phase` argument requires a `dialect` argument")]
1013    pub phase_span: Span,
1014}
1015
1016#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CustomMirIncompatibleDialectAndPhase 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 {
                    CustomMirIncompatibleDialectAndPhase {
                        dialect: __binding_0,
                        phase: __binding_1,
                        attr_span: __binding_2,
                        dialect_span: __binding_3,
                        phase_span: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the {$dialect} dialect is not compatible with the {$phase} phase")));
                        ;
                        diag.arg("dialect", __binding_0);
                        diag.arg("phase", __binding_1);
                        diag.span(__binding_2);
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this dialect...")));
                        diag.span_label(__binding_4,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("... is not compatible with this phase")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1017#[diag("the {$dialect} dialect is not compatible with the {$phase} phase")]
1018pub(crate) struct CustomMirIncompatibleDialectAndPhase {
1019    pub dialect: MirDialect,
1020    pub phase: MirPhase,
1021    #[primary_span]
1022    pub attr_span: Span,
1023    #[label("this dialect...")]
1024    pub dialect_span: Span,
1025    #[label("... is not compatible with this phase")]
1026    pub phase_span: Span,
1027}
1028
1029#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnstableAttrForAlreadyStableFeature 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 {
                    UnstableAttrForAlreadyStableFeature {
                        attr_span: __binding_0, item_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't mark as unstable using an already stable feature")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this feature is already stable")));
                        diag.span_help(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing the attribute")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the stability attribute annotates this item")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1030#[diag("can't mark as unstable using an already stable feature")]
1031pub(crate) struct UnstableAttrForAlreadyStableFeature {
1032    #[primary_span]
1033    #[label("this feature is already stable")]
1034    #[help("consider removing the attribute")]
1035    pub attr_span: Span,
1036    #[label("the stability attribute annotates this item")]
1037    pub item_span: Span,
1038}
1039
1040#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidMachoSection 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 {
                    InvalidMachoSection {
                        name_span: __binding_0, reason: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid Mach-O section specifier")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not a valid Mach-O section specifier")));
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1041#[diag("invalid Mach-O section specifier")]
1042pub(crate) struct InvalidMachoSection {
1043    #[primary_span]
1044    #[label("not a valid Mach-O section specifier")]
1045    pub name_span: Span,
1046    #[subdiagnostic]
1047    pub reason: InvalidMachoSectionReason,
1048}
1049
1050#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for InvalidMachoSectionReason {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    InvalidMachoSectionReason::MissingSection => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("a Mach-O section specifier requires a segment and a section, separated by a comma")),
                                &sub_args);
                        diag.note(__message);
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an example of a valid Mach-O section specifier is `__TEXT,__cstring`")),
                                &sub_args);
                        diag.help(__message);
                    }
                    InvalidMachoSectionReason::SectionTooLong {
                        section: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("section".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("section name `{$section}` is longer than 16 bytes")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1051pub(crate) enum InvalidMachoSectionReason {
1052    #[note("a Mach-O section specifier requires a segment and a section, separated by a comma")]
1053    #[help("an example of a valid Mach-O section specifier is `__TEXT,__cstring`")]
1054    MissingSection,
1055    #[note("section name `{$section}` is longer than 16 bytes")]
1056    SectionTooLong { section: String },
1057}
1058
1059#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizeInvalidStatic 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 {
                    SanitizeInvalidStatic {
                        span: __binding_0, field: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[sanitize({$field} = ...)]` attribute cannot be used on statics")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[sanitize]` can be used on statics if only the address is sanitized")));
                        ;
                        diag.arg("field", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1060#[diag("`#[sanitize({$field} = ...)]` attribute cannot be used on statics")]
1061#[help("`#[sanitize]` can be used on statics if only the address is sanitized")]
1062pub(crate) struct SanitizeInvalidStatic {
1063    #[primary_span]
1064    pub span: Span,
1065    pub field: &'static str,
1066}
1067
1068#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for ExpectedComma
            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 {
                    ExpectedComma { span: __binding_0, additional: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute items not separated with `,`")));
                        let __code_27 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(","))
                                            })].into_iter();
                        ;
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding `,` here")),
                            __code_27, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                        for __binding_1 in __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1069#[diag("attribute items not separated with `,`")]
1070pub(crate) struct ExpectedComma {
1071    #[primary_span]
1072    #[suggestion(
1073        "try adding `,` here",
1074        code = ",",
1075        applicability = "maybe-incorrect",
1076        style = "short"
1077    )]
1078    pub span: Span,
1079    #[subdiagnostic]
1080    pub additional: Vec<AdditionalCommaSuggestion>,
1081}
1082
1083#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for AdditionalCommaSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    AdditionalCommaSuggestion { span: __binding_0 } => {
                        let __code_28 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(","))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding `,` here")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_28, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::HideCodeInline);
                    }
                }
            }
        }
    };Subdiagnostic)]
1084#[suggestion("try adding `,` here", code = ",", applicability = "maybe-incorrect", style = "short")]
1085pub(crate) struct AdditionalCommaSuggestion {
1086    #[primary_span]
1087    pub span: Span,
1088}
1089
1090#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnusedDuplicate where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnusedDuplicate {
                        this: __binding_0, other: __binding_1, warning: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unused attribute")));
                        let __code_29 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!(""))
                                            })].into_iter();
                        ;
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
                            __code_29, rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.span_note(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
                        if __binding_2 {
                            diag.warn(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1091#[diag("unused attribute")]
1092pub(crate) struct UnusedDuplicate {
1093    #[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
1094    pub this: Span,
1095    #[note("attribute also specified here")]
1096    pub other: Span,
1097    #[warning(
1098        "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1099    )]
1100    pub warning: bool,
1101}