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