Skip to main content

rustc_metadata/
errors.rs

1use std::io::Error;
2use std::path::{Path, PathBuf};
3
4use rustc_errors::codes::*;
5use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
6use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_span::{Span, Symbol, sym};
8use rustc_target::spec::{PanicStrategy, TargetTuple};
9
10use crate::locator::CrateFlavor;
11
12#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for RlibRequired
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RlibRequired { crate_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("crate `{$crate_name}` required to be available in rlib format, but was not found in this form")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
13#[diag(
14    "crate `{$crate_name}` required to be available in rlib format, but was not found in this form"
15)]
16pub(crate) struct RlibRequired {
17    pub crate_name: Symbol,
18}
19
20#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            LibRequired<'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 {
                    LibRequired { crate_name: __binding_0, kind: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag.arg("kind", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
21#[diag(
22    "crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form"
23)]
24pub(crate) struct LibRequired<'a> {
25    pub crate_name: Symbol,
26    pub kind: &'a str,
27}
28
29#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            RustcLibRequired<'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 {
                    RustcLibRequired {
                        crate_name: __binding_0, kind: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("try adding `extern crate rustc_driver;` at the top level of this crate")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag.arg("kind", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
30#[diag(
31    "crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form"
32)]
33#[help("try adding `extern crate rustc_driver;` at the top level of this crate")]
34pub(crate) struct RustcLibRequired<'a> {
35    pub crate_name: Symbol,
36    pub kind: &'a str,
37}
38
39#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CrateDepMultiple where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CrateDepMultiple {
                        crate_name: __binding_0,
                        non_static_deps: __binding_1,
                        rustc_driver_help: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot satisfy dependencies so `{$crate_name}` only shows up once")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("having upstream crates all available in one format will likely make this go away")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        for __binding_1 in __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        if __binding_2 {
                            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
