Skip to main content

rustc_metadata/
diagnostics.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, 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)]
257#[diag("couldn't create a temp dir: {$err}")]
258pub(crate) struct FailedCreateTempdir {
259    pub err: Error,
260}
261
262#[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)]
263#[diag("failed to create the file {$filename}: {$err}")]
264pub(crate) struct FailedCreateFile<'a> {
265    pub filename: &'a Path,
266    pub err: Error,
267}
268
269#[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)]
270#[diag("failed to create encoded metadata from file: {$err}")]
271pub(crate) struct FailedCreateEncodedMetadata {
272    pub err: Error,
273}
274
275#[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)]
276#[diag("cannot load a crate with a non-ascii name `{$crate_name}`")]
277pub(crate) struct NonAsciiName {
278    #[primary_span]
279    pub span: Span,
280    pub crate_name: Symbol,
281}
282
283#[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)]
284#[diag("extern location for {$crate_name} does not exist: {$location}")]
285pub(crate) struct ExternLocationNotExist<'a> {
286    #[primary_span]
287    pub span: Span,
288    pub crate_name: Symbol,
289    pub location: &'a Path,
290}
291
292#[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)]
293#[diag("extern location for {$crate_name} is not a file: {$location}")]
294pub(crate) struct ExternLocationNotFile<'a> {
295    #[primary_span]
296    pub span: Span,
297    pub crate_name: Symbol,
298    pub location: &'a Path,
299}
300
301pub(crate) struct MultipleCandidates {
302    pub span: Span,
303    pub flavor: CrateFlavor,
304    pub crate_name: Symbol,
305    pub candidates: Vec<PathBuf>,
306}
307
308impl<G: EmissionGuarantee> Diagnostic<'_, G> for MultipleCandidates {
309    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
310        let mut diag = Diag::new(
311            dcx,
312            level,
313            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"),
314        );
315        diag.arg("crate_name", self.crate_name);
316        diag.arg("flavor", self.flavor);
317        diag.code(E0464);
318        diag.span(self.span);
319        for (i, candidate) in self.candidates.iter().enumerate() {
320            diag.note(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("candidate #{0}: {1}", i + 1,
                candidate.display()))
    })format!("candidate #{}: {}", i + 1, candidate.display()));
