Import error creating import library

This commit is contained in:
SLASHLogin 2022-08-25 21:01:36 +02:00
parent 69d412a073
commit 05ae7ecb74
3 changed files with 15 additions and 4 deletions

View 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()),
});
}
};

View 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,
}

View 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}