Skip to content

Commit 81f7a8d

Browse files
committed
Port ErrorCallingDllTool
1 parent ddbb650 commit 81f7a8d

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

compiler/rustc_codegen_llvm/src/back/archive.rs

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

1414
use crate::common;
15-
use crate::errors::{ArchiveBuildFailure, ErrorCreatingImportLibrary, ErrorWritingDEFFile};
15+
use crate::errors::{
16+
ArchiveBuildFailure, ErrorCallingDllTool, ErrorCreatingImportLibrary, ErrorWritingDEFFile,
17+
};
1618
use crate::llvm::archive_ro::{ArchiveRO, Child};
1719
use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport};
1820
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
@@ -240,7 +242,7 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
240242

241243
match result {
242244
Err(e) => {
243-
sess.fatal(&format!("Error calling dlltool: {}", e));
245+
sess.emit_fatal(ErrorCallingDllTool { error: e });
244246
}
245247
Ok(output) if !output.status.success() => sess.fatal(&format!(
246248
"Dlltool could not create import library: {}\n{}",

compiler/rustc_codegen_llvm/src/errors.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,9 @@ pub(crate) struct ArchiveBuildFailure {
9696
pub(crate) struct ErrorWritingDEFFile {
9797
pub error: std::io::Error,
9898
}
99+
100+
#[derive(SessionDiagnostic)]
101+
#[diag(codegen_llvm::error_calling_dlltool)]
102+
pub(crate) struct ErrorCallingDllTool {
103+
pub error: std::io::Error,
104+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ codegen_llvm_archive_build_failure =
4242
4343
codegen_llvm_error_writing_def_file =
4444
Error writing .DEF file: {$error}
45+
46+
codegen_llvm_error_calling_dlltool =
47+
Error calling dlltool: {$error}

0 commit comments

Comments
 (0)