2022-10-04 17:23:53 +00:00
|
|
|
//! Errors emitted by codegen_ssa
|
|
|
|
|
2022-08-28 23:58:12 +00:00
|
|
|
use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg};
|
2022-10-04 17:23:53 +00:00
|
|
|
use rustc_macros::SessionDiagnostic;
|
2022-08-28 23:58:12 +00:00
|
|
|
use std::borrow::Cow;
|
2022-08-27 00:21:55 +00:00
|
|
|
use std::io::Error;
|
2022-08-28 23:58:12 +00:00
|
|
|
use std::path::{Path, PathBuf};
|
2022-10-04 17:23:53 +00:00
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::missing_native_static_library)]
|
|
|
|
pub struct MissingNativeStaticLibrary<'a> {
|
|
|
|
pub library_name: &'a str,
|
|
|
|
}
|
2022-08-25 03:40:07 +00:00
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::lib_def_write_failure)]
|
|
|
|
pub struct LibDefWriteFailure {
|
2022-08-27 00:21:55 +00:00
|
|
|
pub error: Error,
|
2022-08-25 03:40:07 +00:00
|
|
|
}
|
2022-10-07 14:03:45 +00:00
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::version_script_write_failure)]
|
|
|
|
pub struct VersionScriptWriteFailure {
|
|
|
|
pub error: Error,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::symbol_file_write_failure)]
|
|
|
|
pub struct SymbolFileWriteFailure {
|
|
|
|
pub error: Error,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::unsupported_arch)]
|
|
|
|
pub struct UnsupportedArch;
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::msvc_path_not_found)]
|
|
|
|
pub struct MsvcPathNotFound;
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::link_exe_not_found)]
|
|
|
|
pub struct LinkExeNotFound;
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::ld64_unimplemented_modifier)]
|
|
|
|
pub struct Ld64UnimplementedModifier;
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::linker_unsupported_modifier)]
|
|
|
|
pub struct LinkerUnsupportedModifier;
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::L4Bender_exporting_symbols_unimplemented)]
|
|
|
|
pub struct L4BenderExportingSymbolsUnimplemented;
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::no_natvis_directory)]
|
|
|
|
pub struct NoNatvisDirectory {
|
|
|
|
pub error: Error,
|
|
|
|
}
|
2022-08-28 23:58:12 +00:00
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::copy_path_buf)]
|
|
|
|
pub struct CopyPathBuf {
|
|
|
|
pub source_file: PathBuf,
|
|
|
|
pub output_path: PathBuf,
|
|
|
|
pub error: Error,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reports Paths using `Debug` implementation rather than Path's `Display` implementation.
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::copy_path)]
|
|
|
|
pub struct CopyPath<'a> {
|
|
|
|
from: DebugArgPath<'a>,
|
|
|
|
to: DebugArgPath<'a>,
|
|
|
|
error: Error,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> CopyPath<'a> {
|
|
|
|
pub fn new(from: &'a Path, to: &'a Path, error: Error) -> CopyPath<'a> {
|
|
|
|
CopyPath { from: DebugArgPath { path: from }, to: DebugArgPath { path: to }, error }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct DebugArgPath<'a> {
|
|
|
|
pub path: &'a Path,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl IntoDiagnosticArg for DebugArgPath<'_> {
|
|
|
|
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
|
|
|
|
DiagnosticArgValue::Str(Cow::Owned(format!("{:?}", self.path)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::ignoring_emit_path)]
|
|
|
|
pub struct IgnoringEmitPath {
|
|
|
|
pub extension: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(SessionDiagnostic)]
|
|
|
|
#[diag(codegen_ssa::ignoring_output)]
|
|
|
|
pub struct IgnoringOutput {
|
|
|
|
pub extension: String,
|
|
|
|
}
|