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