321        }
322        diag
323    }
324}
325
326#[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)]
327#[diag(
328    "only metadata stub found for `{$flavor}` dependency `{$crate_name}` please provide path to the corresponding .rmeta file with full metadata"
329)]
330pub(crate) struct FullMetadataNotFound {
331    #[primary_span]
332    pub span: Span,
333    pub flavor: CrateFlavor,
334    pub crate_name: Symbol,
335}
336
337#[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)]
338#[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)]
339pub(crate) struct SymbolConflictsCurrent {
340    #[primary_span]
341    pub span: Span,
342    pub crate_name: Symbol,
343}
344
345#[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)]
346#[diag("found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values")]
347pub(crate) struct StableCrateIdCollision {
348    #[primary_span]
349    pub span: Span,
350    pub crate_name0: Symbol,
351    pub crate_name1: Symbol,
352}
353
354#[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)]
355#[diag("{$path}{$err}")]
356pub(crate) struct DlError {
357    #[primary_span]
358    pub span: Span,
359    pub path: String,
360    pub err: String,
361}
362
363#[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)]
364#[diag("found possibly newer version of crate `{$crate_name}`{$add_info}", code = E0460)]
365#[note("perhaps that crate needs to be recompiled?")]
366#[note("the following crate versions were found:{$found_crates}")]
367pub(crate) struct NewerCrateVersion {
368    #[primary_span]
369    pub span: Span,
370    pub crate_name: Symbol,
371    pub add_info: String,
372    pub found_crates: String,
373}
374
375#[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)]
376#[diag("couldn't find crate `{$crate_name}` with expected target triple {$locator_triple}{$add_info}", code = E0461)]
377#[note("the following crate versions were found:{$found_crates}")]
378pub(crate) struct NoCrateWithTriple<'a> {
379    #[primary_span]
380    pub span: Span,
381    pub crate_name: Symbol,
382    pub locator_triple: &'a str,
383    pub add_info: String,
384    pub found_crates: String,
385}
386
387#[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)]
388#[diag("found staticlib `{$crate_name}` instead of rlib or dylib{$add_info}", code = E0462)]
389#[note("the following crate versions were found:{$found_crates}")]
390#[help("please recompile that crate using --crate-type lib")]
391pub(crate) struct FoundStaticlib {
392    #[primary_span]
393    pub span: Span,
394    pub crate_name: Symbol,
395    pub add_info: String,
396    pub found_crates: String,
397}
398
399#[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)]
400#[diag("found crate `{$crate_name}` compiled by an incompatible version of rustc{$add_info}", code = E0514)]
401#[note("the following crate versions were found:{$found_crates}")]
402#[help(
403    "please recompile that crate using this compiler ({$rustc_version}) (consider running `cargo clean` first)"
404)]
405pub(crate) struct IncompatibleRustc {
406    #[primary_span]
407    pub span: Span,
408    pub crate_name: Symbol,
409    pub add_info: String,
410    pub found_crates: String,
411    pub rustc_version: String,
412}
413
414pub(crate) struct InvalidMetadataFiles {
415    pub span: Span,
416    pub crate_name: Symbol,
417    pub add_info: String,
418    pub crate_rejections: Vec<String>,
419}
420
421impl<G: EmissionGuarantee> Diagnostic<'_, G> for InvalidMetadataFiles {
422    #[track_caller]
423    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
424        let mut diag = Diag::new(
425            dcx,
426            level,
427            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}"),
428        );
429        diag.arg("crate_name", self.crate_name);
430        diag.arg("add_info", self.add_info);
431        diag.code(E0786);
432        diag.span(self.span);
433        for crate_rejection in self.crate_rejections {
434            diag.note(crate_rejection);
435        }
436        diag
437    }
438}
439
440pub(crate) struct CannotFindCrate {
441    pub span: Span,
442    pub crate_name: Symbol,
443    pub add_info: String,
444    pub missing_core: bool,
445    pub current_crate: String,
446    pub is_nightly_build: bool,
447    pub profiler_runtime: Symbol,
448    pub locator_triple: TargetTuple,
449    pub is_ui_testing: bool,
450    pub is_tier_3: bool,
451}
452
453impl<G: EmissionGuarantee> Diagnostic<'_, G> for CannotFindCrate {
454    #[track_caller]
455    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
456        let mut diag =
457            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}"));
458        diag.arg("crate_name", self.crate_name);
459        diag.arg("current_crate", self.current_crate);
460        diag.arg("add_info", self.add_info);
461        diag.arg("locator_triple", self.locator_triple.tuple());
462        diag.code(E0463);
463        diag.span(self.span);
464        if self.crate_name == sym::std || self.crate_name == sym::core {
465            if self.missing_core {
466                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"));
467            } else {
468                diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$locator_triple}` target may not support the standard library"))msg!(
469                    "the `{$locator_triple}` target may not support the standard library"
470                ));
471            }
472
473            let has_precompiled_std = !self.is_tier_3;
474
475            if self.missing_core {
476                if "nightly"env!("CFG_RELEASE_CHANNEL") == "dev" && !self.is_ui_testing {
477                    // Note: Emits the nicer suggestion only for the dev channel.
478                    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}`"));
479                } else if has_precompiled_std {
480                    // NOTE: this suggests using rustup, even though the user may not have it installed.
481                    // That's because they could choose to install it; or this may give them a hint which
482                    // target they need to install from their distro.
483                    diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider downloading the target with `rustup target add {$locator_triple}`"))msg!(
484                        "consider downloading the target with `rustup target add {$locator_triple}`"
485                    ));
486                }
487            }
488
489            // Suggest using #![no_std]. #[no_core] is unstable and not really supported anyway.
490            // NOTE: this is a dummy span if `extern crate std` was injected by the compiler.
491            // If it's not a dummy, that means someone added `extern crate std` explicitly and
492            // `#![no_std]` won't help.
493            if !self.missing_core && self.span.is_dummy() {
494                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]`"));
495            }
496            // Recommend -Zbuild-std even on stable builds for Tier 3 targets because
497            // it's the recommended way to use the target, the user should switch to nightly.
498            if self.is_nightly_build || !has_precompiled_std {
499                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`"));
500            }
501        } else if self.crate_name == self.profiler_runtime {
502            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"));
503        } else if self.crate_name.as_str().starts_with("rustc_") {
504            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`"));
505        }
506        diag.span_label(self.span, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can't find crate"))msg!("can't find crate"));
507        diag
508    }
509}
510
511#[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)]
512#[diag("extern location for {$crate_name} is of an unknown type: {$path}")]
513pub(crate) struct CrateLocationUnknownType<'a> {
514    #[primary_span]
515    pub span: Span,
516    pub path: &'a Path,
517    pub crate_name: Symbol,
518}
519
520#[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)]
521#[diag("file name should be lib*.rlib or {$dll_prefix}*{$dll_suffix}")]
522pub(crate) struct LibFilenameForm<'a> {
523    #[primary_span]
524    pub span: Span,
525    pub dll_prefix: &'a str,
526    pub dll_suffix: &'a str,
527}
528
529#[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)]
530#[diag(
531    "older versions of the `wasm-bindgen` crate are incompatible with current versions of Rust; please update to `wasm-bindgen` v0.2.88"
532)]
533pub(crate) struct WasmCAbi {
534    #[primary_span]
535    pub span: Span,
536}
537
538#[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 {
                        extern_crate: __binding_0,
                        local_crate: __binding_1,
                        flag_name: __binding_2,
                        flag_name_prefixed: __binding_3,
                        local_value: __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("`{$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_0);
                        diag.arg("local_crate", __binding_1);
                        diag.arg("flag_name", __binding_2);
                        diag.arg("flag_name_prefixed", __binding_3);
                        diag.arg("local_value", __binding_4);
                        diag.arg("extern_value", __binding_5);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
539#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")]
540#[help(
541    "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely"
542)]
543#[note(
544    "`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`"
545)]
546#[help(
547    "set `{$flag_name_prefixed}={$extern_value}` in this crate or `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`"
548)]
549#[help(
550    "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error"
551)]
552pub(crate) struct IncompatibleTargetModifiers {
553    pub extern_crate: Symbol,
554    pub local_crate: Symbol,
555    pub flag_name: String,
556    pub flag_name_prefixed: String,
557    pub local_value: String,
558    pub extern_value: String,
559}
560
561#[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 {
                        extern_crate: __binding_0,
                        local_crate: __binding_1,
                        flag_name: __binding_2,
                        flag_name_prefixed: __binding_3,
                        extern_value: __binding_4,
                        has_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("`{$flag_name_prefixed}` is unset in this crate which is incompatible with {$has_extern_value ->\n        [false]  `{$flag_name_prefixed}` being set\n        *[other] `{$flag_name_prefixed}={$extern_value}`\n    } in dependency `{$extern_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("set {$has_extern_value ->\n        [false]  `{$flag_name_prefixed}`\n        *[other] `{$flag_name_prefixed}={$extern_value}`\n    } 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_0);
                        diag.arg("local_crate", __binding_1);
                        diag.arg("flag_name", __binding_2);
                        diag.arg("flag_name_prefixed", __binding_3);
                        diag.arg("extern_value", __binding_4);
                        diag.arg("has_extern_value", __binding_5);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