40#[diag("cannot satisfy dependencies so `{$crate_name}` only shows up once")]
41#[help("having upstream crates all available in one format will likely make this go away")]
42pub(crate) struct CrateDepMultiple {
43    pub crate_name: Symbol,
44    #[subdiagnostic]
45    pub non_static_deps: Vec<NonStaticCrateDep>,
46    #[help("`feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library")]
47    pub rustc_driver_help: bool,
48}
49
50#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for NonStaticCrateDep {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    NonStaticCrateDep { sub_crate_name: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("sub_crate_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$sub_crate_name}` was unavailable as a static crate, preventing fully static linking")),
                                &sub_args);
                        diag.note(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
51#[note("`{$sub_crate_name}` was unavailable as a static crate, preventing fully static linking")]
52pub(crate) struct NonStaticCrateDep {
53    /// It's different from `crate_name` in main Diagnostic.
54    pub sub_crate_name: Symbol,
55}
56
57#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            TwoPanicRuntimes where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TwoPanicRuntimes {
                        prev_name: __binding_0, cur_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot link together two panic runtimes: {$prev_name} and {$cur_name}")));
                        ;
                        diag.arg("prev_name", __binding_0);
                        diag.arg("cur_name", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
58#[diag("cannot link together two panic runtimes: {$prev_name} and {$cur_name}")]
59pub(crate) struct TwoPanicRuntimes {
60    pub prev_name: Symbol,
61    pub cur_name: Symbol,
62}
63
64#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            BadPanicStrategy where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    BadPanicStrategy {
                        runtime: __binding_0, strategy: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the linked panic runtime `{$runtime}` is not compiled with this crate's panic strategy `{$strategy}`")));
                        ;
                        diag.arg("runtime", __binding_0);
                        diag.arg("strategy", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
65#[diag(
66    "the linked panic runtime `{$runtime}` is not compiled with this crate's panic strategy `{$strategy}`"
67)]
68pub(crate) struct BadPanicStrategy {
69    pub runtime: Symbol,
70    pub strategy: PanicStrategy,
71}
72
73#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RequiredPanicStrategy where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RequiredPanicStrategy {
                        crate_name: __binding_0,
                        found_strategy: __binding_1,
                        desired_strategy: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate `{$crate_name}` requires panic strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag.arg("found_strategy", __binding_1);
                        diag.arg("desired_strategy", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
74#[diag(
75    "the crate `{$crate_name}` requires panic strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`"
76)]
77pub(crate) struct RequiredPanicStrategy {
78    pub crate_name: Symbol,
79    pub found_strategy: PanicStrategy,
80    pub desired_strategy: PanicStrategy,
81}
82
83#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncompatibleWithImmediateAbort where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncompatibleWithImmediateAbort { crate_name: __binding_0 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate `{$crate_name}` was compiled with a panic strategy which is incompatible with `immediate-abort`")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
84#[diag(
85    "the crate `{$crate_name}` was compiled with a panic strategy which is incompatible with `immediate-abort`"
86)]
87pub(crate) struct IncompatibleWithImmediateAbort {
88    pub crate_name: Symbol,
89}
90
91#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncompatibleWithImmediateAbortCore where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncompatibleWithImmediateAbortCore => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate `core` was compiled with a panic strategy which is incompatible with `immediate-abort`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
92#[diag(
93    "the crate `core` was compiled with a panic strategy which is incompatible with `immediate-abort`"
94)]
95pub(crate) struct IncompatibleWithImmediateAbortCore;
96
97#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncompatiblePanicInDropStrategy where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncompatiblePanicInDropStrategy {
                        crate_name: __binding_0,
                        found_strategy: __binding_1,
                        desired_strategy: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate `{$crate_name}` is compiled with the panic-in-drop strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag.arg("found_strategy", __binding_1);
                        diag.arg("desired_strategy", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
98#[diag(
99    "the crate `{$crate_name}` is compiled with the panic-in-drop strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`"
100)]
101pub(crate) struct IncompatiblePanicInDropStrategy {
102    pub crate_name: Symbol,
103    pub found_strategy: PanicStrategy,
104    pub desired_strategy: PanicStrategy,
105}
106
107#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LinkOrdinalRawDylib where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LinkOrdinalRawDylib { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[link_ordinal]` is only supported if link kind is `raw-dylib`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
108#[diag("`#[link_ordinal]` is only supported if link kind is `raw-dylib`")]
109pub(crate) struct LinkOrdinalRawDylib {
110    #[primary_span]
111    pub span: Span,
112}
113
114#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LibFrameworkApple where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    LibFrameworkApple => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("library kind `framework` is only supported on Apple targets")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
115#[diag("library kind `framework` is only supported on Apple targets")]
116pub(crate) struct LibFrameworkApple;
117
118#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            EmptyRenamingTarget<'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 {
                    EmptyRenamingTarget { lib_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an empty renaming target was specified for library `{$lib_name}`")));
                        ;
                        diag.arg("lib_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
119#[diag("an empty renaming target was specified for library `{$lib_name}`")]
120pub(crate) struct EmptyRenamingTarget<'a> {
121    pub lib_name: &'a str,
122}
123
124#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            RenamingNoLink<'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 {
                    RenamingNoLink { lib_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("renaming of the library `{$lib_name}` was specified, however this crate contains no `#[link(...)]` attributes referencing this library")));
                        ;
                        diag.arg("lib_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
125#[diag(
126    "renaming of the library `{$lib_name}` was specified, however this crate contains no `#[link(...)]` attributes referencing this library"
127)]
128pub(crate) struct RenamingNoLink<'a> {
129    pub lib_name: &'a str,
130}
131
132#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleRenamings<'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 {
                    MultipleRenamings { lib_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple renamings were specified for library `{$lib_name}`")));
                        ;
                        diag.arg("lib_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
133#[diag("multiple renamings were specified for library `{$lib_name}`")]
134pub(crate) struct MultipleRenamings<'a> {
135    pub lib_name: &'a str,
136}
137
138#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NoLinkModOverride where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NoLinkModOverride { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("overriding linking modifiers from command line is not supported")));
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.span(__binding_0);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
139#[diag("overriding linking modifiers from command line is not supported")]
140pub(crate) struct NoLinkModOverride {
141    #[primary_span]
142    pub span: Option<Span>,
143}
144
145#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RawDylibUnsupportedAbi where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RawDylibUnsupportedAbi { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ABI not supported by `#[link(kind = \"raw-dylib\")]` on this architecture")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
146#[diag("ABI not supported by `#[link(kind = \"raw-dylib\")]` on this architecture")]
147pub(crate) struct RawDylibUnsupportedAbi {
148    #[primary_span]
149    pub span: Span,
150}
151
152#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FailCreateFileEncoder where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FailCreateFileEncoder { err: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to create file encoder: {$err}")));
                        ;
                        diag.arg("err", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
153#[diag("failed to create file encoder: {$err}")]
154pub(crate) struct FailCreateFileEncoder {
155    pub err: Error,
156}
157
158#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            FailWriteFile<'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 {
                    FailWriteFile { path: __binding_0, err: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write to `{$path}`: {$err}")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("err", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
159#[diag("failed to write to `{$path}`: {$err}")]
160pub(crate) struct FailWriteFile<'a> {
161    pub path: &'a Path,
162    pub err: Error,
163}
164
165#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CrateNotPanicRuntime where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CrateNotPanicRuntime { crate_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate `{$crate_name}` is not a panic runtime")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
166#[diag("the crate `{$crate_name}` is not a panic runtime")]
167pub(crate) struct CrateNotPanicRuntime {
168    pub crate_name: Symbol,
169}
170
171#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CrateNotCompilerBuiltins where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CrateNotCompilerBuiltins { crate_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate `{$crate_name}` resolved as `compiler_builtins` but is not `#![compiler_builtins]`")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
172#[diag(
173    "the crate `{$crate_name}` resolved as `compiler_builtins` but is not `#![compiler_builtins]`"
174)]
175pub(crate) struct CrateNotCompilerBuiltins {
176    pub crate_name: Symbol,
177}
178
179#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NoPanicStrategy where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NoPanicStrategy {
                        crate_name: __binding_0, strategy: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate `{$crate_name}` does not have the panic strategy `{$strategy}`")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag.arg("strategy", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
