Skip to main content

rustc_codegen_ssa/
errors.rs

1//! Errors emitted by codegen_ssa
2
3use std::borrow::Cow;
4use std::ffi::OsString;
5use std::io::Error;
6use std::path::{Path, PathBuf};
7use std::process::ExitStatus;
8
9use rustc_abi::NumScalableVectors;
10use rustc_errors::codes::*;
11use rustc_errors::{
12    Diag, DiagArgValue, DiagCtxtHandle, DiagSymbolList, Diagnostic, EmissionGuarantee, IntoDiagArg,
13    Level, msg,
14};
15use rustc_macros::{Diagnostic, Subdiagnostic};
16use rustc_middle::ty::layout::LayoutError;
17use rustc_middle::ty::{FloatTy, Ty};
18use rustc_span::{Span, Symbol};
19
20use crate::assert_module_sources::CguReuse;
21use crate::back::command::Command;
22
23#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            IncorrectCguReuseType<'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 {
                    IncorrectCguReuseType {
                        span: __binding_0,
                        cgu_user_name: __binding_1,
                        actual_reuse: __binding_2,
                        expected_reuse: __binding_3,
                        at_least: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("CGU-reuse for `{$cgu_user_name}` is `{$actual_reuse}` but should be {$at_least ->\n        [one] {\"at least \"}\n        *[other] {\"\"}\n    }`{$expected_reuse}`")));
                        ;
                        diag.arg("cgu_user_name", __binding_1);
                        diag.arg("actual_reuse", __binding_2);
                        diag.arg("expected_reuse", __binding_3);
                        diag.arg("at_least", __binding_4);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