562#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")]
563#[help(
564    "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely"
565)]
566#[note(
567    "`{$flag_name_prefixed}` is unset in this crate which is incompatible with {$has_extern_value ->
568        [false]  `{$flag_name_prefixed}` being set
569        *[other] `{$flag_name_prefixed}={$extern_value}`
570    } in dependency `{$extern_crate}`"
571)]
572#[help(
573    "set {$has_extern_value ->
574        [false]  `{$flag_name_prefixed}`
575        *[other] `{$flag_name_prefixed}={$extern_value}`
576    } in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}`"
577)]
578#[help(
579    "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error"
580)]
581pub(crate) struct IncompatibleTargetModifiersLMissed {
582    pub extern_crate: Symbol,
583    pub local_crate: Symbol,
584    pub flag_name: String,
585    pub flag_name_prefixed: String,
586    pub extern_value: String,
587    pub has_extern_value: bool,
588}
589
590#[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 {
                        extern_crate: __binding_0,
                        local_crate: __binding_1,
                        flag_name: __binding_2,
                        flag_name_prefixed: __binding_3,
                        local_value: __binding_4,
                        has_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("{$has_local_value ->\n        [false]  `{$flag_name_prefixed}` being set\n        *[other] `{$flag_name_prefixed}={$local_value}`\n    } in this crate is incompatible with `{$flag_name_prefixed}` being unset in dependency `{$extern_crate}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unset `{$flag_name_prefixed}` in this crate or set {$has_local_value ->\n        [false]  `{$flag_name_prefixed}`\n        *[other] `{$flag_name_prefixed}={$local_value}`\n    } 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_0);
                        diag.arg("local_crate", __binding_1);
                        diag.arg("flag_name", __binding_2);
                        diag.arg("flag_name_prefixed", __binding_3);
                        diag.arg("local_value", __binding_4);
                        diag.arg("has_local_value", __binding_5);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