180#[diag("the crate `{$crate_name}` does not have the panic strategy `{$strategy}`")]
181pub(crate) struct NoPanicStrategy {
182    pub crate_name: Symbol,
183    pub strategy: PanicStrategy,
184}
185
186#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NotProfilerRuntime where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NotProfilerRuntime { crate_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the crate `{$crate_name}` is not a profiler runtime")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
187#[diag("the crate `{$crate_name}` is not a profiler runtime")]
188pub(crate) struct NotProfilerRuntime {
189    pub crate_name: Symbol,
190}
191
192#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NoMultipleGlobalAlloc where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NoMultipleGlobalAlloc {
                        span2: __binding_0, span1: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define multiple global allocators")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define a new global allocator")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous global allocator defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
193#[diag("cannot define multiple global allocators")]
194pub(crate) struct NoMultipleGlobalAlloc {
195    #[primary_span]
196    #[label("cannot define a new global allocator")]
197    pub span2: Span,
198    #[label("previous global allocator defined here")]
199    pub span1: Span,
200}
201
202#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NoMultipleAllocErrorHandler where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NoMultipleAllocErrorHandler {
                        span2: __binding_0, span1: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define multiple allocation error handlers")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot define a new allocation error handler")));
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous allocation error handler defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
203#[diag("cannot define multiple allocation error handlers")]
204pub(crate) struct NoMultipleAllocErrorHandler {
205    #[primary_span]
206    #[label("cannot define a new allocation error handler")]
207    pub span2: Span,
208    #[label("previous allocation error handler defined here")]
209    pub span1: Span,
210}
211
212#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConflictingGlobalAlloc where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConflictingGlobalAlloc {
                        crate_name: __binding_0, other_crate_name: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `#[global_allocator]` in {$other_crate_name} conflicts with global allocator in: {$crate_name}")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag.arg("other_crate_name", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
213#[diag(
214    "the `#[global_allocator]` in {$other_crate_name} conflicts with global allocator in: {$crate_name}"
215)]
216pub(crate) struct ConflictingGlobalAlloc {
217    pub crate_name: Symbol,
218    pub other_crate_name: Symbol,
219}
220
221#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConflictingAllocErrorHandler where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ConflictingAllocErrorHandler {
                        crate_name: __binding_0, other_crate_name: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `#[alloc_error_handler]` in {$other_crate_name} conflicts with allocation error handler in: {$crate_name}")));
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag.arg("other_crate_name", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
222#[diag(
223    "the `#[alloc_error_handler]` in {$other_crate_name} conflicts with allocation error handler in: {$crate_name}"
224)]
225pub(crate) struct ConflictingAllocErrorHandler {
226    pub crate_name: Symbol,
227    pub other_crate_name: Symbol,
228}
229
230#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            GlobalAllocRequired where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    GlobalAllocRequired => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
231#[diag(
232    "no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait"
233)]
234pub(crate) struct GlobalAllocRequired;
235
236#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FailedWriteError where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FailedWriteError { filename: __binding_0, err: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write {$filename}: {$err}")));
                        ;
                        diag.arg("filename", __binding_0);
                        diag.arg("err", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
237#[diag("failed to write {$filename}: {$err}")]
238pub(crate) struct FailedWriteError {
239    pub filename: PathBuf,
240    pub err: Error,
241}
242
243#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FailedCopyToStdout where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FailedCopyToStdout { filename: __binding_0, err: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to copy {$filename} to stdout: {$err}")));
                        ;
                        diag.arg("filename", __binding_0);
                        diag.arg("err", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
244#[diag("failed to copy {$filename} to stdout: {$err}")]
245pub(crate) struct FailedCopyToStdout {
246    pub filename: PathBuf,
247    pub err: Error,
248}
249
250#[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 => {
                        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 `metadata` to stdout, but stdout is a tty")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
251#[diag(
252    "option `-o` or `--emit` is used to write binary output type `metadata` to stdout, but stdout is a tty"
253)]
254pub(crate) struct BinaryOutputToTty;
255
256#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            MissingNativeLibrary<'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 {
                    MissingNativeLibrary {
                        libname: __binding_0, suggest_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not find native static library `{$libname}`, perhaps an -L flag is missing?")));
                        ;
                        diag.arg("libname", __binding_0);
                        if let Some(__binding_1) = __binding_1 {
                            diag.subdiagnostic(__binding_1);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
257#[diag("could not find native static library `{$libname}`, perhaps an -L flag is missing?")]
258pub(crate) struct MissingNativeLibrary<'a> {
259    libname: &'a str,
260    #[subdiagnostic]
261    suggest_name: Option<SuggestLibraryName<'a>>,
262}
263
264impl<'a> MissingNativeLibrary<'a> {
265    pub(crate) fn new(libname: &'a str, verbatim: bool) -> Self {
266        // if it looks like the user has provided a complete filename rather just the bare lib name,
267        // then provide a note that they might want to try trimming the name
268        let suggested_name = if !verbatim {
269            if let Some(libname) = libname.strip_circumfix("lib", ".a") {
270                // this is a unix style filename so trim prefix & suffix
271                Some(libname)
272            } else if let Some(libname) = libname.strip_suffix(".lib") {
273                // this is a Windows style filename so just trim the suffix
274                Some(libname)
275            } else {
276                None
277            }
278        } else {
279            None
280        };
281
282        Self {
283            libname,
284            suggest_name: suggested_name
285                .map(|suggested_name| SuggestLibraryName { suggested_name }),
286        }
287    }
288}
289
290#[derive(const _: () =
    {
        impl<'a> rustc_errors::Subdiagnostic for SuggestLibraryName<'a> {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    SuggestLibraryName { suggested_name: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        sub_args.insert("suggested_name".into(),
                            rustc_errors::IntoDiagArg::into_diag_arg(__binding_0,
                                &mut diag.long_ty_path));
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only provide the library name `{$suggested_name}`, not the full filename")),
                                &sub_args);
                        diag.help(__message);
                    }
                }
            }
        }
    };Subdiagnostic)]
