Skip to content

Commit 0a2d7f8

Browse files
committed
UPDATE - LibDefWriteFailure to accept type instead of formatted string
This follows team’s suggestions in this thread https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20diag.20translation/near/295305249
1 parent 4e0de53 commit 0a2d7f8

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,8 @@ impl<'a> Linker for GccLinker<'a> {
666666
writeln!(f, "_{}", sym)?;
667667
}
668668
};
669-
if let Err(e) = res {
670-
self.sess.emit_fatal(LibDefWriteFailure { error_description: format!("{e}") });
669+
if let Err(error) = res {
670+
self.sess.emit_fatal(LibDefWriteFailure { error });
671671
}
672672
} else if is_windows {
673673
let res: io::Result<()> = try {
@@ -681,8 +681,8 @@ impl<'a> Linker for GccLinker<'a> {
681681
writeln!(f, " {}", symbol)?;
682682
}
683683
};
684-
if let Err(e) = res {
685-
self.sess.emit_fatal(LibDefWriteFailure { error_description: format!("{e}") });
684+
if let Err(error) = res {
685+
self.sess.emit_fatal(LibDefWriteFailure { error });
686686
}
687687
} else {
688688
// Write an LD version script
@@ -972,8 +972,8 @@ impl<'a> Linker for MsvcLinker<'a> {
972972
writeln!(f, " {}", symbol)?;
973973
}
974974
};
975-
if let Err(e) = res {
976-
self.sess.emit_fatal(LibDefWriteFailure { error_description: format!("{e}") });
975+
if let Err(error) = res {
976+
self.sess.emit_fatal(LibDefWriteFailure { error });
977977
}
978978
let mut arg = OsString::from("/DEF:");
979979
arg.push(path);

compiler/rustc_codegen_ssa/src/errors.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Errors emitted by codegen_ssa
22
33
use rustc_macros::SessionDiagnostic;
4+
use std::io::Error;
45

56
#[derive(SessionDiagnostic)]
67
#[diag(codegen_ssa::missing_native_static_library)]
@@ -11,5 +12,5 @@ pub struct MissingNativeStaticLibrary<'a> {
1112
#[derive(SessionDiagnostic)]
1213
#[diag(codegen_ssa::lib_def_write_failure)]
1314
pub struct LibDefWriteFailure {
14-
pub error_description: String,
15+
pub error: Error,
1516
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
codegen_ssa_missing_native_static_library = could not find native static library `{$library_name}`, perhaps an -L flag is missing?
22
3-
codegen_ssa_lib_def_write_failure = failed to write lib.def file: {$error_description}
3+
codegen_ssa_lib_def_write_failure = failed to write lib.def file: {$error}

0 commit comments

Comments
 (0)