rustc_interface/
errors.rs

1use std::io;
2use std::path::Path;
3
4use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
5use rustc_span::{Span, Symbol};
6
7#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CrateNameDoesNotMatch where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    CrateNameDoesNotMatch {
                        span: __binding_0,
                        crate_name: __binding_1,
                        attr_crate_name: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_crate_name_does_not_match);
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.arg("attr_crate_name", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
8#[diag(interface_crate_name_does_not_match)]
9pub(crate) struct CrateNameDoesNotMatch {
10    #[primary_span]
11    pub(crate) span: Span,
12    pub(crate) crate_name: Symbol,
13    pub(crate) attr_crate_name: Symbol,
14}
15
16#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            CrateNameInvalid<'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 {
                    CrateNameInvalid { crate_name: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_crate_name_invalid);
                        ;
                        diag.arg("crate_name", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
17#[diag(interface_crate_name_invalid)]
18pub(crate) struct CrateNameInvalid<'a> {
19    pub(crate) crate_name: &'a str,
20}
21
22#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            FerrisIdentifier where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    FerrisIdentifier {
                        spans: __binding_0,
                        first_span: __binding_1,
                        ferris_fix: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_ferris_identifier);
                        let __code_0 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("{0}", __binding_2))
                                            })].into_iter();
                        ;
                        diag.arg("ferris_fix", __binding_2);
                        diag.span(__binding_0.clone());
                        diag.span_suggestions_with_style(__binding_1,
                            crate::fluent_generated::_subdiag::suggestion, __code_0,
                            rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
23#[diag(interface_ferris_identifier)]
24pub struct FerrisIdentifier {
25    #[primary_span]
26    pub spans: Vec<Span>,
27    #[suggestion(code = "{ferris_fix}", applicability = "maybe-incorrect")]
28    pub first_span: Span,
29    pub ferris_fix: &'static str,
30}
31
32#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EmojiIdentifier where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    EmojiIdentifier { spans: __binding_0, ident: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_emoji_identifier);
                        ;
                        diag.arg("ident", __binding_1);
                        diag.span(__binding_0.clone());
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
33#[diag(interface_emoji_identifier)]
34pub struct EmojiIdentifier {
35    #[primary_span]
36    pub spans: Vec<Span>,
37    pub ident: Symbol,
38}
39
40#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MixedBinCrate
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MixedBinCrate => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_mixed_bin_crate);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
41#[diag(interface_mixed_bin_crate)]
42pub struct MixedBinCrate;
43
44#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MixedProcMacroCrate where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MixedProcMacroCrate => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_mixed_proc_macro_crate);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
45#[diag(interface_mixed_proc_macro_crate)]
46pub struct MixedProcMacroCrate;
47
48#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            ErrorWritingDependencies<'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 {
                    ErrorWritingDependencies {
                        path: __binding_0, error: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_error_writing_dependencies);
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
49#[diag(interface_error_writing_dependencies)]
50pub struct ErrorWritingDependencies<'a> {
51    pub path: &'a Path,
52    pub error: io::Error,
53}
54
55#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            InputFileWouldBeOverWritten<'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 {
                    InputFileWouldBeOverWritten { path: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_input_file_would_be_overwritten);
                        ;
                        diag.arg("path", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
56#[diag(interface_input_file_would_be_overwritten)]
57pub struct InputFileWouldBeOverWritten<'a> {
58    pub path: &'a Path,
59}
60
61#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            GeneratedFileConflictsWithDirectory<'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 {
                    GeneratedFileConflictsWithDirectory {
                        input_path: __binding_0, dir_path: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_generated_file_conflicts_with_directory);
                        ;
                        diag.arg("input_path", __binding_0);
                        diag.arg("dir_path", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
62#[diag(interface_generated_file_conflicts_with_directory)]
63pub struct GeneratedFileConflictsWithDirectory<'a> {
64    pub input_path: &'a Path,
65    pub dir_path: &'a Path,
66}
67
68#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for TempsDirError
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    TempsDirError => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_temps_dir_error);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
69#[diag(interface_temps_dir_error)]
70pub struct TempsDirError;
71
72#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for OutDirError
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    OutDirError => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_out_dir_error);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
73#[diag(interface_out_dir_error)]
74pub struct OutDirError;
75
76#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            FailedWritingFile<'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 {
                    FailedWritingFile { path: __binding_0, error: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_failed_writing_file);
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
77#[diag(interface_failed_writing_file)]
78pub struct FailedWritingFile<'a> {
79    pub path: &'a Path,
80    pub error: io::Error,
81}
82
83#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ProcMacroCratePanicAbort where G: rustc_errors::EmissionGuarantee
            {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    ProcMacroCratePanicAbort => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_proc_macro_crate_panic_abort);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