291#[help("only provide the library name `{$suggested_name}`, not the full filename")]
292pub(crate) struct SuggestLibraryName<'a> {
293    suggested_name: &'a str,
294}
295
296#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FailedCreateTempdir where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FailedCreateTempdir { err: __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: {$err}")));
                        ;
                        diag.arg("err", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
297#[diag("couldn't create a temp dir: {$err}")]
298pub(crate) struct FailedCreateTempdir {
299    pub err: Error,
300}
301
302#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            FailedCreateFile<'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 {
                    FailedCreateFile { filename: __binding_0, err: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to create the file {$filename}: {$err}")));
                        ;
                        diag.arg("filename", __binding_0);
                        diag.arg("err", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
303#[diag("failed to create the file {$filename}: {$err}")]
304pub(crate) struct FailedCreateFile<'a> {
305    pub filename: &'a Path,
306    pub err: Error,
307}
308
309#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FailedCreateEncodedMetadata where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FailedCreateEncodedMetadata { err: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to create encoded metadata from file: {$err}")));
                        ;
                        diag.arg("err", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
310#[diag("failed to create encoded metadata from file: {$err}")]
311pub(crate) struct FailedCreateEncodedMetadata {
312    pub err: Error,
313}
314
315#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NonAsciiName
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NonAsciiName { span: __binding_0, crate_name: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot load a crate with a non-ascii name `{$crate_name}`")));
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
316#[diag("cannot load a crate with a non-ascii name `{$crate_name}`")]
317pub(crate) struct NonAsciiName {
318    #[primary_span]
319    pub span: Span,
320    pub crate_name: Symbol,
321}
322
323#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ExternLocationNotExist<'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 {
                    ExternLocationNotExist {
                        span: __binding_0,
                        crate_name: __binding_1,
                        location: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern location for {$crate_name} does not exist: {$location}")));
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.arg("location", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
324#[diag("extern location for {$crate_name} does not exist: {$location}")]
325pub(crate) struct ExternLocationNotExist<'a> {
326    #[primary_span]
327    pub span: Span,
328    pub crate_name: Symbol,
329    pub location: &'a Path,
330}
331
332#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ExternLocationNotFile<'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 {
                    ExternLocationNotFile {
                        span: __binding_0,
                        crate_name: __binding_1,
                        location: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern location for {$crate_name} is not a file: {$location}")));
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.arg("location", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
333#[diag("extern location for {$crate_name} is not a file: {$location}")]
334pub(crate) struct ExternLocationNotFile<'a> {
335    #[primary_span]
336    pub span: Span,
337    pub crate_name: Symbol,
338    pub location: &'a Path,
339}
340
341pub(crate) struct MultipleCandidates {
342    pub span: Span,
343    pub flavor: CrateFlavor,
344    pub crate_name: Symbol,
345    pub candidates: Vec<PathBuf>,
346}
347
348impl<G: EmissionGuarantee> Diagnostic<'_, G> for MultipleCandidates {
349    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
350        let mut diag = Diag::new(
351            dcx,
352            level,
353            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple candidates for `{$flavor}` dependency `{$crate_name}` found"))msg!("multiple candidates for `{$flavor}` dependency `{$crate_name}` found"),
354        );
355        diag.arg("crate_name", self.crate_name);
356        diag.arg("flavor", self.flavor);
357        diag.code(E0464);
358        diag.span(self.span);
359        for (i, candidate) in self.candidates.iter().enumerate() {
360            diag.note(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("candidate #{0}: {1}", i + 1,
                candidate.display()))
    })format!("candidate #{}: {}", i + 1, candidate.display()));
361        }
362        diag
363    }
364}
365
366#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FullMetadataNotFound where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FullMetadataNotFound {
                        span: __binding_0,
                        flavor: __binding_1,
                        crate_name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only metadata stub found for `{$flavor}` dependency `{$crate_name}` please provide path to the corresponding .rmeta file with full metadata")));
                        ;
                        diag.arg("flavor", __binding_1);
                        diag.arg("crate_name", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
367#[diag(
368    "only metadata stub found for `{$flavor}` dependency `{$crate_name}` please provide path to the corresponding .rmeta file with full metadata"
369)]
370pub(crate) struct FullMetadataNotFound {
371    #[primary_span]
372    pub span: Span,
373    pub flavor: CrateFlavor,
374    pub crate_name: Symbol,
375}
376
377#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SymbolConflictsCurrent where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    SymbolConflictsCurrent {
                        span: __binding_0, crate_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the current crate is indistinguishable from one of its dependencies: it has the same crate-name `{$crate_name}` and was compiled with the same `-C metadata` arguments, so this will result in symbol conflicts between the two")));
                        diag.code(E0519);
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
378#[diag("the current crate is indistinguishable from one of its dependencies: it has the same crate-name `{$crate_name}` and was compiled with the same `-C metadata` arguments, so this will result in symbol conflicts between the two", code = E0519)]
379pub(crate) struct SymbolConflictsCurrent {
380    #[primary_span]
381    pub span: Span,
382    pub crate_name: Symbol,
383}
384
385#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            StableCrateIdCollision where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    StableCrateIdCollision {
                        span: __binding_0,
                        crate_name0: __binding_1,
                        crate_name1: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values")));
                        ;
                        diag.arg("crate_name0", __binding_1);
                        diag.arg("crate_name1", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
386#[diag("found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values")]
387pub(crate) struct StableCrateIdCollision {
388    #[primary_span]
389    pub span: Span,
390    pub crate_name0: Symbol,
391    pub crate_name1: Symbol,
392}
393
394#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for DlError where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    DlError {
                        span: __binding_0, path: __binding_1, err: __binding_2 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$path}{$err}")));
                        ;
                        diag.arg("path", __binding_1);
                        diag.arg("err", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
395#[diag("{$path}{$err}")]
396pub(crate) struct DlError {
397    #[primary_span]
398    pub span: Span,
399    pub path: String,
400    pub err: String,
401}
402
403#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            NewerCrateVersion where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    NewerCrateVersion {
                        span: __binding_0,
                        crate_name: __binding_1,
                        add_info: __binding_2,
                        found_crates: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found possibly newer version of crate `{$crate_name}`{$add_info}")));
                        diag.code(E0460);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("perhaps that crate needs to be recompiled?")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the following crate versions were found:{$found_crates}")));
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.arg("add_info", __binding_2);
                        diag.arg("found_crates", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
404#[diag("found possibly newer version of crate `{$crate_name}`{$add_info}", code = E0460)]
405#[note("perhaps that crate needs to be recompiled?")]
406#[note("the following crate versions were found:{$found_crates}")]
407pub(crate) struct NewerCrateVersion {
408    #[primary_span]
409    pub span: Span,
410    pub crate_name: Symbol,
411    pub add_info: String,
412    pub found_crates: String,
413}
414
415#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            NoCrateWithTriple<'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 {
                    NoCrateWithTriple {
                        span: __binding_0,
                        crate_name: __binding_1,
                        locator_triple: __binding_2,
                        add_info: __binding_3,
                        found_crates: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("couldn't find crate `{$crate_name}` with expected target triple {$locator_triple}{$add_info}")));
                        diag.code(E0461);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the following crate versions were found:{$found_crates}")));
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.arg("locator_triple", __binding_2);
                        diag.arg("add_info", __binding_3);
                        diag.arg("found_crates", __binding_4);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
416#[diag("couldn't find crate `{$crate_name}` with expected target triple {$locator_triple}{$add_info}", code = E0461)]
417#[note("the following crate versions were found:{$found_crates}")]
418pub(crate) struct NoCrateWithTriple<'a> {
419    #[primary_span]
420    pub span: Span,
421    pub crate_name: Symbol,
422    pub locator_triple: &'a str,
423    pub add_info: String,
424    pub found_crates: String,
425}
426
427#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for FoundStaticlib
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FoundStaticlib {
                        span: __binding_0,
                        crate_name: __binding_1,
                        add_info: __binding_2,
                        found_crates: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found staticlib `{$crate_name}` instead of rlib or dylib{$add_info}")));
                        diag.code(E0462);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the following crate versions were found:{$found_crates}")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("please recompile that crate using --crate-type lib")));
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.arg("add_info", __binding_2);
                        diag.arg("found_crates", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
428#[diag("found staticlib `{$crate_name}` instead of rlib or dylib{$add_info}", code = E0462)]
429#[note("the following crate versions were found:{$found_crates}")]
430#[help("please recompile that crate using --crate-type lib")]
431pub(crate) struct FoundStaticlib {
432    #[primary_span]
433    pub span: Span,
434    pub crate_name: Symbol,
435    pub add_info: String,
436    pub found_crates: String,
437}
438
439#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncompatibleRustc where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncompatibleRustc {
                        span: __binding_0,
                        crate_name: __binding_1,
                        add_info: __binding_2,
                        found_crates: __binding_3,
                        rustc_version: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found crate `{$crate_name}` compiled by an incompatible version of rustc{$add_info}")));
                        diag.code(E0514);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the following crate versions were found:{$found_crates}")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("please recompile that crate using this compiler ({$rustc_version}) (consider running `cargo clean` first)")));
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.arg("add_info", __binding_2);
                        diag.arg("found_crates", __binding_3);
                        diag.arg("rustc_version", __binding_4);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
440#[diag("found crate `{$crate_name}` compiled by an incompatible version of rustc{$add_info}", code = E0514)]
441#[note("the following crate versions were found:{$found_crates}")]
442#[help(
443    "please recompile that crate using this compiler ({$rustc_version}) (consider running `cargo clean` first)"
444)]
445pub(crate) struct IncompatibleRustc {
446    #[primary_span]
447    pub span: Span,
448    pub crate_name: Symbol,
449    pub add_info: String,
450    pub found_crates: String,
451    pub rustc_version: String,
452}
453
454pub(crate) struct InvalidMetadataFiles {
455    pub span: Span,
456    pub crate_name: Symbol,
457    pub add_info: String,
458    pub crate_rejections: Vec<String>,
459}
460
461impl<G: EmissionGuarantee> Diagnostic<'_, G> for InvalidMetadataFiles {
462    #[track_caller]
463    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
464        let mut diag = Diag::new(
465            dcx,
466            level,
467            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found invalid metadata files for crate `{$crate_name}`{$add_info}"))msg!("found invalid metadata files for crate `{$crate_name}`{$add_info}"),
468        );
469        diag.arg("crate_name", self.crate_name);
470        diag.arg("add_info", self.add_info);
471        diag.code(E0786);
472        diag.span(self.span);
473        for crate_rejection in self.crate_rejections {
474            diag.note(crate_rejection);
475        }
476        diag
477    }
478}
479
480pub(crate) struct CannotFindCrate {
481    pub span: Span,
482    pub crate_name: Symbol,
483    pub add_info: String,
484    pub missing_core: bool,
485    pub current_crate: String,
486    pub is_nightly_build: bool,
487    pub profiler_runtime: Symbol,
488    pub locator_triple: TargetTuple,
489    pub is_ui_testing: bool,
490    pub is_tier_3: bool,
491}
492
493impl<G: EmissionGuarantee> Diagnostic<'_, G> for CannotFindCrate {
494    #[track_caller]
495    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
496        let mut diag =
497            Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't find crate for `{$crate_name}`{$add_info}"))msg!("can't find crate for `{$crate_name}`{$add_info}"));
498        diag.arg("crate_name", self.crate_name);
499        diag.arg("current_crate", self.current_crate);
500        diag.arg("add_info", self.add_info);
501        diag.arg("locator_triple", self.locator_triple.tuple());
502        diag.code(E0463);
503        diag.span(self.span);
504        if self.crate_name == sym::std || self.crate_name == sym::core {
505            if self.missing_core {
506                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$locator_triple}` target may not be installed"))msg!("the `{$locator_triple}` target may not be installed"));
507            } else {
508                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$locator_triple}` target may not support the standard library"))msg!(
509                    "the `{$locator_triple}` target may not support the standard library"
510                ));
511            }
512
513            let has_precompiled_std = !self.is_tier_3;
514
515            if self.missing_core {
516                if "nightly"env!("CFG_RELEASE_CHANNEL") == "dev" && !self.is_ui_testing {
517                    // Note: Emits the nicer suggestion only for the dev channel.
518                    diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider adding the standard library to the sysroot with `x build library --target {$locator_triple}`"))msg!("consider adding the standard library to the sysroot with `x build library --target {$locator_triple}`"));
519                } else if has_precompiled_std {
520                    // NOTE: this suggests using rustup, even though the user may not have it installed.
521                    // That's because they could choose to install it; or this may give them a hint which
522                    // target they need to install from their distro.
523                    diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider downloading the target with `rustup target add {$locator_triple}`"))msg!(
524                        "consider downloading the target with `rustup target add {$locator_triple}`"
525                    ));
526                }
527            }
528
529            // Suggest using #![no_std]. #[no_core] is unstable and not really supported anyway.
530            // NOTE: this is a dummy span if `extern crate std` was injected by the compiler.
531            // If it's not a dummy, that means someone added `extern crate std` explicitly and
532            // `#![no_std]` won't help.
533            if !self.missing_core && self.span.is_dummy() {
534                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`std` is required by `{$current_crate}` because it does not declare `#![no_std]`"))msg!("`std` is required by `{$current_crate}` because it does not declare `#![no_std]`"));
535            }
536            // Recommend -Zbuild-std even on stable builds for Tier 3 targets because
537            // it's the recommended way to use the target, the user should switch to nightly.
538            if self.is_nightly_build || !has_precompiled_std {
539                diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider building the standard library from source with `cargo build -Zbuild-std`"))msg!("consider building the standard library from source with `cargo build -Zbuild-std`"));
540            }
541        } else if self.crate_name == self.profiler_runtime {
542            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the compiler may have been built without the profiler runtime"))msg!("the compiler may have been built without the profiler runtime"));
543        } else if self.crate_name.as_str().starts_with("rustc_") {
544            diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`"))msg!("maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`"));
545        }
546        diag.span_label(self.span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't find crate"))msg!("can't find crate"));
547        diag
548    }
549}
550
551#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            CrateLocationUnknownType<'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 {
                    CrateLocationUnknownType {
                        span: __binding_0,
                        path: __binding_1,
                        crate_name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern location for {$crate_name} is of an unknown type: {$path}")));
                        ;
                        diag.arg("path", __binding_1);
                        diag.arg("crate_name", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
552#[diag("extern location for {$crate_name} is of an unknown type: {$path}")]
553pub(crate) struct CrateLocationUnknownType<'a> {
554    #[primary_span]
555    pub span: Span,
556    pub path: &'a Path,
557    pub crate_name: Symbol,
558}
559
560#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            LibFilenameForm<'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 {
                    LibFilenameForm {
                        span: __binding_0,
                        dll_prefix: __binding_1,
                        dll_suffix: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("file name should be lib*.rlib or {$dll_prefix}*{$dll_suffix}")));
                        ;
                        diag.arg("dll_prefix", __binding_1);
                        diag.arg("dll_suffix", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
561#[diag("file name should be lib*.rlib or {$dll_prefix}*{$dll_suffix}")]
562pub(crate) struct LibFilenameForm<'a> {
563    #[primary_span]
564    pub span: Span,
565    pub dll_prefix: &'a str,
566    pub dll_suffix: &'a str,
567}
568
569#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for WasmCAbi where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    WasmCAbi { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("older versions of the `wasm-bindgen` crate are incompatible with current versions of Rust; please update to `wasm-bindgen` v0.2.88")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
570#[diag(
571    "older versions of the `wasm-bindgen` crate are incompatible with current versions of Rust; please update to `wasm-bindgen` v0.2.88"
572)]
573pub(crate) struct WasmCAbi {
574    #[primary_span]
575    pub span: Span,
576}
577
578#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncompatibleTargetModifiers where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncompatibleTargetModifiers {
                        span: __binding_0,
                        extern_crate: __binding_1,
                        local_crate: __binding_2,
                        flag_name: __binding_3,
                        flag_name_prefixed: __binding_4,
                        local_value: __binding_5,
                        extern_value: __binding_6 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("set `{$flag_name_prefixed}={$extern_value}` in this crate or `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error")));
                        ;
                        diag.arg("extern_crate", __binding_1);
                        diag.arg("local_crate", __binding_2);
                        diag.arg("flag_name", __binding_3);
                        diag.arg("flag_name_prefixed", __binding_4);
                        diag.arg("local_value", __binding_5);
                        diag.arg("extern_value", __binding_6);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
