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