Skip to content

Commit d32caf9

Browse files
committed
Port ArchiveBuildFailure
1 parent 978b5f7 commit d32caf9

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

compiler/rustc_codegen_llvm/src/back/archive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::str;
1212
use object::read::macho::FatArch;
1313

1414
use crate::common;
15-
use crate::errors::ErrorCreatingImportLibrary;
15+
use crate::errors::{ErrorCreatingImportLibrary, ArchiveBuildFailure};
1616
use crate::llvm::archive_ro::{ArchiveRO, Child};
1717
use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport};
1818
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
@@ -148,7 +148,7 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> {
148148
fn build(mut self: Box<Self>, output: &Path) -> bool {
149149
match self.build_with_llvm(output) {
150150
Ok(any_members) => any_members,
151-
Err(e) => self.sess.fatal(&format!("failed to build archive: {}", e)),
151+
Err(e) => self.sess.emit_fatal(ArchiveBuildFailure { error: e }),
152152
}
153153
}
154154
}

compiler/rustc_codegen_llvm/src/errors.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,9 @@ pub(crate) struct LinkageConstOrMutType {
8484
#[derive(SessionDiagnostic)]
8585
#[diag(codegen_llvm::sanitizer_memtag_requires_mte)]
8686
pub(crate) struct SanitizerMemtagRequiresMte;
87+
88+
#[derive(SessionDiagnostic)]
89+
#[diag(codegen_llvm::archive_build_failure)]
90+
pub(crate) struct ArchiveBuildFailure {
91+
pub error: std::io::Error,
92+
}

compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ codegen_llvm_linkage_const_or_mut_type =
3636
3737
codegen_llvm_sanitizer_memtag_requires_mte =
3838
`-Zsanitizer=memtag` requires `-Ctarget-feature=+mte`
39+
40+
codegen_llvm_archive_build_failure =
41+
failed to build archive: {$error}

0 commit comments

Comments
 (0)