]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_ssa/src/errors.rs
UPDATE - codege-ssa errors to new Diagnostic macro name
[rust.git] / compiler / rustc_codegen_ssa / src / errors.rs
1 //! Errors emitted by codegen_ssa
2
3 use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg};
4 use rustc_macros::Diagnostic;
5 use std::borrow::Cow;
6 use std::io::Error;
7 use std::path::{Path, PathBuf};
8
9 #[derive(Diagnostic)]
10 #[diag(codegen_ssa::missing_native_static_library)]
11 pub struct MissingNativeStaticLibrary<'a> {
12     pub library_name: &'a str,
13 }
14
15 #[derive(Diagnostic)]
16 #[diag(codegen_ssa::lib_def_write_failure)]
17 pub struct LibDefWriteFailure {
18     pub error: Error,
19 }
20
21 #[derive(Diagnostic)]
22 #[diag(codegen_ssa::version_script_write_failure)]
23 pub struct VersionScriptWriteFailure {
24     pub error: Error,
25 }
26
27 #[derive(Diagnostic)]
28 #[diag(codegen_ssa::symbol_file_write_failure)]
29 pub struct SymbolFileWriteFailure {
30     pub error: Error,
31 }
32
33 #[derive(Diagnostic)]
34 #[diag(codegen_ssa::unsupported_arch)]
35 pub struct UnsupportedArch;
36
37 #[derive(Diagnostic)]
38 #[diag(codegen_ssa::msvc_path_not_found)]
39 pub struct MsvcPathNotFound;
40
41 #[derive(Diagnostic)]
42 #[diag(codegen_ssa::link_exe_not_found)]
43 pub struct LinkExeNotFound;
44
45 #[derive(Diagnostic)]
46 #[diag(codegen_ssa::ld64_unimplemented_modifier)]
47 pub struct Ld64UnimplementedModifier;
48
49 #[derive(Diagnostic)]
50 #[diag(codegen_ssa::linker_unsupported_modifier)]
51 pub struct LinkerUnsupportedModifier;
52
53 #[derive(Diagnostic)]
54 #[diag(codegen_ssa::L4Bender_exporting_symbols_unimplemented)]
55 pub struct L4BenderExportingSymbolsUnimplemented;
56
57 #[derive(Diagnostic)]
58 #[diag(codegen_ssa::no_natvis_directory)]
59 pub struct NoNatvisDirectory {
60     pub error: Error,
61 }
62
63 #[derive(Diagnostic)]
64 #[diag(codegen_ssa::copy_path_buf)]
65 pub struct CopyPathBuf {
66     pub source_file: PathBuf,
67     pub output_path: PathBuf,
68     pub error: Error,
69 }
70
71 // Reports Paths using `Debug` implementation rather than Path's `Display` implementation.
72 #[derive(Diagnostic)]
73 #[diag(codegen_ssa::copy_path)]
74 pub struct CopyPath<'a> {
75     from: DebugArgPath<'a>,
76     to: DebugArgPath<'a>,
77     error: Error,
78 }
79
80 impl<'a> CopyPath<'a> {
81     pub fn new(from: &'a Path, to: &'a Path, error: Error) -> CopyPath<'a> {
82         CopyPath { from: DebugArgPath { path: from }, to: DebugArgPath { path: to }, error }
83     }
84 }
85
86 struct DebugArgPath<'a> {
87     pub path: &'a Path,
88 }
89
90 impl IntoDiagnosticArg for DebugArgPath<'_> {
91     fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
92         DiagnosticArgValue::Str(Cow::Owned(format!("{:?}", self.path)))
93     }
94 }
95
96 #[derive(Diagnostic)]
97 #[diag(codegen_ssa::ignoring_emit_path)]
98 pub struct IgnoringEmitPath {
99     pub extension: String,
100 }
101
102 #[derive(Diagnostic)]
103 #[diag(codegen_ssa::ignoring_output)]
104 pub struct IgnoringOutput {
105     pub extension: String,
106 }