84#[diag(interface_proc_macro_crate_panic_abort)]
85pub struct ProcMacroCratePanicAbort;
86
87#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleOutputTypesAdaption where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MultipleOutputTypesAdaption => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_multiple_output_types_adaption);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
88#[diag(interface_multiple_output_types_adaption)]
89pub struct MultipleOutputTypesAdaption;
90
91#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            IgnoringExtraFilename where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IgnoringExtraFilename => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_ignoring_extra_filename);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
92#[diag(interface_ignoring_extra_filename)]
93pub struct IgnoringExtraFilename;
94
95#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for IgnoringOutDir
            where G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    IgnoringOutDir => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_ignoring_out_dir);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
96#[diag(interface_ignoring_out_dir)]
97pub struct IgnoringOutDir;
98
99#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MultipleOutputTypesToStdout where
            G: rustc_errors::EmissionGuarantee {
            #[track_caller]
            fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
                level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
                match self {
                    MultipleOutputTypesToStdout => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_multiple_output_types_to_stdout);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
100#[diag(interface_multiple_output_types_to_stdout)]
101pub struct MultipleOutputTypesToStdout;
102
103#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            AbiRequiredTargetFeature<'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 {
                    AbiRequiredTargetFeature {
                        feature: __binding_0, enabled: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::interface_abi_required_feature);
                        diag.note(crate::fluent_generated::_subdiag::note);
                        diag.note(crate::fluent_generated::interface_abi_required_feature_issue);
                        ;
                        diag.arg("feature", __binding_0);
                        diag.arg("enabled", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
104#[diag(interface_abi_required_feature)]
105#[note]
106#[note(interface_abi_required_feature_issue)]
107pub(crate) struct AbiRequiredTargetFeature<'a> {
108    pub feature: &'a str,
109    pub enabled: &'a str,
110}
111
112#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            UnknownCrateTypes {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    UnknownCrateTypes { sugg: __binding_0 } => {
                        diag.primary_message(crate::fluent_generated::interface_invalid_crate_type_value);
                        ;
                        if let Some(__binding_0) = __binding_0 {
                            diag.subdiagnostic(__binding_0);
                        }
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
113#[diag(interface_invalid_crate_type_value)]
114pub(crate) struct UnknownCrateTypes {
115    #[subdiagnostic]
116    pub sugg: Option<UnknownCrateTypesSub>,
117}
118
119#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for UnknownCrateTypesSub {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    UnknownCrateTypesSub {
                        span: __binding_0, snippet: __binding_1 } => {
                        let __code_1 =
                            [::alloc::__export::must_use({
                                                ::alloc::fmt::format(format_args!("\"{0}\"", __binding_1))
                                            })].into_iter();
                        diag.store_args();
                        diag.arg("snippet", __binding_1);
                        let __message =
                            diag.eagerly_translate(crate::fluent_generated::interface_suggestion);
                        diag.span_suggestions_with_style(__binding_0, __message,
                            __code_1, rustc_errors::Applicability::MaybeIncorrect,
                            rustc_errors::SuggestionStyle::ShowCode);
                        diag.restore_args();
                    }
                }
            }
        }
    };Subdiagnostic)]
120#[suggestion(interface_suggestion, code = r#""{snippet}""#, applicability = "maybe-incorrect")]
121pub(crate) struct UnknownCrateTypesSub {
122    #[primary_span]
123    pub span: Span,
124    pub snippet: Symbol,
125}