diff options
| author | SLASHLogin <loginmlgxd@gmail.com> | 2022-08-26 19:42:29 +0200 |
|---|---|---|
| committer | SLASHLogin <loginmlgxd@gmail.com> | 2022-11-09 14:56:21 +0100 |
| commit | 33ef16f291b6a43dc57dcb8915bdb4aa736a7936 (patch) | |
| tree | 16157ff5b37db9d6a6b709b8f88391e69abb683e /compiler/rustc_codegen_llvm/src | |
| parent | c01546fcd64f703cd6a406752621d0e18ccb6a5a (diff) | |
| download | rust-33ef16f291b6a43dc57dcb8915bdb4aa736a7936.tar.gz rust-33ef16f291b6a43dc57dcb8915bdb4aa736a7936.zip | |
Port `UnknownArchiveKind`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/archive.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/errors.rs | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs index 9be104fde6c..99c9b51a9cd 100644 --- a/compiler/rustc_codegen_llvm/src/back/archive.rs +++ b/compiler/rustc_codegen_llvm/src/back/archive.rs @@ -14,7 +14,7 @@ use object::read::macho::FatArch; use crate::common; use crate::errors::{ ArchiveBuildFailure, DlltoolFailImportLibrary, ErrorCallingDllTool, ErrorCreatingImportLibrary, - ErrorWritingDEFFile, + ErrorWritingDEFFile, UnknownArchiveKind, }; use crate::llvm::archive_ro::{ArchiveRO, Child}; use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport}; @@ -312,9 +312,10 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder { impl<'a> LlvmArchiveBuilder<'a> { fn build_with_llvm(&mut self, output: &Path) -> io::Result<bool> { let kind = &*self.sess.target.archive_format; - let kind = kind.parse::<ArchiveKind>().map_err(|_| kind).unwrap_or_else(|kind| { - self.sess.fatal(&format!("Don't know how to build archive of type: {}", kind)) - }); + let kind = kind + .parse::<ArchiveKind>() + .map_err(|_| kind) + .unwrap_or_else(|kind| self.sess.emit_fatal(UnknownArchiveKind { kind: kind })); let mut additions = mem::take(&mut self.additions); let mut strings = Vec::new(); diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index 68c2e692830..1fe88cc2482 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -111,3 +111,9 @@ pub(crate) struct DlltoolFailImportLibrary<'a> { pub stdout: Cow<'a, str>, pub stderr: Cow<'a, str>, } + +#[derive(SessionDiagnostic)] +#[diag(codegen_llvm::unknown_archive_kind)] +pub(crate) struct UnknownArchiveKind<'a> { + pub kind: &'a str, +} |
