Skip to main content

rustc_interface/
errors.rs

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