1
Fork 0

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 std::str;
use object::read::macho::FatArch; use object::read::macho::FatArch;
use crate::common; use crate::common;
use crate::errors::ErrorCreatingImportLibrary;
use crate::llvm::archive_ro::{ArchiveRO, Child}; use crate::llvm::archive_ro::{ArchiveRO, Child};
use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport}; use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport};
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder}; use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
@ -293,11 +294,10 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
}; };
if result == crate::llvm::LLVMRustResult::Failure { if result == crate::llvm::LLVMRustResult::Failure {
sess.fatal(&format!( sess.emit_fatal(ErrorCreatingImportLibrary {
"Error creating import library for {}: {}",
lib_name, 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::fluent;
use rustc_errors::DiagnosticBuilder; use rustc_errors::DiagnosticBuilder;
use rustc_macros::SessionDiagnostic;
use rustc_session::SessionDiagnostic; use rustc_session::SessionDiagnostic;
pub(crate) enum UnknownCTargetFeature<'a> { pub(crate) enum UnknownCTargetFeature<'a> {
@ -34,3 +35,10 @@ impl SessionDiagnostic<'_, ()> for UnknownCTargetFeature<'_> {
} }
} }
} }
#[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 = codegen_llvm_unknown_feature_fill_request =
consider filing a feature request consider filing a feature request
codegen_llvm_error_creating_import_library =
Error creating import library for {$lib_name}: {$error}