1 //! Errors emitted by codegen_ssa
3 use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg};
4 use rustc_macros::Diagnostic;
7 use std::path::{Path, PathBuf};
10 #[diag(codegen_ssa::missing_native_static_library)]
11 pub struct MissingNativeStaticLibrary<'a> {
12 pub library_name: &'a str,
16 #[diag(codegen_ssa::lib_def_write_failure)]
17 pub struct LibDefWriteFailure {
22 #[diag(codegen_ssa::version_script_write_failure)]
23 pub struct VersionScriptWriteFailure {
28 #[diag(codegen_ssa::symbol_file_write_failure)]
29 pub struct SymbolFileWriteFailure {
34 #[diag(codegen_ssa::unsupported_arch)]
35 pub struct UnsupportedArch;
38 #[diag(codegen_ssa::msvc_path_not_found)]
39 pub struct MsvcPathNotFound;
42 #[diag(codegen_ssa::link_exe_not_found)]
43 pub struct LinkExeNotFound;
46 #[diag(codegen_ssa::ld64_unimplemented_modifier)]
47 pub struct Ld64UnimplementedModifier;
50 #[diag(codegen_ssa::linker_unsupported_modifier)]
51 pub struct LinkerUnsupportedModifier;
54 #[diag(codegen_ssa::L4Bender_exporting_symbols_unimplemented)]
55 pub struct L4BenderExportingSymbolsUnimplemented;
58 #[diag(codegen_ssa::no_natvis_directory)]
59 pub struct NoNatvisDirectory {
64 #[diag(codegen_ssa::copy_path_buf)]
65 pub struct CopyPathBuf {
66 pub source_file: PathBuf,
67 pub output_path: PathBuf,
71 // Reports Paths using `Debug` implementation rather than Path's `Display` implementation.
73 #[diag(codegen_ssa::copy_path)]
74 pub struct CopyPath<'a> {
75 from: DebugArgPath<'a>,
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 }
86 struct DebugArgPath<'a> {
90 impl IntoDiagnosticArg for DebugArgPath<'_> {
91 fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
92 DiagnosticArgValue::Str(Cow::Owned(format!("{:?}", self.path)))
97 #[diag(codegen_ssa::ignoring_emit_path)]
98 pub struct IgnoringEmitPath {
99 pub extension: String,
102 #[derive(Diagnostic)]
103 #[diag(codegen_ssa::ignoring_output)]
104 pub struct IgnoringOutput {
105 pub extension: String,