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