Skip to main content

rustc_session/
errors.rs

1use std::num::{NonZero, ParseIntError};
2
3use rustc_ast::token;
4use rustc_ast::util::literal::LitError;
5use rustc_errors::codes::*;
6use rustc_errors::{
7    Diag, DiagCtxtHandle, DiagMessage, Diagnostic, EmissionGuarantee, ErrorGuaranteed, Level,
8    MultiSpan,
9};
10use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
11use rustc_span::{Span, Symbol};
12use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTuple};
13
14use crate::parse::ParseSess;
15
16#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AppleDeploymentTarget where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AppleDeploymentTarget::Invalid {
                        env_var: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse deployment target specified in {$env_var}: {$error}")));
                        ;
                        diag.arg("env_var", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                    AppleDeploymentTarget::TooLow {
                        env_var: __binding_0,
                        version: __binding_1,
                        os_min: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("deployment target in {$env_var} was set to {$version}, but the minimum supported by `rustc` is {$os_min}")));
                        ;
                        diag.arg("env_var", __binding_0);
                        diag.arg("version", __binding_1);
                        diag.arg("os_min", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
17pub(crate) enum AppleDeploymentTarget {
18    #[diag("failed to parse deployment target specified in {$env_var}: {$error}")]
19    Invalid { env_var: &'static str, error: ParseIntError },
20    #[diag(
21        "deployment target in {$env_var} was set to {$version}, but the minimum supported by `rustc` is {$os_min}"
22    )]
23    TooLow { env_var: &'static str, version: String, os_min: String },
24}
25
26pub(crate) struct FeatureGateError {
27    pub(crate) span: MultiSpan,
28    pub(crate) explain: DiagMessage,
29}
30
31impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for FeatureGateError {
32    #[track_caller]
33    fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
34        Diag::new(dcx, level, self.explain).with_span(self.span).with_code(E0658)
35    }
36}
37
38#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for FeatureDiagnosticForIssue {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    FeatureDiagnosticForIssue { n: __binding_0 } => {
                        diag.store_args();
                        diag.arg("n", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
39#[note("see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information")]
40pub(crate) struct FeatureDiagnosticForIssue {
41    pub(crate) n: NonZero<u32>,
42}
43
44#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for SuggestUpgradeCompiler {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    SuggestUpgradeCompiler { date: __binding_0 } => {
                        diag.store_args();
                        diag.arg("date", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this compiler was built on {$date}; consider upgrading it if it is out of date")));
                        diag.note(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
45#[note("this compiler was built on {$date}; consider upgrading it if it is out of date")]
46pub(crate) struct SuggestUpgradeCompiler {
47    date: &'static str,
48}
49
50impl SuggestUpgradeCompiler {
51    pub(crate) fn ui_testing() -> Self {
52        Self { date: "YYYY-MM-DD" }
53    }
54
55    pub(crate) fn new() -> Option<Self> {
56        let date = ::core::option::Option::Some("2026-02-10")option_env!("CFG_VER_DATE")?;
57
58        Some(Self { date })
59    }
60}
61
62#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for FeatureDiagnosticHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    FeatureDiagnosticHelp { feature: __binding_0 } => {
                        diag.store_args();
                        diag.arg("feature", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature({$feature})]` to the crate attributes to enable")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
63#[help("add `#![feature({$feature})]` to the crate attributes to enable")]
64pub(crate) struct FeatureDiagnosticHelp {
65    pub(crate) feature: Symbol,
66}
67
68#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for FeatureDiagnosticSuggestion {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    FeatureDiagnosticSuggestion {
                        feature: __binding_0, span: __binding_1 } => {
                        let __code_0 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("#![feature({0})]\n",
                                                        __binding_0))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("feature", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature({$feature})]` to the crate attributes to enable")));
                        diag.span_suggestions_with_style(__binding_1, __message,
                            __code_0, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
69#[suggestion(
70    "add `#![feature({$feature})]` to the crate attributes to enable",
71    applicability = "maybe-incorrect",
72    code = "#![feature({feature})]\n"
73)]
74pub struct FeatureDiagnosticSuggestion {
75    pub feature: Symbol,
76    #[primary_span]
77    pub span: Span,
78}
79
80#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for CliFeatureDiagnosticHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    CliFeatureDiagnosticHelp { feature: __binding_0 } => {
                        diag.store_args();
                        diag.arg("feature", __binding_0);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `-Zcrate-attr=\"feature({$feature})\"` to the command-line options to enable")));
                        diag.help(__message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
81#[help("add `-Zcrate-attr=\"feature({$feature})\"` to the command-line options to enable")]
82pub(crate) struct CliFeatureDiagnosticHelp {
83    pub(crate) feature: Symbol,
84}
85
86#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MustBeNameOfAssociatedFunction where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MustBeNameOfAssociatedFunction { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("must be a name of an associated function")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
87#[diag("must be a name of an associated function")]
88pub struct MustBeNameOfAssociatedFunction {
89    #[primary_span]
90    pub span: Span,
91}
92
93#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NotCircumventFeature where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NotCircumventFeature => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature gates, except when testing error paths in the CTFE engine")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
94#[diag(
95    "`-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature gates, except when testing error paths in the CTFE engine"
96)]
97pub(crate) struct NotCircumventFeature;
98
99#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LinkerPluginToWindowsNotSupported where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkerPluginToWindowsNotSupported => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linker plugin based LTO is not supported together with `-C prefer-dynamic` when targeting Windows-like targets")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
100#[diag(
101    "linker plugin based LTO is not supported together with `-C prefer-dynamic` when targeting Windows-like targets"
102)]
103pub(crate) struct LinkerPluginToWindowsNotSupported;
104
105#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ProfileUseFileDoesNotExist<'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 {
                    ProfileUseFileDoesNotExist { path: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("file `{$path}` passed to `-C profile-use` does not exist")));
                        ;
                        diag.arg("path", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
106#[diag("file `{$path}` passed to `-C profile-use` does not exist")]
107pub(crate) struct ProfileUseFileDoesNotExist<'a> {
108    pub(crate) path: &'a std::path::Path,
109}
110
111#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ProfileSampleUseFileDoesNotExist<'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 {
                    ProfileSampleUseFileDoesNotExist { path: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("file `{$path}` passed to `-C profile-sample-use` does not exist")));
                        ;
                        diag.arg("path", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
112#[diag("file `{$path}` passed to `-C profile-sample-use` does not exist")]
113pub(crate) struct ProfileSampleUseFileDoesNotExist<'a> {
114    pub(crate) path: &'a std::path::Path,
115}
116
117#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TargetRequiresUnwindTables where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TargetRequiresUnwindTables => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
118#[diag("target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`")]
119pub(crate) struct TargetRequiresUnwindTables;
120
121#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InstrumentationNotSupported where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InstrumentationNotSupported { us: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$us} instrumentation is not supported for this target")));
                        ;
                        diag.arg("us", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
122#[diag("{$us} instrumentation is not supported for this target")]
123pub(crate) struct InstrumentationNotSupported {
124    pub(crate) us: String,
125}
126
127#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizerNotSupported where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizerNotSupported { us: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$us} sanitizer is not supported for this target")));
                        ;
                        diag.arg("us", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
128#[diag("{$us} sanitizer is not supported for this target")]
129pub(crate) struct SanitizerNotSupported {
130    pub(crate) us: String,
131}
132
133#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizersNotSupported where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizersNotSupported { us: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$us} sanitizers are not supported for this target")));
                        ;
                        diag.arg("us", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
134#[diag("{$us} sanitizers are not supported for this target")]
135pub(crate) struct SanitizersNotSupported {
136    pub(crate) us: String,
137}
138
139#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotMixAndMatchSanitizers where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CannotMixAndMatchSanitizers {
                        first: __binding_0, second: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsanitizer={$first}` is incompatible with `-Zsanitizer={$second}`")));
                        ;
                        diag.arg("first", __binding_0);
                        diag.arg("second", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
140#[diag("`-Zsanitizer={$first}` is incompatible with `-Zsanitizer={$second}`")]
141pub(crate) struct CannotMixAndMatchSanitizers {
142    pub(crate) first: String,
143    pub(crate) second: String,
144}
145
146#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CannotEnableCrtStaticLinux where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CannotEnableCrtStaticLinux => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("sanitizer is incompatible with statically linked libc, disable it using `-C target-feature=-crt-static`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
147#[diag(
148    "sanitizer is incompatible with statically linked libc, disable it using `-C target-feature=-crt-static`"
149)]
150pub(crate) struct CannotEnableCrtStaticLinux;
151
152#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizerCfiRequiresLto where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizerCfiRequiresLto => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
153#[diag("`-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`")]
154pub(crate) struct SanitizerCfiRequiresLto;
155
156#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizerCfiRequiresSingleCodegenUnit where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizerCfiRequiresSingleCodegenUnit => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
157#[diag("`-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`")]
158pub(crate) struct SanitizerCfiRequiresSingleCodegenUnit;
159
160#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizerCfiCanonicalJumpTablesRequiresCfi where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizerCfiCanonicalJumpTablesRequiresCfi => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
161#[diag("`-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`")]
162pub(crate) struct SanitizerCfiCanonicalJumpTablesRequiresCfi;
163
164#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizerCfiGeneralizePointersRequiresCfi where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizerCfiGeneralizePointersRequiresCfi => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
165#[diag("`-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`")]
166pub(crate) struct SanitizerCfiGeneralizePointersRequiresCfi;
167
168#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizerCfiNormalizeIntegersRequiresCfi where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizerCfiNormalizeIntegersRequiresCfi => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
169#[diag("`-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`")]
170pub(crate) struct SanitizerCfiNormalizeIntegersRequiresCfi;
171
172#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizerKcfiArityRequiresKcfi where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizerKcfiArityRequiresKcfi => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
173#[diag("`-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi`")]
174pub(crate) struct SanitizerKcfiArityRequiresKcfi;
175
176#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SanitizerKcfiRequiresPanicAbort where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SanitizerKcfiRequiresPanicAbort => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Z sanitizer=kcfi` requires `-C panic=abort`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
177#[diag("`-Z sanitizer=kcfi` requires `-C panic=abort`")]
178pub(crate) struct SanitizerKcfiRequiresPanicAbort;
179
180#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SplitLtoUnitRequiresLto where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SplitLtoUnitRequiresLto => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsplit-lto-unit` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
181#[diag("`-Zsplit-lto-unit` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`")]
182pub(crate) struct SplitLtoUnitRequiresLto;
183
184#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnstableVirtualFunctionElimination where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnstableVirtualFunctionElimination => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zvirtual-function-elimination` requires `-Clto`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
185#[diag("`-Zvirtual-function-elimination` requires `-Clto`")]
186pub(crate) struct UnstableVirtualFunctionElimination;
187
188#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsupportedDwarfVersion where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsupportedDwarfVersion { dwarf_version: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("requested DWARF version {$dwarf_version} is not supported")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("supported DWARF versions are 2, 3, 4 and 5")));
                        ;
                        diag.arg("dwarf_version", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
189#[diag("requested DWARF version {$dwarf_version} is not supported")]
190#[help("supported DWARF versions are 2, 3, 4 and 5")]
191pub(crate) struct UnsupportedDwarfVersion {
192    pub(crate) dwarf_version: u32,
193}
194
195#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EmbedSourceInsufficientDwarfVersion where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EmbedSourceInsufficientDwarfVersion {
                        dwarf_version: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zembed-source=y` requires at least `-Z dwarf-version=5` but DWARF version is {$dwarf_version}")));
                        ;
                        diag.arg("dwarf_version", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
196#[diag(
197    "`-Zembed-source=y` requires at least `-Z dwarf-version=5` but DWARF version is {$dwarf_version}"
198)]
199pub(crate) struct EmbedSourceInsufficientDwarfVersion {
200    pub(crate) dwarf_version: u32,
201}
202
203#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EmbedSourceRequiresDebugInfo where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EmbedSourceRequiresDebugInfo => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zembed-source=y` requires debug information to be enabled")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
204#[diag("`-Zembed-source=y` requires debug information to be enabled")]
205pub(crate) struct EmbedSourceRequiresDebugInfo;
206
207#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            StackProtectorNotSupportedForTarget<'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 {
                    StackProtectorNotSupportedForTarget {
                        stack_protector: __binding_0, target_triple: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Z stack-protector={$stack_protector}` is not supported for target {$target_triple} and will be ignored")));
                        ;
                        diag.arg("stack_protector", __binding_0);
                        diag.arg("target_triple", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
208#[diag(
209    "`-Z stack-protector={$stack_protector}` is not supported for target {$target_triple} and will be ignored"
210)]
211pub(crate) struct StackProtectorNotSupportedForTarget<'a> {
212    pub(crate) stack_protector: StackProtector,
213    pub(crate) target_triple: &'a TargetTuple,
214}
215
216#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            SmallDataThresholdNotSupportedForTarget<'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 {
                    SmallDataThresholdNotSupportedForTarget {
                        target_triple: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Z small-data-threshold` is not supported for target {$target_triple} and will be ignored")));
                        ;
                        diag.arg("target_triple", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
217#[diag(
218    "`-Z small-data-threshold` is not supported for target {$target_triple} and will be ignored"
219)]
220pub(crate) struct SmallDataThresholdNotSupportedForTarget<'a> {
221    pub(crate) target_triple: &'a TargetTuple,
222}
223
224#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BranchProtectionRequiresAArch64 where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BranchProtectionRequiresAArch64 => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zbranch-protection` is only supported on aarch64")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
225#[diag("`-Zbranch-protection` is only supported on aarch64")]
226pub(crate) struct BranchProtectionRequiresAArch64;
227
228#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SplitDebugInfoUnstablePlatform where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SplitDebugInfoUnstablePlatform { debuginfo: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Csplit-debuginfo={$debuginfo}` is unstable on this platform")));
                        ;
                        diag.arg("debuginfo", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
229#[diag("`-Csplit-debuginfo={$debuginfo}` is unstable on this platform")]
230pub(crate) struct SplitDebugInfoUnstablePlatform {
231    pub(crate) debuginfo: SplitDebuginfo,
232}
233
234#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            FileIsNotWriteable<'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 {
                    FileIsNotWriteable { file: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("output file {$file} is not writeable -- check its permissions")));
                        ;
                        diag.arg("file", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
235#[diag("output file {$file} is not writeable -- check its permissions")]
236pub(crate) struct FileIsNotWriteable<'a> {
237    pub(crate) file: &'a std::path::Path,
238}
239
240#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            FileWriteFail<'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 {
                    FileWriteFail { path: __binding_0, err: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write `{$path}` due to error `{$err}`")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("err", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
241#[diag("failed to write `{$path}` due to error `{$err}`")]
242pub(crate) struct FileWriteFail<'a> {
243    pub(crate) path: &'a std::path::Path,
244    pub(crate) err: String,
245}
246
247#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CrateNameEmpty
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CrateNameEmpty { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("crate name must not be empty")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.span(__binding_0);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
248#[diag("crate name must not be empty")]
249pub(crate) struct CrateNameEmpty {
250    #[primary_span]
251    pub(crate) span: Option<Span>,
252}
253
254#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidCharacterInCrateName where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidCharacterInCrateName {
                        span: __binding_0,
                        character: __binding_1,
                        crate_name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid character {$character} in crate name: `{$crate_name}`")));
                        ;
                        diag.arg("character", __binding_1);
                        diag.arg("crate_name", __binding_2);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span(__binding_0);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
255#[diag("invalid character {$character} in crate name: `{$crate_name}`")]
256pub(crate) struct InvalidCharacterInCrateName {
257    #[primary_span]
258    pub(crate) span: Option<Span>,
259    pub(crate) character: char,
260    pub(crate) crate_name: Symbol,
261}
262
263#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for ExprParenthesesNeeded {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    ExprParenthesesNeeded {
                        left: __binding_0, right: __binding_1 } => {
                        let mut suggestions = Vec::new();
                        let __code_1 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!("("))
                                });
                        let __code_2 =
                            ::alloc::__export::must_use({
                                    ::alloc::fmt::format(format_args!(")"))
                                });
                        suggestions.push((__binding_0, __code_1));
                        suggestions.push((__binding_1, __code_2));
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("parentheses are required to parse this as an expression")));
                        diag.multipart_suggestion_with_style(__message, suggestions,
                            rustc_errors::Applicability::MachineApplicable,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
264#[multipart_suggestion(
265    "parentheses are required to parse this as an expression",
266    applicability = "machine-applicable"
267)]
268pub struct ExprParenthesesNeeded {
269    #[suggestion_part(code = "(")]
270    left: Span,
271    #[suggestion_part(code = ")")]
272    right: Span,
273}
274
275impl ExprParenthesesNeeded {
276    pub fn surrounding(s: Span) -> Self {
277        ExprParenthesesNeeded { left: s.shrink_to_lo(), right: s.shrink_to_hi() }
278    }
279}
280
281#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SkippingConstChecks where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SkippingConstChecks { unleashed_features: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("skipping const checks")));
                        ;
                        for __binding_0 in __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
