]> git.lizzy.rs Git - rust.git/commitdiff
Import `error creating import library`
authorSLASHLogin <loginmlgxd@gmail.com>
Thu, 25 Aug 2022 19:01:36 +0000 (21:01 +0200)
committerSLASHLogin <loginmlgxd@gmail.com>
Wed, 9 Nov 2022 13:56:20 +0000 (14:56 +0100)
compiler/rustc_codegen_llvm/src/back/archive.rs
compiler/rustc_codegen_llvm/src/errors.rs
compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl

index 082665bba3802cc33f56d1ebbc1885964ee2af43..4fd8b0ef4bb706f4dbd76d4901a4bbe3600510a3 100644 (file)
@@ -12,6 +12,7 @@
 use object::read::macho::FatArch;
 
 use crate::common;
+use crate::errors::ErrorCreatingImportLibrary;
 use crate::llvm::archive_ro::{ArchiveRO, Child};
 use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport};
 use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
@@ -293,11 +294,10 @@ fn create_dll_import_lib(
             };
 
             if result == crate::llvm::LLVMRustResult::Failure {
-                sess.fatal(&format!(
-                    "Error creating import library for {}: {}",
+                sess.emit_fatal(ErrorCreatingImportLibrary {
                     lib_name,
-                    llvm::last_error().unwrap_or("unknown LLVM error".to_string())
-                ));
+                    error: llvm::last_error().unwrap_or("unknown LLVM error".to_string()),
+                });
             }
         };
 
index a2b88c4af11cee83ba5ff5a4fcf99483e1a2dd91..03e55c72e222e7e76f1c596f597e093430ae275a 100644 (file)
@@ -1,5 +1,6 @@
 use rustc_errors::fluent;
 use rustc_errors::DiagnosticBuilder;
+use rustc_macros::SessionDiagnostic;
 use rustc_session::SessionDiagnostic;
 
 pub(crate) enum UnknownCTargetFeature<'a> {
@@ -34,3 +35,10 @@ fn into_diagnostic(
         }
     }
 }
+
+#[derive(SessionDiagnostic)]
+#[diag(codegen_llvm::error_creating_import_library)]
+pub(crate) struct ErrorCreatingImportLibrary<'a> {
+    pub lib_name: &'a str,
+    pub error: String,
+}
index 33abf6ce5cfc88778ff5e03b26d3d51f01485352..bfd3d5f033a86133c87ddc9a4996fdcd183a5a16 100644 (file)
@@ -12,3 +12,6 @@ codegen_llvm_rust_feature =
 
 codegen_llvm_unknown_feature_fill_request =
     consider filing a feature request
+
+codegen_llvm_error_creating_import_library =
+    Error creating import library for {$lib_name}: {$error}