24#[diag(
25    "CGU-reuse for `{$cgu_user_name}` is `{$actual_reuse}` but should be {$at_least ->
26        [one] {\"at least \"}
27        *[other] {\"\"}
28    }`{$expected_reuse}`"
29)]
30pub(crate) struct IncorrectCguReuseType<'a> {
31    #[primary_span]
32    pub span: Span,
33    pub cgu_user_name: &'a str,
34    pub actual_reuse: CguReuse,
35    pub expected_reuse: CguReuse,
36    pub at_least: u8,
37}
38
39#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            CguNotRecorded<'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 {
                    CguNotRecorded {
                        cgu_user_name: __binding_0, cgu_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("CGU-reuse for `{$cgu_user_name}` is (mangled: `{$cgu_name}`) was not recorded")));
                        ;
                        diag.arg("cgu_user_name", __binding_0);
                        diag.arg("cgu_name", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
40#[diag("CGU-reuse for `{$cgu_user_name}` is (mangled: `{$cgu_name}`) was not recorded")]
41pub(crate) struct CguNotRecorded<'a> {
42    pub cgu_user_name: &'a str,
43    pub cgu_name: &'a str,
44}
45
46#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingQueryDepGraph where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MissingQueryDepGraph { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found CGU-reuse attribute but `-Zquery-dep-graph` was not specified")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
47#[diag("found CGU-reuse attribute but `-Zquery-dep-graph` was not specified")]
48pub(crate) struct MissingQueryDepGraph {
49    #[primary_span]
50    pub span: Span,
51}
52
53#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            MalformedCguName<'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 {
                    MalformedCguName {
                        span: __binding_0,
                        user_path: __binding_1,
                        crate_name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found malformed codegen unit name `{$user_path}`. codegen units names must always start with the name of the crate (`{$crate_name}` in this case)")));
                        ;
                        diag.arg("user_path", __binding_1);
                        diag.arg("crate_name", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
54#[diag(
55    "found malformed codegen unit name `{$user_path}`. codegen units names must always start with the name of the crate (`{$crate_name}` in this case)"
56)]
57pub(crate) struct MalformedCguName<'a> {
58    #[primary_span]
59    pub span: Span,
60    pub user_path: &'a str,
61    pub crate_name: &'a str,
62}
63
64#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            NoModuleNamed<'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 {
                    NoModuleNamed {
                        span: __binding_0,
                        user_path: __binding_1,
                        cgu_name: __binding_2,
                        cgu_names: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no module named `{$user_path}` (mangled: {$cgu_name}). available modules: {$cgu_names}")));
                        ;
                        diag.arg("user_path", __binding_1);
                        diag.arg("cgu_name", __binding_2);
                        diag.arg("cgu_names", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
65#[diag("no module named `{$user_path}` (mangled: {$cgu_name}). available modules: {$cgu_names}")]
66pub(crate) struct NoModuleNamed<'a> {
67    #[primary_span]
68    pub span: Span,
69    pub user_path: &'a str,
70    pub cgu_name: Symbol,
71    pub cgu_names: String,
72}
73
74#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LibDefWriteFailure where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LibDefWriteFailure { error: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write lib.def file: {$error}")));
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
75#[diag("failed to write lib.def file: {$error}")]
76pub(crate) struct LibDefWriteFailure {
77    pub error: Error,
78}
79
80#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            VersionScriptWriteFailure where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    VersionScriptWriteFailure { error: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write version script: {$error}")));
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
81#[diag("failed to write version script: {$error}")]
82pub(crate) struct VersionScriptWriteFailure {
83    pub error: Error,
84}
85
86#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SymbolFileWriteFailure where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SymbolFileWriteFailure { error: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write symbols file: {$error}")));
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
87#[diag("failed to write symbols file: {$error}")]
88pub(crate) struct SymbolFileWriteFailure {
89    pub error: Error,
90}
91
92#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            Ld64UnimplementedModifier where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    Ld64UnimplementedModifier => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`as-needed` modifier not implemented yet for ld64")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
93#[diag("`as-needed` modifier not implemented yet for ld64")]
94pub(crate) struct Ld64UnimplementedModifier;
95
96#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LinkerUnsupportedModifier where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkerUnsupportedModifier => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`as-needed` modifier not supported for current linker")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
97#[diag("`as-needed` modifier not supported for current linker")]
98pub(crate) struct LinkerUnsupportedModifier;
99
100#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            L4BenderExportingSymbolsUnimplemented where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    L4BenderExportingSymbolsUnimplemented => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("exporting symbols not implemented yet for L4Bender")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
101#[diag("exporting symbols not implemented yet for L4Bender")]
102pub(crate) struct L4BenderExportingSymbolsUnimplemented;
103
104#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NoNatvisDirectory where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NoNatvisDirectory { error: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error enumerating natvis directory: {$error}")));
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
105#[diag("error enumerating natvis directory: {$error}")]
106pub(crate) struct NoNatvisDirectory {
107    pub error: Error,
108}
109
110#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            NoSavedObjectFile<'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 {
                    NoSavedObjectFile { cgu_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cached cgu {$cgu_name} should have an object file, but doesn't")));
                        ;
                        diag.arg("cgu_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
111#[diag("cached cgu {$cgu_name} should have an object file, but doesn't")]
112pub(crate) struct NoSavedObjectFile<'a> {
113    pub cgu_name: &'a str,
114}
115
116#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CopyPathBuf
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CopyPathBuf {
                        source_file: __binding_0,
                        output_path: __binding_1,
                        error: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unable to copy {$source_file} to {$output_path}: {$error}")));
                        ;
                        diag.arg("source_file", __binding_0);
                        diag.arg("output_path", __binding_1);
                        diag.arg("error", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
117#[diag("unable to copy {$source_file} to {$output_path}: {$error}")]
118pub(crate) struct CopyPathBuf {
119    pub source_file: PathBuf,
120    pub output_path: PathBuf,
121    pub error: Error,
122}
123
124// Reports Paths using `Debug` implementation rather than Path's `Display` implementation.
125#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            CopyPath<'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 {
                    CopyPath {
                        from: __binding_0, to: __binding_1, error: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not copy {$from} to {$to}: {$error}")));
                        ;
                        diag.arg("from", __binding_0);
                        diag.arg("to", __binding_1);
                        diag.arg("error", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
126#[diag("could not copy {$from} to {$to}: {$error}")]
127pub(crate) struct CopyPath<'a> {
128    from: DebugArgPath<'a>,
129    to: DebugArgPath<'a>,
130    error: Error,
131}
132
133impl<'a> CopyPath<'a> {
134    pub(crate) fn new(from: &'a Path, to: &'a Path, error: Error) -> CopyPath<'a> {
135        CopyPath { from: DebugArgPath(from), to: DebugArgPath(to), error }
136    }
137}
138
139struct DebugArgPath<'a>(pub &'a Path);
140
141impl IntoDiagArg for DebugArgPath<'_> {
142    fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> rustc_errors::DiagArgValue {
143        DiagArgValue::Str(Cow::Owned(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:?}", self.0))
    })format!("{:?}", self.0)))
144    }
145}
146
147#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BinaryOutputToTty where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BinaryOutputToTty { shorthand: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("option `-o` or `--emit` is used to write binary output type `{$shorthand}` to stdout, but stdout is a tty")));
                        ;
                        diag.arg("shorthand", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
148#[diag(
149    "option `-o` or `--emit` is used to write binary output type `{$shorthand}` to stdout, but stdout is a tty"
150)]
151pub(crate) struct BinaryOutputToTty {
152    pub shorthand: &'static str,
153}
154
155#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IgnoringEmitPath where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IgnoringEmitPath { extension: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ignoring emit path because multiple .{$extension} files were produced")));
                        ;
                        diag.arg("extension", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
156#[diag("ignoring emit path because multiple .{$extension} files were produced")]
157pub(crate) struct IgnoringEmitPath {
158    pub extension: &'static str,
159}
160
161#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for IgnoringOutput
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IgnoringOutput { extension: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ignoring -o because multiple .{$extension} files were produced")));
                        ;
                        diag.arg("extension", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
162#[diag("ignoring -o because multiple .{$extension} files were produced")]
163pub(crate) struct IgnoringOutput {
164    pub extension: &'static str,
165}
166
167#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CreateTempDir
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CreateTempDir { error: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("couldn't create a temp dir: {$error}")));
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
168#[diag("couldn't create a temp dir: {$error}")]
169pub(crate) struct CreateTempDir {
170    pub error: Error,
171}
172
173#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AddNativeLibrary where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AddNativeLibrary {
                        library_path: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to add native library {$library_path}: {$error}")));
                        ;
                        diag.arg("library_path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
174#[diag("failed to add native library {$library_path}: {$error}")]
175pub(crate) struct AddNativeLibrary {
176    pub library_path: PathBuf,
177    pub error: Error,
178}
179
180#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleExternalFuncDecl<'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 {
                    MultipleExternalFuncDecl {
                        span: __binding_0,
                        function: __binding_1,
                        library_name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple declarations of external function `{$function}` from library `{$library_name}` have different calling conventions")));
                        ;
                        diag.arg("function", __binding_1);
                        diag.arg("library_name", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
181#[diag(
182    "multiple declarations of external function `{$function}` from library `{$library_name}` have different calling conventions"
183)]
184pub(crate) struct MultipleExternalFuncDecl<'a> {
185    #[primary_span]
186    pub span: Span,
187    pub function: Symbol,
188    pub library_name: &'a str,
189}
190
191#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LinkRlibError
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkRlibError::MissingFormat => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not find formats for rlibs")));
                        ;
                        diag
                    }
                    LinkRlibError::OnlyRmetaFound { crate_name: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not find rlib for: `{$crate_name}`, found rmeta (metadata) file")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag
                    }
                    LinkRlibError::NotFound { crate_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not find rlib for: `{$crate_name}`")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag
                    }
                    LinkRlibError::IncompatibleDependencyFormats {
                        ty1: __binding_0,
                        ty2: __binding_1,
                        list1: __binding_2,
                        list2: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ty1}` and `{$ty2}` do not have equivalent dependency formats (`{$list1}` vs `{$list2}`)")));
                        ;
                        diag.arg("ty1", __binding_0);
                        diag.arg("ty2", __binding_1);
                        diag.arg("list1", __binding_2);
                        diag.arg("list2", __binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
192pub enum LinkRlibError {
193    #[diag("could not find formats for rlibs")]
194    MissingFormat,
195
196    #[diag("could not find rlib for: `{$crate_name}`, found rmeta (metadata) file")]
197    OnlyRmetaFound { crate_name: Symbol },
198
199    #[diag("could not find rlib for: `{$crate_name}`")]
200    NotFound { crate_name: Symbol },
201
202    #[diag(
203        "`{$ty1}` and `{$ty2}` do not have equivalent dependency formats (`{$list1}` vs `{$list2}`)"
204    )]
205    IncompatibleDependencyFormats { ty1: String, ty2: String, list1: String, list2: String },
206}
207
208pub(crate) struct ThorinErrorWrapper(pub thorin::Error);
209
210impl<G: EmissionGuarantee> Diagnostic<'_, G> for ThorinErrorWrapper {
211    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
212        let build = |msg| Diag::new(dcx, level, msg);
213        match self.0 {
214            thorin::Error::ReadInput(_) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to read input file"))msg!("failed to read input file")),
215            thorin::Error::ParseFileKind(_) => {
216                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse input file kind"))msg!("failed to parse input file kind"))
217            }
218            thorin::Error::ParseObjectFile(_) => {
219                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse input object file"))msg!("failed to parse input object file"))
220            }
221            thorin::Error::ParseArchiveFile(_) => {
222                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse input archive file"))msg!("failed to parse input archive file"))
223            }
224            thorin::Error::ParseArchiveMember(_) => {
225                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse archive member"))msg!("failed to parse archive member"))
226            }
227            thorin::Error::InvalidInputKind => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("input is not an archive or elf object"))msg!("input is not an archive or elf object")),
228            thorin::Error::DecompressData(_) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to decompress compressed section"))msg!("failed to decompress compressed section")),
229            thorin::Error::NamelessSection(_, offset) => {
230                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("section without name at offset {$offset}"))msg!("section without name at offset {$offset}"))
231                    .with_arg("offset", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", offset))
    })format!("0x{offset:08x}"))
232            }
233            thorin::Error::RelocationWithInvalidSymbol(section, offset) => {
234                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("relocation with invalid symbol for section `{$section}` at offset {$offset}"))msg!("relocation with invalid symbol for section `{$section}` at offset {$offset}"))
235                    .with_arg("section", section)
236                    .with_arg("offset", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", offset))
    })format!("0x{offset:08x}"))
237            }
238            thorin::Error::MultipleRelocations(section, offset) => {
239                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple relocations for section `{$section}` at offset {$offset}"))msg!("multiple relocations for section `{$section}` at offset {$offset}"))
240                    .with_arg("section", section)
241                    .with_arg("offset", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", offset))
    })format!("0x{offset:08x}"))
242            }
243            thorin::Error::UnsupportedRelocation(section, offset) => {
244                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsupported relocation for section {$section} at offset {$offset}"))msg!("unsupported relocation for section {$section} at offset {$offset}"))
245                    .with_arg("section", section)
246                    .with_arg("offset", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", offset))
    })format!("0x{offset:08x}"))
247            }
248            thorin::Error::MissingDwoName(id) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing path attribute to DWARF object ({$id})"))msg!("missing path attribute to DWARF object ({$id})"))
249                .with_arg("id", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", id))
    })format!("0x{id:08x}")),
250            thorin::Error::NoCompilationUnits => {
251                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("input object has no compilation units"))msg!("input object has no compilation units"))
252            }
253            thorin::Error::NoDie => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no top-level debugging information entry in compilation/type unit"))msg!("no top-level debugging information entry in compilation/type unit")),
254            thorin::Error::TopLevelDieNotUnit => {
255                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("top-level debugging information entry is not a compilation/type unit"))msg!("top-level debugging information entry is not a compilation/type unit"))
256            }
257            thorin::Error::MissingRequiredSection(section) => {
258                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("input object missing required section `{$section}`"))msg!("input object missing required section `{$section}`"))
259                    .with_arg("section", section)
260            }
261            thorin::Error::ParseUnitAbbreviations(_) => {
262                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse unit abbreviations"))msg!("failed to parse unit abbreviations"))
263            }
264            thorin::Error::ParseUnitAttribute(_) => {
265                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse unit attribute"))msg!("failed to parse unit attribute"))
266            }
267            thorin::Error::ParseUnitHeader(_) => {
268                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse unit header"))msg!("failed to parse unit header"))
269            }
270            thorin::Error::ParseUnit(_) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse unit"))msg!("failed to parse unit")),
271            thorin::Error::IncompatibleIndexVersion(section, format, actual) => {
272                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incompatible `{$section}` index version: found version {$actual}, expected version {$format}"))msg!("incompatible `{$section}` index version: found version {$actual}, expected version {$format}"))
273                    .with_arg("section", section)
274                    .with_arg("actual", actual)
275                    .with_arg("format", format)
276            }
277            thorin::Error::OffsetAtIndex(_, index) => {
278                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read offset at index {$index} of `.debug_str_offsets.dwo` section"))msg!("read offset at index {$index} of `.debug_str_offsets.dwo` section")).with_arg("index", index)
279            }
280            thorin::Error::StrAtOffset(_, offset) => {
281                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read string at offset {$offset} of `.debug_str.dwo` section"))msg!("read string at offset {$offset} of `.debug_str.dwo` section"))
282                    .with_arg("offset", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", offset))
    })format!("0x{offset:08x}"))
283            }
284            thorin::Error::ParseIndex(_, section) => {
285                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse `{$section}` index section"))msg!("failed to parse `{$section}` index section")).with_arg("section", section)
286            }
287            thorin::Error::UnitNotInIndex(unit) => {
288                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unit {$unit} from input package is not in its index"))msg!("unit {$unit} from input package is not in its index"))
289                    .with_arg("unit", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", unit))
    })format!("0x{unit:08x}"))
290            }
291            thorin::Error::RowNotInIndex(_, row) => {
292                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("row {$row} found in index's hash table not present in index"))msg!("row {$row} found in index's hash table not present in index")).with_arg("row", row)
293            }
294            thorin::Error::SectionNotInRow => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("section not found in unit's row in index"))msg!("section not found in unit's row in index")),
295            thorin::Error::EmptyUnit(unit) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unit {$unit} in input DWARF object with no data"))msg!("unit {$unit} in input DWARF object with no data"))
296                .with_arg("unit", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", unit))
    })format!("0x{unit:08x}")),
297            thorin::Error::MultipleDebugInfoSection => {
298                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `.debug_info.dwo` sections"))msg!("multiple `.debug_info.dwo` sections"))
299            }
300            thorin::Error::MultipleDebugTypesSection => {
301                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `.debug_types.dwo` sections in a package"))msg!("multiple `.debug_types.dwo` sections in a package"))
302            }
303            thorin::Error::NotSplitUnit => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("regular compilation unit in object (missing dwo identifier)"))msg!("regular compilation unit in object (missing dwo identifier)")),
304            thorin::Error::DuplicateUnit(unit) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate split compilation unit ({$unit})"))msg!("duplicate split compilation unit ({$unit})"))
305                .with_arg("unit", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", unit))
    })format!("0x{unit:08x}")),
306            thorin::Error::MissingReferencedUnit(unit) => {
307                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unit {$unit} referenced by executable was not found"))msg!("unit {$unit} referenced by executable was not found"))
308                    .with_arg("unit", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("0x{0:08x}", unit))
    })format!("0x{unit:08x}"))
309            }
310            thorin::Error::NoOutputObjectCreated => {
311                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no output object was created from inputs"))msg!("no output object was created from inputs"))
312            }
313            thorin::Error::MixedInputEncodings => {
314                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("input objects have mixed encodings"))msg!("input objects have mixed encodings"))
315            }
316            thorin::Error::Io(e) => {
317                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
318            }
319            thorin::Error::ObjectRead(e) => {
320                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
321            }
322            thorin::Error::ObjectWrite(e) => {
323                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
324            }
325            thorin::Error::GimliRead(e) => {
326                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
327            }
328            thorin::Error::GimliWrite(e) => {
329                build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
330            }
331            _ => {
    ::core::panicking::panic_fmt(format_args!("not implemented: {0}",
            format_args!("Untranslated thorin error")));
}unimplemented!("Untranslated thorin error"),
332        }
333    }
334}
335
336pub(crate) struct LinkingFailed<'a> {
337    pub linker_path: &'a Path,
338    pub exit_status: ExitStatus,
339    pub command: Command,
340    pub escaped_output: String,
341    pub verbose: bool,
342    pub sysroot_dir: PathBuf,
343}
344
345impl<G: EmissionGuarantee> Diagnostic<'_, G> for LinkingFailed<'_> {
346    fn into_diag(mut self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
347        let mut diag =
348            Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking with `{$linker_path}` failed: {$exit_status}"))msg!("linking with `{$linker_path}` failed: {$exit_status}"));
349        diag.arg("linker_path", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}", self.linker_path.display()))
    })format!("{}", self.linker_path.display()));
350        diag.arg("exit_status", ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}", self.exit_status))
    })format!("{}", self.exit_status));
351
352        let contains_undefined_ref = self.escaped_output.contains("undefined reference to");
353
354        if self.verbose {
355            diag.note(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:?}", self.command))
    })format!("{:?}", self.command));
356        } else {
357            self.command.env_clear();
358
359            enum ArgGroup {
360                Regular(OsString),
361                Objects(usize),
362                Rlibs(PathBuf, Vec<OsString>),
363            }
364
365            // Omit rust object files and fold rlibs in the error by default to make linker errors a
366            // bit less verbose.
367            let orig_args = self.command.take_args();
368            let mut args: Vec<ArgGroup> = ::alloc::vec::Vec::new()vec![];
369            for arg in orig_args {
370                if arg.as_encoded_bytes().ends_with(b".rcgu.o") {
371                    if let Some(ArgGroup::Objects(n)) = args.last_mut() {
372                        *n += 1;
373                    } else {
374                        args.push(ArgGroup::Objects(1));
375                    }
376                } else if arg.as_encoded_bytes().ends_with(b".rlib") {
377                    let rlib_path = Path::new(&arg);
378                    let dir = rlib_path.parent().unwrap();
379                    let filename = rlib_path.file_stem().unwrap().to_owned();
380                    if let Some(ArgGroup::Rlibs(parent, rlibs)) = args.last_mut() {
381                        if parent == dir {
382                            rlibs.push(filename);
383                        } else {
384                            args.push(ArgGroup::Rlibs(dir.to_owned(), ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [filename]))vec![filename]));
385                        }
386                    } else {
387                        args.push(ArgGroup::Rlibs(dir.to_owned(), ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [filename]))vec![filename]));
388                    }
389                } else {
390                    args.push(ArgGroup::Regular(arg));
391                }
392            }
393            let crate_hash = regex::bytes::Regex::new(r"-[0-9a-f]+").unwrap();
394            self.command.args(args.into_iter().map(|arg_group| {
395                match arg_group {
396                    // SAFETY: we are only matching on ASCII, not any surrogate pairs, so any replacements we do will still be valid.
397                    ArgGroup::Regular(arg) => unsafe {
398                        use bstr::ByteSlice;
399                        OsString::from_encoded_bytes_unchecked(
400                            arg.as_encoded_bytes().replace(
401                                self.sysroot_dir.as_os_str().as_encoded_bytes(),
402                                b"<sysroot>",
403                            ),
404                        )
405                    },
406                    ArgGroup::Objects(n) => OsString::from(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("<{0} object files omitted>", n))
    })format!("<{n} object files omitted>")),
407                    ArgGroup::Rlibs(mut dir, rlibs) => {
408                        let is_sysroot_dir = match dir.strip_prefix(&self.sysroot_dir) {
409                            Ok(short) => {
410                                dir = Path::new("<sysroot>").join(short);
411                                true
412                            }
413                            Err(_) => false,
414                        };
415                        let mut arg = dir.into_os_string();
416                        arg.push("/");
417                        let needs_braces = rlibs.len() >= 2;
418                        if needs_braces {
419                            arg.push("{");
420                        }
421                        let mut first = true;
422                        for mut rlib in rlibs {
423                            if !first {
424                                arg.push(",");
425                            }
426                            first = false;
427                            if is_sysroot_dir {
428                                // SAFETY: Regex works one byte at a type, and our regex will not match surrogate pairs (because it only matches ascii).
429                                rlib = unsafe {
430                                    OsString::from_encoded_bytes_unchecked(
431                                        crate_hash
432                                            .replace(rlib.as_encoded_bytes(), b"-*")
433                                            .into_owned(),
434                                    )
435                                };
436                            }
437                            arg.push(rlib);
438                        }
439                        if needs_braces {
440                            arg.push("}");
441                        }
442                        arg.push(".rlib");
443                        arg
444                    }
445                }
446            }));
447
448            diag.note(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:?}", self.command))
    })format!("{:?}", self.command).trim_start_matches("env -i").to_owned());
449            diag.note("some arguments are omitted. use `--verbose` to show all linker arguments");
450        }
451
452        diag.note(self.escaped_output);
453
454        // Trying to match an error from OS linkers
455        // which by now we have no way to translate.
456        if contains_undefined_ref {
457            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified"))msg!("some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified"))
458                .note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the `-l` flag to specify native libraries to link"))msg!("use the `-l` flag to specify native libraries to link"));
459
460            if rustc_session::utils::was_invoked_from_cargo() {
461                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)"))msg!("use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)"));
462            }
463        }
464        diag
465    }
466}
467
468#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LinkExeUnexpectedError where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkExeUnexpectedError => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`link.exe` returned an unexpected error")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
469#[diag("`link.exe` returned an unexpected error")]
470pub(crate) struct LinkExeUnexpectedError;
471
472pub(crate) struct LinkExeStatusStackBufferOverrun;
473
474impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for LinkExeStatusStackBufferOverrun {
475    fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
476        let mut diag = Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("0xc0000409 is `STATUS_STACK_BUFFER_OVERRUN`"))msg!("0xc0000409 is `STATUS_STACK_BUFFER_OVERRUN`"));
477        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this may have been caused by a program abort and not a stack buffer overrun"))msg!(
478            "this may have been caused by a program abort and not a stack buffer overrun"
479        ));
480        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider checking the Application Event Log for Windows Error Reporting events to see the fail fast error code"))msg!("consider checking the Application Event Log for Windows Error Reporting events to see the fail fast error code"));
481        diag
482    }
483}
484
485#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RepairVSBuildTools where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RepairVSBuildTools => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the Visual Studio build tools may need to be repaired using the Visual Studio installer")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
486#[diag("the Visual Studio build tools may need to be repaired using the Visual Studio installer")]
487pub(crate) struct RepairVSBuildTools;
488
489#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingCppBuildToolComponent where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MissingCppBuildToolComponent => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or a necessary component may be missing from the \"C++ build tools\" workload")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
490#[diag("or a necessary component may be missing from the \"C++ build tools\" workload")]
491pub(crate) struct MissingCppBuildToolComponent;
492
493#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SelectCppBuildToolWorkload where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SelectCppBuildToolWorkload => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in the Visual Studio installer, ensure the \"C++ build tools\" workload is selected")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
494#[diag("in the Visual Studio installer, ensure the \"C++ build tools\" workload is selected")]
495pub(crate) struct SelectCppBuildToolWorkload;
496
497#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            VisualStudioNotInstalled where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    VisualStudioNotInstalled => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you may need to install Visual Studio build tools with the \"C++ build tools\" workload")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
498#[diag("you may need to install Visual Studio build tools with the \"C++ build tools\" workload")]
499pub(crate) struct VisualStudioNotInstalled;
500
501#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LinkerNotFound
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkerNotFound {
                        linker_path: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linker `{$linker_path}` not found")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}")));
                        ;
                        diag.arg("linker_path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
502#[diag("linker `{$linker_path}` not found")]
503#[note("{$error}")]
504pub(crate) struct LinkerNotFound {
505    pub linker_path: PathBuf,
506    pub error: Error,
507}
508
509#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnableToExeLinker where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnableToExeLinker {
                        linker_path: __binding_0,
                        error: __binding_1,
                        command_formatted: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not exec the linker `{$linker_path}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$command_formatted}")));
                        ;
                        diag.arg("linker_path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag.arg("command_formatted", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
510#[diag("could not exec the linker `{$linker_path}`")]
511#[note("{$error}")]
512#[note("{$command_formatted}")]
513pub(crate) struct UnableToExeLinker {
514    pub linker_path: PathBuf,
515    pub error: Error,
516    pub command_formatted: String,
517}
518
519#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MsvcMissingLinker where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MsvcMissingLinker => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the msvc targets depend on the msvc linker but `link.exe` was not found")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
520#[diag("the msvc targets depend on the msvc linker but `link.exe` was not found")]
521pub(crate) struct MsvcMissingLinker;
522
523#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SelfContainedLinkerMissing where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SelfContainedLinkerMissing => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the self-contained linker was requested, but it wasn't found in the target's sysroot, or in rustc's sysroot")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
524#[diag(
525    "the self-contained linker was requested, but it wasn't found in the target's sysroot, or in rustc's sysroot"
526)]
527pub(crate) struct SelfContainedLinkerMissing;
528
529#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CheckInstalledVisualStudio where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CheckInstalledVisualStudio => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
530#[diag(
531    "please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option"
532)]
533pub(crate) struct CheckInstalledVisualStudio;
534
535#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InsufficientVSCodeProduct where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InsufficientVSCodeProduct => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("VS Code is a different product, and is not sufficient")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
536#[diag("VS Code is a different product, and is not sufficient")]
537pub(crate) struct InsufficientVSCodeProduct;
538
539#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CpuRequired
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CpuRequired => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target requires explicitly specifying a cpu with `-C target-cpu`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
540#[diag("target requires explicitly specifying a cpu with `-C target-cpu`")]
541pub(crate) struct CpuRequired;
542
543#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ProcessingDymutilFailed where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ProcessingDymutilFailed {
                        status: __binding_0, output: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("processing debug info with `dsymutil` failed: {$status}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$output}")));
                        ;
                        diag.arg("status", __binding_0);
                        diag.arg("output", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
544#[diag("processing debug info with `dsymutil` failed: {$status}")]
545#[note("{$output}")]
546pub(crate) struct ProcessingDymutilFailed {
547    pub status: ExitStatus,
548    pub output: String,
549}
550
551#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnableToRunDsymutil where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnableToRunDsymutil { error: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unable to run `dsymutil`: {$error}")));
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
552#[diag("unable to run `dsymutil`: {$error}")]
553pub(crate) struct UnableToRunDsymutil {
554    pub error: Error,
555}
556
557#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            StrippingDebugInfoFailed<'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 {
                    StrippingDebugInfoFailed {
                        util: __binding_0, status: __binding_1, output: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("stripping debug info with `{$util}` failed: {$status}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$output}")));
                        ;
                        diag.arg("util", __binding_0);
                        diag.arg("status", __binding_1);
                        diag.arg("output", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
558#[diag("stripping debug info with `{$util}` failed: {$status}")]
559#[note("{$output}")]
560pub(crate) struct StrippingDebugInfoFailed<'a> {
561    pub util: &'a str,
562    pub status: ExitStatus,
563    pub output: String,
564}
565
566#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            UnableToRun<'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 {
                    UnableToRun { util: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unable to run `{$util}`: {$error}")));
                        ;
                        diag.arg("util", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
567#[diag("unable to run `{$util}`: {$error}")]
568pub(crate) struct UnableToRun<'a> {
569    pub util: &'a str,
570    pub error: Error,
571}
572
573#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LinkerFileStem
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkerFileStem => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("couldn't extract file stem from specified linker")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
574#[diag("couldn't extract file stem from specified linker")]
575pub(crate) struct LinkerFileStem;
576
577#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            StaticLibraryNativeArtifacts where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    StaticLibraryNativeArtifacts => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
578#[diag(
579    "link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms"
580)]
581pub(crate) struct StaticLibraryNativeArtifacts;
582
583#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            StaticLibraryNativeArtifactsToFile<'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 {
                    StaticLibraryNativeArtifactsToFile { path: __binding_0 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("native artifacts to link against have been written to {$path}. The order and any duplication can be significant on some platforms")));
                        ;
                        diag.arg("path", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
584#[diag(
585    "native artifacts to link against have been written to {$path}. The order and any duplication can be significant on some platforms"
586)]
587pub(crate) struct StaticLibraryNativeArtifactsToFile<'a> {
588    pub path: &'a Path,
589}
590
591#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LinkScriptUnavailable where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkScriptUnavailable => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can only use link script when linking with GNU-like linker")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
592#[diag("can only use link script when linking with GNU-like linker")]
593pub(crate) struct LinkScriptUnavailable;
594
595#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LinkScriptWriteFailure where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkScriptWriteFailure {
                        path: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write link script to {$path}: {$error}")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
