Port ArchiveBuildFailure

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

View File

@ -12,7 +12,7 @@
use object::read::macho::FatArch; use object::read::macho::FatArch;
use crate::common; use crate::common;
use crate::errors::ErrorCreatingImportLibrary; use crate::errors::{ErrorCreatingImportLibrary, ArchiveBuildFailure};
use crate::llvm::archive_ro::{ArchiveRO, Child}; use crate::llvm::archive_ro::{ArchiveRO, Child};
use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport}; use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport};
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder}; use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
@ -148,7 +148,7 @@ fn add_file(&mut self, file: &Path) {
fn build(mut self: Box<Self>, output: &Path) -> bool { fn build(mut self: Box<Self>, output: &Path) -> bool {
match self.build_with_llvm(output) { match self.build_with_llvm(output) {
Ok(any_members) => any_members, Ok(any_members) => any_members,
Err(e) => self.sess.fatal(&format!("failed to build archive: {}", e)), Err(e) => self.sess.emit_fatal(ArchiveBuildFailure { error: e }),
} }
} }
} }

View File

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

View File

@ -36,3 +36,6 @@ codegen_llvm_linkage_const_or_mut_type =
codegen_llvm_sanitizer_memtag_requires_mte = codegen_llvm_sanitizer_memtag_requires_mte =
`-Zsanitizer=memtag` requires `-Ctarget-feature=+mte` `-Zsanitizer=memtag` requires `-Ctarget-feature=+mte`
codegen_llvm_archive_build_failure =
failed to build archive: {$error}