579#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")]
580#[help(
581    "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely"
582)]
583#[note(
584    "`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`"
585)]
586#[help(
587    "set `{$flag_name_prefixed}={$extern_value}` in this crate or `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`"
588)]
589#[help(
590    "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error"
591)]
592pub(crate) struct IncompatibleTargetModifiers {
593    #[primary_span]
594    pub span: Span,
595    pub extern_crate: Symbol,
596    pub local_crate: Symbol,
597    pub flag_name: String,
598    pub flag_name_prefixed: String,
599    pub local_value: String,
600    pub extern_value: String,
601}
602
603#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncompatibleTargetModifiersLMissed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncompatibleTargetModifiersLMissed {
                        span: __binding_0,
                        extern_crate: __binding_1,
                        local_crate: __binding_2,
                        flag_name: __binding_3,
                        flag_name_prefixed: __binding_4,
                        extern_value: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unset `{$flag_name_prefixed}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("set `{$flag_name_prefixed}={$extern_value}` in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error")));
                        ;
                        diag.arg("extern_crate", __binding_1);
                        diag.arg("local_crate", __binding_2);
                        diag.arg("flag_name", __binding_3);
                        diag.arg("flag_name_prefixed", __binding_4);
                        diag.arg("extern_value", __binding_5);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
604#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")]
605#[help(
606    "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely"
607)]
608#[note(
609    "unset `{$flag_name_prefixed}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`"
610)]
611#[help(
612    "set `{$flag_name_prefixed}={$extern_value}` in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}`"
613)]
614#[help(
615    "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error"
616)]
617pub(crate) struct IncompatibleTargetModifiersLMissed {
618    #[primary_span]
619    pub span: Span,
620    pub extern_crate: Symbol,
621    pub local_crate: Symbol,
622    pub flag_name: String,
623    pub flag_name_prefixed: String,
624    pub extern_value: String,
625}
626
627#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IncompatibleTargetModifiersRMissed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IncompatibleTargetModifiersRMissed {
                        span: __binding_0,
                        extern_crate: __binding_1,
                        local_crate: __binding_2,
                        flag_name: __binding_3,
                        flag_name_prefixed: __binding_4,
                        local_value: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with unset `{$flag_name_prefixed}` in dependency `{$extern_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unset `{$flag_name_prefixed}` in this crate or set `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error")));
                        ;
                        diag.arg("extern_crate", __binding_1);
                        diag.arg("local_crate", __binding_2);
                        diag.arg("flag_name", __binding_3);
                        diag.arg("flag_name_prefixed", __binding_4);
                        diag.arg("local_value", __binding_5);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