596#[diag("failed to write link script to {$path}: {$error}")]
597pub(crate) struct LinkScriptWriteFailure {
598    pub path: PathBuf,
599    pub error: Error,
600}
601
602#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for FailedToWrite
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FailedToWrite { path: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write {$path}: {$error}")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
603#[diag("failed to write {$path}: {$error}")]
604pub(crate) struct FailedToWrite {
605    pub path: PathBuf,
606    pub error: Error,
607}
608
609#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnableToWriteDebuggerVisualizer where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnableToWriteDebuggerVisualizer {
                        path: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unable to write debugger visualizer file `{$path}`: {$error}")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
610#[diag("unable to write debugger visualizer file `{$path}`: {$error}")]
611pub(crate) struct UnableToWriteDebuggerVisualizer {
612    pub path: PathBuf,
613    pub error: Error,
614}
615
616#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RlibArchiveBuildFailure where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RlibArchiveBuildFailure {
                        path: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to build archive from rlib at `{$path}`: {$error}")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
617#[diag("failed to build archive from rlib at `{$path}`: {$error}")]
618pub(crate) struct RlibArchiveBuildFailure {
619    pub path: PathBuf,
620    pub error: Error,
621}
622
623#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ExtractBundledLibsError<'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 {
                    ExtractBundledLibsError::OpenFile {
                        rlib: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to open file '{$rlib}': {$error}")));
                        ;
                        diag.arg("rlib", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                    ExtractBundledLibsError::MmapFile {
                        rlib: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to mmap file '{$rlib}': {$error}")));
                        ;
                        diag.arg("rlib", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                    ExtractBundledLibsError::ParseArchive {
                        rlib: __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 archive '{$rlib}': {$error}")));
                        ;
                        diag.arg("rlib", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                    ExtractBundledLibsError::ReadEntry {
                        rlib: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to read entry '{$rlib}': {$error}")));
                        ;
                        diag.arg("rlib", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                    ExtractBundledLibsError::ArchiveMember {
                        rlib: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to get data from archive member '{$rlib}': {$error}")));
                        ;
                        diag.arg("rlib", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                    ExtractBundledLibsError::ConvertName {
                        rlib: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to convert name '{$rlib}': {$error}")));
                        ;
                        diag.arg("rlib", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                    ExtractBundledLibsError::WriteFile {
                        rlib: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write file '{$rlib}': {$error}")));
                        ;
                        diag.arg("rlib", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                    ExtractBundledLibsError::ExtractSection {
                        rlib: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write file '{$rlib}': {$error}")));
                        ;
                        diag.arg("rlib", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
624// Public for ArchiveBuilderBuilder::extract_bundled_libs
625pub enum ExtractBundledLibsError<'a> {
626    #[diag("failed to open file '{$rlib}': {$error}")]
627    OpenFile { rlib: &'a Path, error: Box<dyn std::error::Error> },
628
629    #[diag("failed to mmap file '{$rlib}': {$error}")]
630    MmapFile { rlib: &'a Path, error: Box<dyn std::error::Error> },
631
632    #[diag("failed to parse archive '{$rlib}': {$error}")]
633    ParseArchive { rlib: &'a Path, error: Box<dyn std::error::Error> },
634
635    #[diag("failed to read entry '{$rlib}': {$error}")]
636    ReadEntry { rlib: &'a Path, error: Box<dyn std::error::Error> },
637
638    #[diag("failed to get data from archive member '{$rlib}': {$error}")]
639    ArchiveMember { rlib: &'a Path, error: Box<dyn std::error::Error> },
640
641    #[diag("failed to convert name '{$rlib}': {$error}")]
642    ConvertName { rlib: &'a Path, error: Box<dyn std::error::Error> },
643
644    #[diag("failed to write file '{$rlib}': {$error}")]
645    WriteFile { rlib: &'a Path, error: Box<dyn std::error::Error> },
646
647    #[diag("failed to write file '{$rlib}': {$error}")]
648    ExtractSection { rlib: &'a Path, error: Box<dyn std::error::Error> },
649}
650
651#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for ReadFileError
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ReadFileError { message: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to read file: {$message}")));
                        ;
                        diag.arg("message", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
652#[diag("failed to read file: {$message}")]
653pub(crate) struct ReadFileError {
654    pub message: std::io::Error,
655}
656
657#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnsupportedLinkSelfContained where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnsupportedLinkSelfContained => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("option `-C link-self-contained` is not supported on this target")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
658#[diag("option `-C link-self-contained` is not supported on this target")]
659pub(crate) struct UnsupportedLinkSelfContained;
660
661#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ArchiveBuildFailure where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ArchiveBuildFailure { path: __binding_0, error: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to build archive at `{$path}`: {$error}")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
662#[diag("failed to build archive at `{$path}`: {$error}")]
663pub(crate) struct ArchiveBuildFailure {
664    pub path: PathBuf,
665    pub error: std::io::Error,
666}
667
668#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownArchiveKind<'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 {
                    UnknownArchiveKind { kind: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("don't know how to build archive of type: {$kind}")));
                        ;
                        diag.arg("kind", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
669#[diag("don't know how to build archive of type: {$kind}")]
670pub(crate) struct UnknownArchiveKind<'a> {
671    pub kind: &'a str,
672}
673
674#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BpfStaticlibNotSupported where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BpfStaticlibNotSupported => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking static libraries is not supported for BPF")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
675#[diag("linking static libraries is not supported for BPF")]
676pub(crate) struct BpfStaticlibNotSupported;
677
678#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleMainFunctions where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MultipleMainFunctions { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("entry symbol `main` declared multiple times")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did you use `#[no_mangle]` on `fn main`? Use `#![no_main]` to suppress the usual Rust-generated entry point")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
679#[diag("entry symbol `main` declared multiple times")]
680#[help(
681    "did you use `#[no_mangle]` on `fn main`? Use `#![no_main]` to suppress the usual Rust-generated entry point"
682)]
683pub(crate) struct MultipleMainFunctions {
684    #[primary_span]
685    pub span: Span,
686}
687
688#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ShuffleIndicesEvaluation where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ShuffleIndicesEvaluation { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not evaluate shuffle_indices at compile time")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
689#[diag("could not evaluate shuffle_indices at compile time")]
690pub(crate) struct ShuffleIndicesEvaluation {
691    #[primary_span]
692    pub span: Span,
693}
694
695#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidMonomorphization<'tcx> where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    InvalidMonomorphization::BasicIntegerType {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected basic integer type, found `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::BasicIntegerOrPtrType {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected basic integer or pointer type, found `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::BasicFloatType {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected basic float type, found `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::FloatToIntUnchecked {
                        span: __binding_0, ty: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `float_to_int_unchecked` intrinsic: expected basic float type, found `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("ty", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::FloatingPointVector {
                        span: __binding_0,
                        name: __binding_1,
                        f_ty: __binding_2,
                        in_ty: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported element type `{$f_ty}` of floating-point vector `{$in_ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("f_ty", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::UnrecognizedIntrinsic {
                        span: __binding_0, name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unrecognized intrinsic `{$name}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::SimdArgument {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD argument type, found non-SIMD `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::SimdInput {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD input type, found non-SIMD `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::SimdFirst {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD first type, found non-SIMD `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::SimdSecond {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD second type, found non-SIMD `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::SimdThird {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD third type, found non-SIMD `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::SimdReturn {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD return type, found non-SIMD `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::InvalidBitmask {
                        span: __binding_0,
                        name: __binding_1,
                        mask_ty: __binding_2,
                        expected_int_bits: __binding_3,
                        expected_bytes: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: invalid bitmask `{$mask_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("mask_ty", __binding_2);
                        diag.arg("expected_int_bits", __binding_3);
                        diag.arg("expected_bytes", __binding_4);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ReturnLengthInputType {
                        span: __binding_0,
                        name: __binding_1,
                        in_len: __binding_2,
                        in_ty: __binding_3,
                        ret_ty: __binding_4,
                        out_len: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type with length {$in_len} (same as input type `{$in_ty}`), found `{$ret_ty}` with length {$out_len}")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_len", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.arg("ret_ty", __binding_4);
                        diag.arg("out_len", __binding_5);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ReturnNumVecsInputType {
                        span: __binding_0,
                        name: __binding_1,
                        in_num_vecs: __binding_2,
                        in_ty: __binding_3,
                        ret_ty: __binding_4,
                        out_num_vecs: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type with {$in_num_vecs} vectors (same as input type `{$in_ty}`), found `{$ret_ty}` with length {$out_num_vecs}")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_num_vecs", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.arg("ret_ty", __binding_4);
                        diag.arg("out_num_vecs", __binding_5);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::SecondArgumentLength {
                        span: __binding_0,
                        name: __binding_1,
                        in_len: __binding_2,
                        in_ty: __binding_3,
                        arg_ty: __binding_4,
                        out_len: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected second argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len}")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_len", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.arg("arg_ty", __binding_4);
                        diag.arg("out_len", __binding_5);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ThirdArgumentLength {
                        span: __binding_0,
                        name: __binding_1,
                        in_len: __binding_2,
                        in_ty: __binding_3,
                        arg_ty: __binding_4,
                        out_len: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected third argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len}")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_len", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.arg("arg_ty", __binding_4);
                        diag.arg("out_len", __binding_5);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ReturnIntegerType {
                        span: __binding_0,
                        name: __binding_1,
                        ret_ty: __binding_2,
                        out_ty: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type with integer elements, found `{$ret_ty}` with non-integer `{$out_ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ret_ty", __binding_2);
                        diag.arg("out_ty", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::SimdShuffle {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ReturnLength {
                        span: __binding_0,
                        name: __binding_1,
                        in_len: __binding_2,
                        ret_ty: __binding_3,
                        out_len: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type of length {$in_len}, found `{$ret_ty}` with length {$out_len}")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_len", __binding_2);
                        diag.arg("ret_ty", __binding_3);
                        diag.arg("out_len", __binding_4);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ReturnElement {
                        span: __binding_0,
                        name: __binding_1,
                        in_elem: __binding_2,
                        in_ty: __binding_3,
                        ret_ty: __binding_4,
                        out_ty: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return element type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}` with element type `{$out_ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_elem", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.arg("ret_ty", __binding_4);
                        diag.arg("out_ty", __binding_5);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::SimdIndexOutOfBounds {
                        span: __binding_0,
                        name: __binding_1,
                        arg_idx: __binding_2,
                        total_len: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: SIMD index #{$arg_idx} is out of bounds (limit {$total_len})")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("arg_idx", __binding_2);
                        diag.arg("total_len", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::InsertedType {
                        span: __binding_0,
                        name: __binding_1,
                        in_elem: __binding_2,
                        in_ty: __binding_3,
                        out_ty: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected inserted type `{$in_elem}` (element of input `{$in_ty}`), found `{$out_ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_elem", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.arg("out_ty", __binding_4);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ReturnType {
                        span: __binding_0,
                        name: __binding_1,
                        in_elem: __binding_2,
                        in_ty: __binding_3,
                        ret_ty: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_elem", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.arg("ret_ty", __binding_4);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ExpectedReturnType {
                        span: __binding_0,
                        name: __binding_1,
                        in_ty: __binding_2,
                        ret_ty: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_ty}`, found `{$ret_ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_ty", __binding_2);
                        diag.arg("ret_ty", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::MismatchedLengths {
                        span: __binding_0,
                        name: __binding_1,
                        m_len: __binding_2,
                        v_len: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: mismatched lengths: mask length `{$m_len}` != other vector length `{$v_len}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("m_len", __binding_2);
                        diag.arg("v_len", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::MaskWrongElementType {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected mask element type to be an integer, found `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::CannotReturn {
                        span: __binding_0,
                        name: __binding_1,
                        ret_ty: __binding_2,
                        expected_int_bits: __binding_3,
                        expected_bytes: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: cannot return `{$ret_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ret_ty", __binding_2);
                        diag.arg("expected_int_bits", __binding_3);
                        diag.arg("expected_bytes", __binding_4);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ExpectedElementType {
                        span: __binding_0,
                        name: __binding_1,
                        expected_element: __binding_2,
                        second_arg: __binding_3,
                        in_elem: __binding_4,
                        in_ty: __binding_5,
                        mutability: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of second argument `{$second_arg}` to be a pointer to the element type `{$in_elem}` of the first argument `{$in_ty}`, found `{$expected_element}` != `{$mutability} {$in_elem}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("expected_element", __binding_2);
                        diag.arg("second_arg", __binding_3);
                        diag.arg("in_elem", __binding_4);
                        diag.arg("in_ty", __binding_5);
                        diag.arg("mutability", __binding_6);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::UnsupportedSymbolOfSize {
                        span: __binding_0,
                        name: __binding_1,
                        symbol: __binding_2,
                        in_ty: __binding_3,
                        in_elem: __binding_4,
                        size: __binding_5,
                        ret_ty: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported {$symbol} from `{$in_ty}` with element `{$in_elem}` of size `{$size}` to `{$ret_ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("symbol", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.arg("in_elem", __binding_4);
                        diag.arg("size", __binding_5);
                        diag.arg("ret_ty", __binding_6);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::UnsupportedSymbol {
                        span: __binding_0,
                        name: __binding_1,
                        symbol: __binding_2,
                        in_ty: __binding_3,
                        in_elem: __binding_4,
                        ret_ty: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported {$symbol} from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("symbol", __binding_2);
                        diag.arg("in_ty", __binding_3);
                        diag.arg("in_elem", __binding_4);
                        diag.arg("ret_ty", __binding_5);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::CastWidePointer {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: cannot cast wide pointer `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ExpectedPointer {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected pointer, got `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ExpectedUsize {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected `usize`, got `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::UnsupportedCast {
                        span: __binding_0,
                        name: __binding_1,
                        in_ty: __binding_2,
                        in_elem: __binding_3,
                        ret_ty: __binding_4,
                        out_elem: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported cast from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}` with element `{$out_elem}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_ty", __binding_2);
                        diag.arg("in_elem", __binding_3);
                        diag.arg("ret_ty", __binding_4);
                        diag.arg("out_elem", __binding_5);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::UnsupportedOperation {
                        span: __binding_0,
                        name: __binding_1,
                        in_ty: __binding_2,
                        in_elem: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported operation on `{$in_ty}` with element `{$in_elem}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("in_ty", __binding_2);
                        diag.arg("in_elem", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::ExpectedVectorElementType {
                        span: __binding_0,
                        name: __binding_1,
                        expected_element: __binding_2,
                        vector_type: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of vector type `{$vector_type}` to be a signed or unsigned integer type")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("expected_element", __binding_2);
                        diag.arg("vector_type", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                    InvalidMonomorphization::NonScalableType {
                        span: __binding_0, name: __binding_1, ty: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected non-scalable type, found scalable type `{$ty}`")));
                        diag.code(E0511);
                        ;
                        diag.arg("name", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
696pub enum InvalidMonomorphization<'tcx> {
697    #[diag("invalid monomorphization of `{$name}` intrinsic: expected basic integer type, found `{$ty}`", code = E0511)]
698    BasicIntegerType {
699        #[primary_span]
700        span: Span,
701        name: Symbol,
702        ty: Ty<'tcx>,
703    },
704
705    #[diag("invalid monomorphization of `{$name}` intrinsic: expected basic integer or pointer type, found `{$ty}`", code = E0511)]
706    BasicIntegerOrPtrType {
707        #[primary_span]
708        span: Span,
709        name: Symbol,
710        ty: Ty<'tcx>,
711    },
712
713    #[diag("invalid monomorphization of `{$name}` intrinsic: expected basic float type, found `{$ty}`", code = E0511)]
714    BasicFloatType {
715        #[primary_span]
716        span: Span,
717        name: Symbol,
718        ty: Ty<'tcx>,
719    },
720
721    #[diag("invalid monomorphization of `float_to_int_unchecked` intrinsic: expected basic float type, found `{$ty}`", code = E0511)]
722    FloatToIntUnchecked {
723        #[primary_span]
724        span: Span,
725        ty: Ty<'tcx>,
726    },
727
728    #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported element type `{$f_ty}` of floating-point vector `{$in_ty}`", code = E0511)]
729    FloatingPointVector {
730        #[primary_span]
731        span: Span,
732        name: Symbol,
733        f_ty: FloatTy,
734        in_ty: Ty<'tcx>,
735    },
736
737    #[diag("invalid monomorphization of `{$name}` intrinsic: unrecognized intrinsic `{$name}`", code = E0511)]
738    UnrecognizedIntrinsic {
739        #[primary_span]
740        span: Span,
741        name: Symbol,
742    },
743
744    #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD argument type, found non-SIMD `{$ty}`", code = E0511)]
745    SimdArgument {
746        #[primary_span]
747        span: Span,
748        name: Symbol,
749        ty: Ty<'tcx>,
750    },
751
752    #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD input type, found non-SIMD `{$ty}`", code = E0511)]
753    SimdInput {
754        #[primary_span]
755        span: Span,
756        name: Symbol,
757        ty: Ty<'tcx>,
758    },
759
760    #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD first type, found non-SIMD `{$ty}`", code = E0511)]
761    SimdFirst {
762        #[primary_span]
763        span: Span,
764        name: Symbol,
765        ty: Ty<'tcx>,
766    },
767
768    #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD second type, found non-SIMD `{$ty}`", code = E0511)]
769    SimdSecond {
770        #[primary_span]
771        span: Span,
772        name: Symbol,
773        ty: Ty<'tcx>,
774    },
775
776    #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD third type, found non-SIMD `{$ty}`", code = E0511)]
777    SimdThird {
778        #[primary_span]
779        span: Span,
780        name: Symbol,
781        ty: Ty<'tcx>,
782    },
783
784    #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD return type, found non-SIMD `{$ty}`", code = E0511)]
785    SimdReturn {
786        #[primary_span]
787        span: Span,
788        name: Symbol,
789        ty: Ty<'tcx>,
790    },
791
792    #[diag("invalid monomorphization of `{$name}` intrinsic: invalid bitmask `{$mask_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`", code = E0511)]
793    InvalidBitmask {
794        #[primary_span]
795        span: Span,
796        name: Symbol,
797        mask_ty: Ty<'tcx>,
798        expected_int_bits: u64,
799        expected_bytes: u64,
800    },
801
802    #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type with length {$in_len} (same as input type `{$in_ty}`), found `{$ret_ty}` with length {$out_len}", code = E0511)]
803    ReturnLengthInputType {
804        #[primary_span]
805        span: Span,
806        name: Symbol,
807        in_len: u64,
808        in_ty: Ty<'tcx>,
809        ret_ty: Ty<'tcx>,
810        out_len: u64,
811    },
812
813    #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type with {$in_num_vecs} vectors (same as input type `{$in_ty}`), found `{$ret_ty}` with length {$out_num_vecs}", code = E0511)]
814    ReturnNumVecsInputType {
815        #[primary_span]
816        span: Span,
817        name: Symbol,
818        in_num_vecs: NumScalableVectors,
819        in_ty: Ty<'tcx>,
820        ret_ty: Ty<'tcx>,
821        out_num_vecs: NumScalableVectors,
822    },
823
824    #[diag("invalid monomorphization of `{$name}` intrinsic: expected second argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len}", code = E0511)]
825    SecondArgumentLength {
826        #[primary_span]
827        span: Span,
828        name: Symbol,
829        in_len: u64,
830        in_ty: Ty<'tcx>,
831        arg_ty: Ty<'tcx>,
832        out_len: u64,
833    },
834
835    #[diag("invalid monomorphization of `{$name}` intrinsic: expected third argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len}", code = E0511)]
836    ThirdArgumentLength {
837        #[primary_span]
838        span: Span,
839        name: Symbol,
840        in_len: u64,
841        in_ty: Ty<'tcx>,
842        arg_ty: Ty<'tcx>,
843        out_len: u64,
844    },
845
846    #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type with integer elements, found `{$ret_ty}` with non-integer `{$out_ty}`", code = E0511)]
847    ReturnIntegerType {
848        #[primary_span]
849        span: Span,
850        name: Symbol,
851        ret_ty: Ty<'tcx>,
852        out_ty: Ty<'tcx>,
853    },
854
855    #[diag("invalid monomorphization of `{$name}` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `{$ty}`", code = E0511)]
856    SimdShuffle {
857        #[primary_span]
858        span: Span,
859        name: Symbol,
860        ty: Ty<'tcx>,
861    },
862
863    #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type of length {$in_len}, found `{$ret_ty}` with length {$out_len}", code = E0511)]
864    ReturnLength {
865        #[primary_span]
866        span: Span,
867        name: Symbol,
868        in_len: u64,
869        ret_ty: Ty<'tcx>,
870        out_len: u64,
871    },
872
873    #[diag("invalid monomorphization of `{$name}` intrinsic: expected return element type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}` with element type `{$out_ty}`", code = E0511)]
874    ReturnElement {
875        #[primary_span]
876        span: Span,
877        name: Symbol,
878        in_elem: Ty<'tcx>,
879        in_ty: Ty<'tcx>,
880        ret_ty: Ty<'tcx>,
881        out_ty: Ty<'tcx>,
882    },
883
884    #[diag("invalid monomorphization of `{$name}` intrinsic: SIMD index #{$arg_idx} is out of bounds (limit {$total_len})", code = E0511)]
885    SimdIndexOutOfBounds {
886        #[primary_span]
887        span: Span,
888        name: Symbol,
889        arg_idx: u64,
890        total_len: u128,
891    },
892
893    #[diag("invalid monomorphization of `{$name}` intrinsic: expected inserted type `{$in_elem}` (element of input `{$in_ty}`), found `{$out_ty}`", code = E0511)]
894    InsertedType {
895        #[primary_span]
896        span: Span,
897        name: Symbol,
898        in_elem: Ty<'tcx>,
899        in_ty: Ty<'tcx>,
900        out_ty: Ty<'tcx>,
901    },
902
903    #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}`", code = E0511)]
904    ReturnType {
905        #[primary_span]
906        span: Span,
907        name: Symbol,
908        in_elem: Ty<'tcx>,
909        in_ty: Ty<'tcx>,
910        ret_ty: Ty<'tcx>,
911    },
912
913    #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_ty}`, found `{$ret_ty}`", code = E0511)]
914    ExpectedReturnType {
915        #[primary_span]
916        span: Span,
917        name: Symbol,
918        in_ty: Ty<'tcx>,
919        ret_ty: Ty<'tcx>,
920    },
921
922    #[diag("invalid monomorphization of `{$name}` intrinsic: mismatched lengths: mask length `{$m_len}` != other vector length `{$v_len}`", code = E0511)]
923    MismatchedLengths {
924        #[primary_span]
925        span: Span,
926        name: Symbol,
927        m_len: u64,
928        v_len: u64,
929    },
930
931    #[diag("invalid monomorphization of `{$name}` intrinsic: expected mask element type to be an integer, found `{$ty}`", code = E0511)]
932    MaskWrongElementType {
933        #[primary_span]
934        span: Span,
935        name: Symbol,
936        ty: Ty<'tcx>,
937    },
938
939    #[diag("invalid monomorphization of `{$name}` intrinsic: cannot return `{$ret_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`", code = E0511)]
940    CannotReturn {
941        #[primary_span]
942        span: Span,
943        name: Symbol,
944        ret_ty: Ty<'tcx>,
945        expected_int_bits: u64,
946        expected_bytes: u64,
947    },
948
949    #[diag("invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of second argument `{$second_arg}` to be a pointer to the element type `{$in_elem}` of the first argument `{$in_ty}`, found `{$expected_element}` != `{$mutability} {$in_elem}`", code = E0511)]
950    ExpectedElementType {
951        #[primary_span]
952        span: Span,
953        name: Symbol,
954        expected_element: Ty<'tcx>,
955        second_arg: Ty<'tcx>,
956        in_elem: Ty<'tcx>,
957        in_ty: Ty<'tcx>,
958        mutability: ExpectedPointerMutability,
959    },
960
961    #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported {$symbol} from `{$in_ty}` with element `{$in_elem}` of size `{$size}` to `{$ret_ty}`", code = E0511)]
962    UnsupportedSymbolOfSize {
963        #[primary_span]
964        span: Span,
965        name: Symbol,
966        symbol: Symbol,
967        in_ty: Ty<'tcx>,
968        in_elem: Ty<'tcx>,
969        size: u64,
970        ret_ty: Ty<'tcx>,
971    },
972
973    #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported {$symbol} from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}`", code = E0511)]
974    UnsupportedSymbol {
975        #[primary_span]
976        span: Span,
977        name: Symbol,
978        symbol: Symbol,
979        in_ty: Ty<'tcx>,
980        in_elem: Ty<'tcx>,
981        ret_ty: Ty<'tcx>,
982    },
983
984    #[diag("invalid monomorphization of `{$name}` intrinsic: cannot cast wide pointer `{$ty}`", code = E0511)]
985    CastWidePointer {
986        #[primary_span]
987        span: Span,
988        name: Symbol,
989        ty: Ty<'tcx>,
990    },
991
992    #[diag("invalid monomorphization of `{$name}` intrinsic: expected pointer, got `{$ty}`", code = E0511)]
993    ExpectedPointer {
994        #[primary_span]
995        span: Span,
996        name: Symbol,
997        ty: Ty<'tcx>,
998    },
999
1000    #[diag("invalid monomorphization of `{$name}` intrinsic: expected `usize`, got `{$ty}`", code = E0511)]
1001    ExpectedUsize {
1002        #[primary_span]
1003        span: Span,
1004        name: Symbol,
1005        ty: Ty<'tcx>,
1006    },
1007
1008    #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported cast from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}` with element `{$out_elem}`", code = E0511)]
1009    UnsupportedCast {
1010        #[primary_span]
1011        span: Span,
1012        name: Symbol,
1013        in_ty: Ty<'tcx>,
1014        in_elem: Ty<'tcx>,
1015        ret_ty: Ty<'tcx>,
1016        out_elem: Ty<'tcx>,
1017    },
1018
1019    #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported operation on `{$in_ty}` with element `{$in_elem}`", code = E0511)]
1020    UnsupportedOperation {
1021        #[primary_span]
1022        span: Span,
1023        name: Symbol,
1024        in_ty: Ty<'tcx>,
1025        in_elem: Ty<'tcx>,
1026    },
1027
1028    #[diag("invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of vector type `{$vector_type}` to be a signed or unsigned integer type", code = E0511)]
1029    ExpectedVectorElementType {
1030        #[primary_span]
1031        span: Span,
1032        name: Symbol,
1033        expected_element: Ty<'tcx>,
1034        vector_type: Ty<'tcx>,
1035    },
1036
1037    #[diag("invalid monomorphization of `{$name}` intrinsic: expected non-scalable type, found scalable type `{$ty}`", code = E0511)]
1038    NonScalableType {
1039        #[primary_span]
1040        span: Span,
1041        name: Symbol,
1042        ty: Ty<'tcx>,
1043    },
1044}
1045
1046pub enum ExpectedPointerMutability {
1047    Mut,
1048    Not,
1049}
1050
1051impl IntoDiagArg for ExpectedPointerMutability {
1052    fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
1053        match self {
1054            ExpectedPointerMutability::Mut => DiagArgValue::Str(Cow::Borrowed("*mut")),
1055            ExpectedPointerMutability::Not => DiagArgValue::Str(Cow::Borrowed("*_")),
1056        }
1057    }
1058}
1059
1060#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TargetFeatureSafeTrait where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TargetFeatureSafeTrait { span: __binding_0, def: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[target_feature(..)]` cannot be applied to safe trait method")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot be applied to safe trait method")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not an `unsafe` function")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1061#[diag("`#[target_feature(..)]` cannot be applied to safe trait method")]
1062pub(crate) struct TargetFeatureSafeTrait {
1063    #[primary_span]
1064    #[label("cannot be applied to safe trait method")]
1065    pub span: Span,
1066    #[label("not an `unsafe` function")]
1067    pub def: Span,
1068}
1069
1070#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ForbiddenTargetFeatureAttr<'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 {
                    ForbiddenTargetFeatureAttr {
                        span: __binding_0, feature: __binding_1, reason: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target feature `{$feature}` cannot be enabled with `#[target_feature]`: {$reason}")));
                        ;
                        diag.arg("feature", __binding_1);
                        diag.arg("reason", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1071#[diag("target feature `{$feature}` cannot be enabled with `#[target_feature]`: {$reason}")]
1072pub struct ForbiddenTargetFeatureAttr<'a> {
1073    #[primary_span]
1074    pub span: Span,
1075    pub feature: &'a str,
1076    pub reason: &'a str,
1077}
1078
1079#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            FailedToGetLayout<'tcx> where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FailedToGetLayout {
                        span: __binding_0, ty: __binding_1, err: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to get layout for {$ty}: {$err}")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("err", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1080#[diag("failed to get layout for {$ty}: {$err}")]
1081pub struct FailedToGetLayout<'tcx> {
1082    #[primary_span]
1083    pub span: Span,
1084    pub ty: Ty<'tcx>,
1085    pub err: LayoutError<'tcx>,
1086}
1087
1088#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            DlltoolFailImportLibrary<'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 {
                    DlltoolFailImportLibrary {
                        dlltool_path: __binding_0,
                        dlltool_args: __binding_1,
                        stdout: __binding_2,
                        stderr: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dlltool could not create import library with {$dlltool_path} {$dlltool_args}:\n{$stdout}\n{$stderr}")));
                        ;
                        diag.arg("dlltool_path", __binding_0);
                        diag.arg("dlltool_args", __binding_1);
                        diag.arg("stdout", __binding_2);
                        diag.arg("stderr", __binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1089#[diag(
1090    "dlltool could not create import library with {$dlltool_path} {$dlltool_args}:
1091{$stdout}
1092{$stderr}"
1093)]
1094pub(crate) struct DlltoolFailImportLibrary<'a> {
1095    pub dlltool_path: Cow<'a, str>,
1096    pub dlltool_args: String,
1097    pub stdout: Cow<'a, str>,
1098    pub stderr: Cow<'a, str>,
1099}
1100
1101#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ErrorWritingDEFFile where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ErrorWritingDEFFile { error: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error writing .DEF file: {$error}")));
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1102#[diag("error writing .DEF file: {$error}")]
1103pub(crate) struct ErrorWritingDEFFile {
1104    pub error: std::io::Error,
1105}
1106
1107#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ErrorCallingDllTool<'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 {
                    ErrorCallingDllTool {
                        dlltool_path: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error calling dlltool '{$dlltool_path}': {$error}")));
                        ;
                        diag.arg("dlltool_path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1108#[diag("error calling dlltool '{$dlltool_path}': {$error}")]
1109pub(crate) struct ErrorCallingDllTool<'a> {
1110    pub dlltool_path: Cow<'a, str>,
1111    pub error: std::io::Error,
1112}
1113
1114#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ErrorCreatingRemarkDir where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ErrorCreatingRemarkDir { error: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to create remark directory: {$error}")));
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1115#[diag("failed to create remark directory: {$error}")]
1116pub(crate) struct ErrorCreatingRemarkDir {
1117    pub error: std::io::Error,
1118}
1119
1120#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CompilerBuiltinsCannotCall where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CompilerBuiltinsCannotCall {
                        caller: __binding_0, callee: __binding_1, span: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `{$caller}` to `{$callee}`")));
                        ;
                        diag.arg("caller", __binding_0);
                        diag.arg("callee", __binding_1);
                        diag.span(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1121#[diag(
1122    "`compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `{$caller}` to `{$callee}`"
1123)]
1124pub struct CompilerBuiltinsCannotCall {
1125    pub caller: String,
1126    pub callee: String,
1127    #[primary_span]
1128    pub span: Span,
1129}
1130
1131#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ErrorCreatingImportLibrary<'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 {
                    ErrorCreatingImportLibrary {
                        lib_name: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error creating import library for {$lib_name}: {$error}")));
                        ;
                        diag.arg("lib_name", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1132#[diag("error creating import library for {$lib_name}: {$error}")]
1133pub(crate) struct ErrorCreatingImportLibrary<'a> {
1134    pub lib_name: &'a str,
1135    pub error: String,
1136}
1137
1138#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AixStripNotUsed where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AixStripNotUsed => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using host's `strip` binary to cross-compile to AIX which is not guaranteed to work")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1139#[diag("using host's `strip` binary to cross-compile to AIX which is not guaranteed to work")]
1140pub(crate) struct AixStripNotUsed;
1141
1142#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for XcrunError
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    XcrunError::FailedInvoking {
                        sdk_name: __binding_0,
                        command_formatted: __binding_1,
                        error: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invoking `{$command_formatted}` to find {$sdk_name}.sdk failed: {$error}")));
                        ;
                        diag.arg("sdk_name", __binding_0);
                        diag.arg("command_formatted", __binding_1);
                        diag.arg("error", __binding_2);
                        diag
                    }
                    XcrunError::Unsuccessful {
                        sdk_name: __binding_0,
                        command_formatted: __binding_1,
                        stdout: __binding_2,
                        stderr: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed running `{$command_formatted}` to find {$sdk_name}.sdk")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$stdout}{$stderr}")));
                        ;
                        diag.arg("sdk_name", __binding_0);
                        diag.arg("command_formatted", __binding_1);
                        diag.arg("stdout", __binding_2);
                        diag.arg("stderr", __binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic, #[automatically_derived]
impl ::core::fmt::Debug for XcrunError {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            XcrunError::FailedInvoking {
                sdk_name: __self_0,
                command_formatted: __self_1,
                error: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "FailedInvoking", "sdk_name", __self_0, "command_formatted",
                    __self_1, "error", &__self_2),
            XcrunError::Unsuccessful {
                sdk_name: __self_0,
                command_formatted: __self_1,
                stdout: __self_2,
                stderr: __self_3 } =>
                ::core::fmt::Formatter::debug_struct_field4_finish(f,
                    "Unsuccessful", "sdk_name", __self_0, "command_formatted",
                    __self_1, "stdout", __self_2, "stderr", &__self_3),
        }
    }
}Debug)]
1143pub(crate) enum XcrunError {
1144    #[diag("invoking `{$command_formatted}` to find {$sdk_name}.sdk failed: {$error}")]
1145    FailedInvoking { sdk_name: &'static str, command_formatted: String, error: std::io::Error },
1146
1147    #[diag("failed running `{$command_formatted}` to find {$sdk_name}.sdk")]
1148    #[note("{$stdout}{$stderr}")]
1149    Unsuccessful {
1150        sdk_name: &'static str,
1151        command_formatted: String,
1152        stdout: String,
1153        stderr: String,
1154    },
1155}
1156
1157#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            XcrunSdkPathWarning where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    XcrunSdkPathWarning {
                        sdk_name: __binding_0, stderr: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("output of `xcrun` while finding {$sdk_name}.sdk")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$stderr}")));
                        ;
                        diag.arg("sdk_name", __binding_0);
                        diag.arg("stderr", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic, #[automatically_derived]
impl ::core::fmt::Debug for XcrunSdkPathWarning {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "XcrunSdkPathWarning", "sdk_name", &self.sdk_name, "stderr",
            &&self.stderr)
    }
}Debug)]
1158#[diag("output of `xcrun` while finding {$sdk_name}.sdk")]
1159#[note("{$stderr}")]
1160pub(crate) struct XcrunSdkPathWarning {
1161    pub sdk_name: &'static str,
1162    pub stderr: String,
1163}
1164
1165#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            Aarch64SoftfloatNeon where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    Aarch64SoftfloatNeon => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("enabling the `neon` target feature on the current target is unsound due to ABI issues")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1166#[diag("enabling the `neon` target feature on the current target is unsound due to ABI issues")]
1167pub(crate) struct Aarch64SoftfloatNeon;
1168
1169#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownCTargetFeaturePrefix<'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 {
                    UnknownCTargetFeaturePrefix { feature: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown feature specified for `-Ctarget-feature`: `{$feature}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("features must begin with a `+` to enable or `-` to disable it")));
                        ;
                        diag.arg("feature", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1170#[diag("unknown feature specified for `-Ctarget-feature`: `{$feature}`")]
1171#[note("features must begin with a `+` to enable or `-` to disable it")]
1172pub(crate) struct UnknownCTargetFeaturePrefix<'a> {
1173    pub feature: &'a str,
1174}
1175
1176#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for PossibleFeature<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    PossibleFeature::Some { rust_feature: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("rust_feature".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("you might have meant: `{$rust_feature}`")),
                                &sub_args);
                        diag.help(__message);
                    }
                    PossibleFeature::None => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider filing a feature request")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1177pub(crate) enum PossibleFeature<'a> {
1178    #[help("you might have meant: `{$rust_feature}`")]
1179    Some { rust_feature: &'a str },
1180    #[help("consider filing a feature request")]
1181    None,
1182}
1183
1184#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownCTargetFeature<'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 {
                    UnknownCTargetFeature {
                        feature: __binding_0, rust_feature: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown and unstable feature specified for `-Ctarget-feature`: `{$feature}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future")));
                        ;
                        diag.arg("feature", __binding_0);
                        diag.subdiagnostic(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1185#[diag("unknown and unstable feature specified for `-Ctarget-feature`: `{$feature}`")]
1186#[note(
1187    "it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future"
1188)]
1189pub(crate) struct UnknownCTargetFeature<'a> {
1190    pub feature: &'a str,
1191    #[subdiagnostic]
1192    pub rust_feature: PossibleFeature<'a>,
1193}
1194
1195#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            UnstableCTargetFeature<'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 {
                    UnstableCTargetFeature { feature: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unstable feature specified for `-Ctarget-feature`: `{$feature}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this feature is not stably supported; its behavior can change in the future")));
                        ;
                        diag.arg("feature", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1196#[diag("unstable feature specified for `-Ctarget-feature`: `{$feature}`")]
1197#[note("this feature is not stably supported; its behavior can change in the future")]
1198pub(crate) struct UnstableCTargetFeature<'a> {
1199    pub feature: &'a str,
1200}
1201
1202#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ForbiddenCTargetFeature<'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 {
                    ForbiddenCTargetFeature {
                        feature: __binding_0,
                        enabled: __binding_1,
                        reason: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target feature `{$feature}` cannot be {$enabled} with `-Ctarget-feature`: {$reason}")));
                        diag.note(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.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>")));
                        ;
                        diag.arg("feature", __binding_0);
                        diag.arg("enabled", __binding_1);
                        diag.arg("reason", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1203#[diag("target feature `{$feature}` cannot be {$enabled} with `-Ctarget-feature`: {$reason}")]
1204#[note(
1205    "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1206)]
1207#[note("for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>")]
1208pub(crate) struct ForbiddenCTargetFeature<'a> {
1209    pub feature: &'a str,
1210    pub enabled: &'a str,
1211    pub reason: &'a str,
1212}
1213
1214pub struct TargetFeatureDisableOrEnable<'a> {
1215    pub features: &'a [&'a str],
1216    pub span: Option<Span>,
1217    pub missing_features: Option<MissingFeatures>,
1218}
1219
1220#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for MissingFeatures {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    MissingFeatures => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add the missing features in a `target_feature` attribute")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1221#[help("add the missing features in a `target_feature` attribute")]
1222pub struct MissingFeatures;
1223
1224impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetFeatureDisableOrEnable<'_> {
1225    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
1226        let mut diag = Diag::new(
1227            dcx,
1228            level,
1229            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the target features {$features} must all be either enabled or disabled together"))msg!("the target features {$features} must all be either enabled or disabled together"),
1230        );
1231        if let Some(span) = self.span {
1232            diag.span(span);
1233        };
1234        if let Some(missing_features) = self.missing_features {
1235            diag.subdiagnostic(missing_features);
1236        }
1237        diag.arg("features", self.features.join(", "));
1238        diag
1239    }
1240}
1241
1242#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            FeatureNotValid<'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 {
                    FeatureNotValid {
                        feature: __binding_0, span: __binding_1, hint: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature named `{$feature}` is not valid for this target")));
                        ;
                        diag.arg("feature", __binding_0);
                        diag.span(__binding_1);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$feature}` is not valid for this target")));
                        diag.subdiagnostic(__binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1243#[diag("the feature named `{$feature}` is not valid for this target")]
1244pub(crate) struct FeatureNotValid<'a> {
1245    pub feature: &'a str,
1246    #[primary_span]
1247    #[label("`{$feature}` is not valid for this target")]
1248    pub span: Span,
1249    #[subdiagnostic]
1250    pub hint: FeatureNotValidHint<'a>,
1251}
1252
1253#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for FeatureNotValidHint<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    FeatureNotValidHint::RemovePlusFromFeatureName {
                        span: __binding_0, stripped: __binding_1 } => {
                        let __code_0 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("enable = \"{0}\"",
                                                        __binding_1))
                                            })].into_iter();
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("stripped".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing the leading `+` in the feature name")),
                                &sub_args);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_0, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowAlways);
                    }
                    FeatureNotValidHint::ValidFeatureNames {
                        possibilities: __binding_0, and_more: __binding_1 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("possibilities".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        sub_args.insert("and_more".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_1,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("valid names are: {$possibilities}{$and_more ->\n            [0] {\"\"}\n            *[other] {\" \"}and {$and_more} more\n        }")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
1254pub(crate) enum FeatureNotValidHint<'a> {
1255    #[suggestion(
1256        "consider removing the leading `+` in the feature name",
1257        code = "enable = \"{stripped}\"",
1258        applicability = "maybe-incorrect",
1259        style = "verbose"
1260    )]
1261    RemovePlusFromFeatureName {
1262        #[primary_span]
1263        span: Span,
1264        stripped: &'a str,
1265    },
1266    #[help(
1267        "valid names are: {$possibilities}{$and_more ->
1268            [0] {\"\"}
1269            *[other] {\" \"}and {$and_more} more
1270        }"
1271    )]
1272    ValidFeatureNames { possibilities: DiagSymbolList<&'a str>, and_more: usize },
1273}
1274
1275#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LtoDisallowed
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LtoDisallowed => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lto can only be run for executables, cdylibs and static library outputs")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1276#[diag("lto can only be run for executables, cdylibs and static library outputs")]
1277pub(crate) struct LtoDisallowed;
1278
1279#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LtoDylib where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LtoDylib => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lto cannot be used for `dylib` crate type without `-Zdylib-lto`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1280#[diag("lto cannot be used for `dylib` crate type without `-Zdylib-lto`")]
1281pub(crate) struct LtoDylib;
1282
1283#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LtoProcMacro
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LtoProcMacro => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lto cannot be used for `proc-macro` crate type without `-Zdylib-lto`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1284#[diag("lto cannot be used for `proc-macro` crate type without `-Zdylib-lto`")]
1285pub(crate) struct LtoProcMacro;
1286
1287#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DynamicLinkingWithLTO where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DynamicLinkingWithLTO => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot prefer dynamic linking when performing LTO")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
1288#[diag("cannot prefer dynamic linking when performing LTO")]
1289#[note("only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO")]
1290pub(crate) struct DynamicLinkingWithLTO;