Import ErrorWritingDEFFile

This commit is contained in:
SLASHLogin 2022-08-26 14:17:15 +02:00
parent d32caf9ced
commit ddbb650289
3 changed files with 11 additions and 2 deletions

View File

@ -12,7 +12,7 @@ use std::str;
use object::read::macho::FatArch;
use crate::common;
use crate::errors::{ErrorCreatingImportLibrary, ArchiveBuildFailure};
use crate::errors::{ArchiveBuildFailure, ErrorCreatingImportLibrary, ErrorWritingDEFFile};
use crate::llvm::archive_ro::{ArchiveRO, Child};
use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport};
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
@ -218,7 +218,7 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
match std::fs::write(&def_file_path, def_file_content) {
Ok(_) => {}
Err(e) => {
sess.fatal(&format!("Error writing .DEF file: {}", e));
sess.emit_fatal(ErrorWritingDEFFile { error: e });
}
};

View File

@ -90,3 +90,9 @@ pub(crate) struct SanitizerMemtagRequiresMte;
pub(crate) struct ArchiveBuildFailure {
pub error: std::io::Error,
}
#[derive(SessionDiagnostic)]
#[diag(codegen_llvm::error_writing_def_file)]
pub(crate) struct ErrorWritingDEFFile {
pub error: std::io::Error,
}

View File

@ -39,3 +39,6 @@ codegen_llvm_sanitizer_memtag_requires_mte =
codegen_llvm_archive_build_failure =
failed to build archive: {$error}
codegen_llvm_error_writing_def_file =
Error writing .DEF file: {$error}