Skip to content

Commit ddbb650

Browse files
committed
Import ErrorWritingDEFFile
1 parent d32caf9 commit ddbb650

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

compiler/rustc_codegen_llvm/src/back/archive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::str;
1212
use object::read::macho::FatArch;
1313

1414
use crate::common;
15-
use crate::errors::{ErrorCreatingImportLibrary, ArchiveBuildFailure};
15+
use crate::errors::{ArchiveBuildFailure, ErrorCreatingImportLibrary, ErrorWritingDEFFile};
1616
use crate::llvm::archive_ro::{ArchiveRO, Child};
1717
use crate::llvm::{self, ArchiveKind, LLVMMachineType, LLVMRustCOFFShortExport};
1818
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
@@ -218,7 +218,7 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
218218
match std::fs::write(&def_file_path, def_file_content) {
219219
Ok(_) => {}
220220
Err(e) => {
221-
sess.fatal(&format!("Error writing .DEF file: {}", e));
221+
sess.emit_fatal(ErrorWritingDEFFile { error: e });
222222
}
223223
};
224224

compiler/rustc_codegen_llvm/src/errors.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,9 @@ pub(crate) struct SanitizerMemtagRequiresMte;
9090
pub(crate) struct ArchiveBuildFailure {
9191
pub error: std::io::Error,
9292
}
93+
94+
#[derive(SessionDiagnostic)]
95+
#[diag(codegen_llvm::error_writing_def_file)]
96+
pub(crate) struct ErrorWritingDEFFile {
97+
pub error: std::io::Error,
98+
}

compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ codegen_llvm_sanitizer_memtag_requires_mte =
3939
4040
codegen_llvm_archive_build_failure =
4141
failed to build archive: {$error}
42+
43+
codegen_llvm_error_writing_def_file =
44+
Error writing .DEF file: {$error}

0 commit comments

Comments
 (0)