591#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")]
592#[help(
593    "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely"
594)]
595#[note(
596    "{$has_local_value ->
597        [false]  `{$flag_name_prefixed}` being set
598        *[other] `{$flag_name_prefixed}={$local_value}`
599    } in this crate is incompatible with `{$flag_name_prefixed}` being unset in dependency `{$extern_crate}`"
600)]
601#[help(
602    "unset `{$flag_name_prefixed}` in this crate or set {$has_local_value ->
603        [false]  `{$flag_name_prefixed}`
604        *[other] `{$flag_name_prefixed}={$local_value}`
605    } in `{$extern_crate}`"
606)]
607#[help(
608    "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error"
609)]
610pub(crate) struct IncompatibleTargetModifiersRMissed {
611    pub extern_crate: Symbol,
612    pub local_crate: Symbol,
613    pub flag_name: String,
614    pub flag_name_prefixed: String,
615    pub local_value: String,
616    pub has_local_value: bool,
617}
618
619#[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 { flag_name: __binding_0
                        } => {
                        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_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
620#[diag(
621    "unknown target modifier `{$flag_name}`, requested by `-Cunsafe-allow-abi-mismatch={$flag_name}`"
622)]
623pub(crate) struct UnknownTargetModifierUnsafeAllowed {
624    pub flag_name: String,
625}
626
627#[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)]
628#[diag(
629    "found async drop types in dependency `{$extern_crate}`, but async_drop feature is disabled for `{$local_crate}`"
630)]
631#[help(
632    "if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used"
633)]
634pub(crate) struct AsyncDropTypesInDependency {
635    #[primary_span]
636    pub span: Span,
637    pub extern_crate: Symbol,
638    pub local_crate: Symbol,
639}
640
641#[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)]
642#[diag("link name must be well-formed if link kind is `raw-dylib`")]
643pub(crate) struct RawDylibMalformed {
644    #[primary_span]
645    pub span: Span,
646}
647
648#[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)]
649#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
650#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
651pub(crate) struct UnusedCrateDependency {
652    pub extern_crate: Symbol,
653    pub local_crate: Symbol,
654}
655
656#[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 {
                        mitigation_name: __binding_0,
                        mitigation_level: __binding_1,
                        extern_crate: __binding_2 } => {
                        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_0);
                        diag.arg("mitigation_level", __binding_1);
                        diag.arg("extern_crate", __binding_2);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
657#[diag(
658    "your program uses the crate `{$extern_crate}`, that is not compiled with `{$mitigation_name}{$mitigation_level}` enabled"
659)]
660#[note(
661    "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 "
662)]
663#[help(
664    "it is possible to disable `-Z allow-partial-mitigations={$mitigation_name}` via `-Z deny-partial-mitigations={$mitigation_name}`"
665)]
666pub(crate) struct MitigationLessStrictInDependency {
667    pub mitigation_name: String,
668    pub mitigation_level: String,
669    pub extern_crate: Symbol,
670}
671
672#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            StaticLinkingNotSupported<'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 {
                    StaticLinkingNotSupported::UserRequested {
                        lib_name: __binding_0, target: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("static linking of `{$lib_name}` is not supported on `{$target}`; using dynamic linking instead")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove `kind = \"static\"` and ensure a shared library is available")));
                        ;
                        diag.arg("lib_name", __binding_0);
                        diag.arg("target", __binding_1);
                        diag
                    }
                    StaticLinkingNotSupported::FromDependency {
                        lib_name: __binding_0, target: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("library `{$lib_name}` is linked statically by a dependency, but `{$target}` requires dynamic linking; using dynamic linking instead")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ensure a shared library is available")));
                        ;
                        diag.arg("lib_name", __binding_0);
                        diag.arg("target", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
673pub(crate) enum StaticLinkingNotSupported<'a> {
674    #[diag(
675        "static linking of `{$lib_name}` is not supported on `{$target}`; using dynamic linking instead"
676    )]
677    #[help("remove `kind = \"static\"` and ensure a shared library is available")]
678    UserRequested { lib_name: Symbol, target: &'a str },
679
680    #[diag(
681        "library `{$lib_name}` is linked statically by a dependency, but `{$target}` requires dynamic linking; using dynamic linking instead"
682    )]
683    #[help("ensure a shared library is available")]
684    FromDependency { lib_name: Symbol, target: &'a str },
685}