about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSLASHLogin <loginmlgxd@gmail.com>2022-08-26 14:29:33 +0200
committerSLASHLogin <loginmlgxd@gmail.com>2022-11-09 14:56:21 +0100
commit81f7a8d7f1ddcbe9ed49757a925366d0041eda31 (patch)
treee79b5cf2351d8443115f296e5d77f83903f37e0b
parentddbb6502893999b8f9a9780274318b63c3df25fb (diff)
downloadrust-81f7a8d7f1ddcbe9ed49757a925366d0041eda31.tar.gz
rust-81f7a8d7f1ddcbe9ed49757a925366d0041eda31.zip
Port ErrorCallingDllTool
-rw-r--r--compiler/rustc_codegen_llvm/src/back/archive.rs6
-rw-r--r--compiler/rustc_codegen_llvm/src/errors.rs6
-rw-r--r--compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl3
3 files changed, 13 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs
index 01d4cda18d4..e73e122ee68 100644
--- a/compiler/rustc_codegen_llvm/src/back/archive.rs
+++ b/compiler/rustc_codegen_llvm/src/back/archive.rs
@@ -12,7 +12,9 @@ use std::str;
 use object::read::macho::FatArch;
 
 use crate::common;
-use crate::errors::{ArchiveBuildFailure, ErrorCreatingImportLibrary, ErrorWritingDEFFile};
+use crate::errors::{
+    ArchiveBuildFailure, ErrorCallingDllTool, ErrorCreatingImportLibrary, ErrorWritingDEFFile,
+};
 use crate::llvm::archive_ro::{ArchiveRO, Child};
 use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport};
 use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
@@ -240,7 +242,7 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
 
             match result {
                 Err(e) => {
-                    sess.fatal(&format!("Error calling dlltool: {}", e));
+                    sess.emit_fatal(ErrorCallingDllTool { error: e });
                 }
                 Ok(output) if !output.status.success() => sess.fatal(&format!(
                     "Dlltool could not create import library: {}\n{}",
diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs
index b7962fd0bae..4856cead152 100644
--- a/compiler/rustc_codegen_llvm/src/errors.rs
+++ b/compiler/rustc_codegen_llvm/src/errors.rs
@@ -96,3 +96,9 @@ pub(crate) struct ArchiveBuildFailure {
 pub(crate) struct ErrorWritingDEFFile {
     pub error: std::io::Error,
 }
+
+#[derive(SessionDiagnostic)]
+#[diag(codegen_llvm::error_calling_dlltool)]
+pub(crate) struct ErrorCallingDllTool {
+    pub error: std::io::Error,
+}
diff --git a/compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl b/compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl
index c26c11612cd..3c8a893b4a5 100644
--- a/compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl
@@ -42,3 +42,6 @@ codegen_llvm_archive_build_failure =
 
 codegen_llvm_error_writing_def_file =
     Error writing .DEF file: {$error}
+
+codegen_llvm_error_calling_dlltool =
+    Error calling dlltool: {$error}