282#[diag("skipping const checks")]
283pub(crate) struct SkippingConstChecks {
284    #[subdiagnostic]
285    pub(crate) unleashed_features: Vec<UnleashedFeatureHelp>,
286}
287
288#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnleashedFeatureHelp {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnleashedFeatureHelp::Named {
                        span: __binding_0, gate: __binding_1 } => {
                        diag.store_args();
                        diag.arg("gate", __binding_1);
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("skipping check for `{$gate}` feature")));
                        diag.span_help(__binding_0, __message);
                        diag.restore_args();
                    }
                    UnleashedFeatureHelp::Unnamed { span: __binding_0 } => {
                        diag.store_args();
                        let __message =
                            diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("skipping check that does not even have a feature gate")));
                        diag.span_help(__binding_0, __message);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
289pub(crate) enum UnleashedFeatureHelp {
290    #[help("skipping check for `{$gate}` feature")]
291    Named {
292        #[primary_span]
293        span: Span,
294        gate: Symbol,
295    },
296    #[help("skipping check that does not even have a feature gate")]
297    Unnamed {
298        #[primary_span]
299        span: Span,
300    },
301}
302
303#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidLiteralSuffix<'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 {
                    InvalidLiteralSuffix {
                        span: __binding_0, kind: __binding_1, suffix: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suffixes on {$kind} literals are invalid")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.arg("suffix", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid suffix `{$suffix}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
304#[diag("suffixes on {$kind} literals are invalid")]
305struct InvalidLiteralSuffix<'a> {
306    #[primary_span]
307    #[label("invalid suffix `{$suffix}`")]
308    span: Span,
309    // FIXME(#100717)
310    kind: &'a str,
311    suffix: Symbol,
312}
313
314#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidIntLiteralWidth where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidIntLiteralWidth {
                        span: __binding_0, width: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid width `{$width}` for integer literal")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("valid widths are 8, 16, 32, 64 and 128")));
                        ;
                        diag.arg("width", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
315#[diag("invalid width `{$width}` for integer literal")]
316#[help("valid widths are 8, 16, 32, 64 and 128")]
317struct InvalidIntLiteralWidth {
318    #[primary_span]
319    span: Span,
320    width: String,
321}
322
323#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidNumLiteralBasePrefix where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidNumLiteralBasePrefix {
                        span: __binding_0, fixed: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid base prefix for number literal")));
                        let __code_3 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_1))
                                            })].into_iter();
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase")));
                        ;
                        diag.arg("fixed", __binding_1);
                        diag.span(__binding_0);
                        diag.span_suggestions_with_style(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try making the prefix lowercase")),
                            __code_3, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
324#[diag("invalid base prefix for number literal")]
325#[note("base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase")]
326struct InvalidNumLiteralBasePrefix {
327    #[primary_span]
328    #[suggestion(
329        "try making the prefix lowercase",
330        applicability = "maybe-incorrect",
331        code = "{fixed}"
332    )]
333    span: Span,
334    fixed: String,
335}
336
337#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidNumLiteralSuffix where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidNumLiteralSuffix {
                        span: __binding_0, suffix: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid suffix `{$suffix}` for number literal")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)")));
                        ;
                        diag.arg("suffix", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid suffix `{$suffix}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
338#[diag("invalid suffix `{$suffix}` for number literal")]
339#[help("the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)")]
340struct InvalidNumLiteralSuffix {
341    #[primary_span]
342    #[label("invalid suffix `{$suffix}`")]
343    span: Span,
344    suffix: String,
345}
346
347#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidFloatLiteralWidth where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidFloatLiteralWidth {
                        span: __binding_0, width: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid width `{$width}` for float literal")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("valid widths are 32 and 64")));
                        ;
                        diag.arg("width", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
348#[diag("invalid width `{$width}` for float literal")]
349#[help("valid widths are 32 and 64")]
350struct InvalidFloatLiteralWidth {
351    #[primary_span]
352    span: Span,
353    width: String,
354}
355
356#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidFloatLiteralSuffix where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidFloatLiteralSuffix {
                        span: __binding_0, suffix: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid suffix `{$suffix}` for float literal")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("valid suffixes are `f32` and `f64`")));
                        ;
                        diag.arg("suffix", __binding_1);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid suffix `{$suffix}`")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
357#[diag("invalid suffix `{$suffix}` for float literal")]
358#[help("valid suffixes are `f32` and `f64`")]
359struct InvalidFloatLiteralSuffix {
360    #[primary_span]
361    #[label("invalid suffix `{$suffix}`")]
362    span: Span,
363    suffix: String,
364}
365
366#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IntLiteralTooLarge where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IntLiteralTooLarge { span: __binding_0, limit: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("integer literal is too large")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value exceeds limit of `{$limit}`")));
                        ;
                        diag.arg("limit", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
367#[diag("integer literal is too large")]
368#[note("value exceeds limit of `{$limit}`")]
369struct IntLiteralTooLarge {
370    #[primary_span]
371    span: Span,
372    limit: String,
373}
374
375#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            HexadecimalFloatLiteralNotSupported where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    HexadecimalFloatLiteralNotSupported { span: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("hexadecimal float literal is not supported")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not supported")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
376#[diag("hexadecimal float literal is not supported")]
377struct HexadecimalFloatLiteralNotSupported {
378    #[primary_span]
379    #[label("not supported")]
380    span: Span,
381}
382
383#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            OctalFloatLiteralNotSupported where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    OctalFloatLiteralNotSupported { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("octal float literal is not supported")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not supported")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
384#[diag("octal float literal is not supported")]
385struct OctalFloatLiteralNotSupported {
386    #[primary_span]
387    #[label("not supported")]
388    span: Span,
389}
390
391#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BinaryFloatLiteralNotSupported where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BinaryFloatLiteralNotSupported { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("binary float literal is not supported")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not supported")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
392#[diag("binary float literal is not supported")]
393struct BinaryFloatLiteralNotSupported {
394    #[primary_span]
395    #[label("not supported")]
396    span: Span,
397}
398
399pub fn report_lit_error(
400    psess: &ParseSess,
401    err: LitError,
402    lit: token::Lit,
403    span: Span,
404) -> ErrorGuaranteed {
405    create_lit_error(psess, err, lit, span).emit()
406}
407
408pub fn create_lit_error(psess: &ParseSess, err: LitError, lit: token::Lit, span: Span) -> Diag<'_> {
409    // Checks if `s` looks like i32 or u1234 etc.
410    fn looks_like_width_suffix(first_chars: &[char], s: &str) -> bool {
411        s.len() > 1 && s.starts_with(first_chars) && s[1..].chars().all(|c| c.is_ascii_digit())
412    }
413
414    // Try to lowercase the prefix if the prefix and suffix are valid.
415    fn fix_base_capitalisation(prefix: &str, suffix: &str) -> Option<String> {
416        let mut chars = suffix.chars();
417
418        let base_char = chars.next().unwrap();
419        let base = match base_char {
420            'B' => 2,
421            'O' => 8,
422            'X' => 16,
423            _ => return None,
424        };
425
426        // check that the suffix contains only base-appropriate characters
427        let valid = prefix == "0"
428            && chars
429                .filter(|c| *c != '_')
430                .take_while(|c| *c != 'i' && *c != 'u')
431                .all(|c| c.to_digit(base).is_some());
432
433        valid.then(|| ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0{0}{1}",
                base_char.to_ascii_lowercase(), &suffix[1..]))
    })format!("0{}{}", base_char.to_ascii_lowercase(), &suffix[1..]))
434    }
435
436    let dcx = psess.dcx();
437    match err {
438        LitError::InvalidSuffix(suffix) => {
439            dcx.create_err(InvalidLiteralSuffix { span, kind: lit.kind.descr(), suffix })
440        }
441        LitError::InvalidIntSuffix(suffix) => {
442            let suf = suffix.as_str();
443            if looks_like_width_suffix(&['i', 'u'], suf) {
444                // If it looks like a width, try to be helpful.
445                dcx.create_err(InvalidIntLiteralWidth { span, width: suf[1..].into() })
446            } else if let Some(fixed) = fix_base_capitalisation(lit.symbol.as_str(), suf) {
447                dcx.create_err(InvalidNumLiteralBasePrefix { span, fixed })
448            } else {
449                dcx.create_err(InvalidNumLiteralSuffix { span, suffix: suf.to_string() })
450            }
451        }
452        LitError::InvalidFloatSuffix(suffix) => {
453            let suf = suffix.as_str();
454            if looks_like_width_suffix(&['f'], suf) {
455                // If it looks like a width, try to be helpful.
456                dcx.create_err(InvalidFloatLiteralWidth { span, width: suf[1..].to_string() })
457            } else {
458                dcx.create_err(InvalidFloatLiteralSuffix { span, suffix: suf.to_string() })
459            }
460        }
461        LitError::NonDecimalFloat(base) => match base {
462            16 => dcx.create_err(HexadecimalFloatLiteralNotSupported { span }),
463            8 => dcx.create_err(OctalFloatLiteralNotSupported { span }),
464            2 => dcx.create_err(BinaryFloatLiteralNotSupported { span }),
465            _ => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
466        },
467        LitError::IntTooLarge(base) => {
468            let max = u128::MAX;
469            let limit = match base {
470                2 => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:#b}", max))
    })format!("{max:#b}"),
471                8 => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:#o}", max))
    })format!("{max:#o}"),
472                16 => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:#x}", max))
    })format!("{max:#x}"),
473                _ => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}", max))
    })format!("{max}"),
474            };
475            dcx.create_err(IntLiteralTooLarge { span, limit })
476        }
477    }
478}
479
480#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncompatibleLinkerFlavor where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncompatibleLinkerFlavor {
                        flavor: __binding_0, compatible_list: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linker flavor `{$flavor}` is incompatible with the current target")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("compatible flavors are: {$compatible_list}")));
                        ;
                        diag.arg("flavor", __binding_0);
                        diag.arg("compatible_list", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
481#[diag("linker flavor `{$flavor}` is incompatible with the current target")]
482#[note("compatible flavors are: {$compatible_list}")]
483pub(crate) struct IncompatibleLinkerFlavor {
484    pub(crate) flavor: &'static str,
485    pub(crate) compatible_list: String,
486}
487
488#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FunctionReturnRequiresX86OrX8664 where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FunctionReturnRequiresX86OrX8664 => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zfunction-return` (except `keep`) is only supported on x86 and x86_64")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
489#[diag("`-Zfunction-return` (except `keep`) is only supported on x86 and x86_64")]
490pub(crate) struct FunctionReturnRequiresX86OrX8664;
491
492#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FunctionReturnThunkExternRequiresNonLargeCodeModel where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FunctionReturnThunkExternRequiresNonLargeCodeModel => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zfunction-return=thunk-extern` is only supported on non-large code models")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
493#[diag("`-Zfunction-return=thunk-extern` is only supported on non-large code models")]
494pub(crate) struct FunctionReturnThunkExternRequiresNonLargeCodeModel;
495
496#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IndirectBranchCsPrefixRequiresX86OrX8664 where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IndirectBranchCsPrefixRequiresX86OrX8664 => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
497#[diag("`-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64")]
498pub(crate) struct IndirectBranchCsPrefixRequiresX86OrX8664;
499
500#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsupportedRegparm where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsupportedRegparm { regparm: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zregparm={$regparm}` is unsupported (valid values 0-3)")));
                        ;
                        diag.arg("regparm", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
501#[diag("`-Zregparm={$regparm}` is unsupported (valid values 0-3)")]
502pub(crate) struct UnsupportedRegparm {
503    pub(crate) regparm: u32,
504}
505
506#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsupportedRegparmArch where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsupportedRegparmArch => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zregparm=N` is only supported on x86")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
507#[diag("`-Zregparm=N` is only supported on x86")]
508pub(crate) struct UnsupportedRegparmArch;
509
510#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsupportedRegStructReturnArch where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsupportedRegStructReturnArch => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zreg-struct-return` is only supported on x86")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
511#[diag("`-Zreg-struct-return` is only supported on x86")]
512pub(crate) struct UnsupportedRegStructReturnArch;
513
514#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FailedToCreateProfiler where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FailedToCreateProfiler { err: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to create profiler: {$err}")));
                        ;
                        diag.arg("err", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
515#[diag("failed to create profiler: {$err}")]
516pub(crate) struct FailedToCreateProfiler {
517    pub(crate) err: String,
518}
519
520#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SoftFloatIgnored where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SoftFloatIgnored => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Csoft-float` is ignored on this target; it only has an effect on *eabihf targets")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this may become a hard error in a future version of Rust")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
521#[diag("`-Csoft-float` is ignored on this target; it only has an effect on *eabihf targets")]
522#[note("this may become a hard error in a future version of Rust")]
523pub(crate) struct SoftFloatIgnored;
524
525#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SoftFloatDeprecated where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SoftFloatDeprecated => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Csoft-float` is unsound and deprecated; use a corresponding *eabi target instead")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("it will be removed or ignored in a future version of Rust")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see issue #129893 <https://github.com/rust-lang/rust/issues/129893> for more information")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
526#[diag("`-Csoft-float` is unsound and deprecated; use a corresponding *eabi target instead")]
527#[note("it will be removed or ignored in a future version of Rust")]
528#[note("see issue #129893 <https://github.com/rust-lang/rust/issues/129893> for more information")]
529pub(crate) struct SoftFloatDeprecated;
530
531#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnexpectedBuiltinCfg {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnexpectedBuiltinCfg {
                        cfg: __binding_0,
                        cfg_name: __binding_1,
                        controlled_by: __binding_2 } => {
                        diag.primary_message(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected `--cfg {$cfg}` flag")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("config `{$cfg_name}` is only supposed to be controlled by `{$controlled_by}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("manually setting a built-in cfg can and does create incoherent behaviors")));
                        ;
                        diag.arg("cfg", __binding_0);
                        diag.arg("cfg_name", __binding_1);
                        diag.arg("controlled_by", __binding_2);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
532#[diag("unexpected `--cfg {$cfg}` flag")]
533#[note("config `{$cfg_name}` is only supposed to be controlled by `{$controlled_by}`")]
534#[note("manually setting a built-in cfg can and does create incoherent behaviors")]
535pub(crate) struct UnexpectedBuiltinCfg {
536    pub(crate) cfg: String,
537    pub(crate) cfg_name: Symbol,
538    pub(crate) controlled_by: &'static str,
539}