628#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")]
629#[help(
630    "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely"
631)]
632#[note(
633    "`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with unset `{$flag_name_prefixed}` in dependency `{$extern_crate}`"
634)]
635#[help(
636    "unset `{$flag_name_prefixed}` in this crate or set `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`"
637)]
638#[help(
639    "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error"
640)]
641pub(crate) struct IncompatibleTargetModifiersRMissed {
642    #[primary_span]
643    pub span: Span,
644    pub extern_crate: Symbol,
645    pub local_crate: Symbol,
646    pub flag_name: String,
647    pub flag_name_prefixed: String,
648    pub local_value: String,
649}
650
651#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnknownTargetModifierUnsafeAllowed where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnknownTargetModifierUnsafeAllowed {
                        span: __binding_0, flag_name: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown target modifier `{$flag_name}`, requested by `-Cunsafe-allow-abi-mismatch={$flag_name}`")));
                        ;
                        diag.arg("flag_name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
652#[diag(
653    "unknown target modifier `{$flag_name}`, requested by `-Cunsafe-allow-abi-mismatch={$flag_name}`"
654)]
655pub(crate) struct UnknownTargetModifierUnsafeAllowed {
656    #[primary_span]
657    pub span: Span,
658    pub flag_name: String,
659}
660
661#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            AsyncDropTypesInDependency where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    AsyncDropTypesInDependency {
                        span: __binding_0,
                        extern_crate: __binding_1,
                        local_crate: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found async drop types in dependency `{$extern_crate}`, but async_drop feature is disabled for `{$local_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used")));
                        ;
                        diag.arg("extern_crate", __binding_1);
                        diag.arg("local_crate", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
662#[diag(
663    "found async drop types in dependency `{$extern_crate}`, but async_drop feature is disabled for `{$local_crate}`"
664)]
665#[help(
666    "if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used"
667)]
668pub(crate) struct AsyncDropTypesInDependency {
669    #[primary_span]
670    pub span: Span,
671    pub extern_crate: Symbol,
672    pub local_crate: Symbol,
673}
674
675#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RawDylibMalformed where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    RawDylibMalformed { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link name must be well-formed if link kind is `raw-dylib`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
676#[diag("link name must be well-formed if link kind is `raw-dylib`")]
677pub(crate) struct RawDylibMalformed {
678    #[primary_span]
679    pub span: Span,
680}
681
682#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            UnusedCrateDependency where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    UnusedCrateDependency {
                        extern_crate: __binding_0, local_crate: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the dependency or add `use {$extern_crate} as _;` to the crate root")));
                        ;
                        diag.arg("extern_crate", __binding_0);
                        diag.arg("local_crate", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
683#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
684#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
685pub(crate) struct UnusedCrateDependency {
686    pub extern_crate: Symbol,
687    pub local_crate: Symbol,
688}
689
690#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MitigationLessStrictInDependency where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MitigationLessStrictInDependency {
                        span: __binding_0,
                        mitigation_name: __binding_1,
                        mitigation_level: __binding_2,
                        extern_crate: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("your program uses the crate `{$extern_crate}`, that is not compiled with `{$mitigation_name}{$mitigation_level}` enabled")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("recompile `{$extern_crate}` with `{$mitigation_name}{$mitigation_level}` enabled, or use `-Z allow-partial-mitigations={$mitigation_name}` to allow creating an artifact that has the mitigation partially enabled ")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("it is possible to disable `-Z allow-partial-mitigations={$mitigation_name}` via `-Z deny-partial-mitigations={$mitigation_name}`")));
                        ;
                        diag.arg("mitigation_name", __binding_1);
                        diag.arg("mitigation_level", __binding_2);
                        diag.arg("extern_crate", __binding_3);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
691#[diag(
692    "your program uses the crate `{$extern_crate}`, that is not compiled with `{$mitigation_name}{$mitigation_level}` enabled"
693)]
694#[note(
695    "recompile `{$extern_crate}` with `{$mitigation_name}{$mitigation_level}` enabled, or use `-Z allow-partial-mitigations={$mitigation_name}` to allow creating an artifact that has the mitigation partially enabled "
696)]
697#[help(
698    "it is possible to disable `-Z allow-partial-mitigations={$mitigation_name}` via `-Z deny-partial-mitigations={$mitigation_name}`"
699)]
700pub(crate) struct MitigationLessStrictInDependency {
701    #[primary_span]
702    pub span: Span,
703    pub mitigation_name: String,
704    pub mitigation_level: String,
705    pub extern_crate: Symbol,
706}