ADD - migrate lib.def write fatal error
This diagnostic has no UI test 🤔 Should we add some? If so, how?
This commit is contained in:
parent
b0b072d747
commit
4e0de5319c
@ -1,5 +1,6 @@
|
|||||||
use super::command::Command;
|
use super::command::Command;
|
||||||
use super::symbol_export;
|
use super::symbol_export;
|
||||||
|
use crate::errors::LibDefWriteFailure;
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
|
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
@ -666,7 +667,7 @@ impl<'a> Linker for GccLinker<'a> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
self.sess.fatal(&format!("failed to write lib.def file: {}", e));
|
self.sess.emit_fatal(LibDefWriteFailure { error_description: format!("{e}") });
|
||||||
}
|
}
|
||||||
} else if is_windows {
|
} else if is_windows {
|
||||||
let res: io::Result<()> = try {
|
let res: io::Result<()> = try {
|
||||||
@ -681,7 +682,7 @@ impl<'a> Linker for GccLinker<'a> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
self.sess.fatal(&format!("failed to write list.def file: {}", e));
|
self.sess.emit_fatal(LibDefWriteFailure { error_description: format!("{e}") });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Write an LD version script
|
// Write an LD version script
|
||||||
@ -972,7 +973,7 @@ impl<'a> Linker for MsvcLinker<'a> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
self.sess.fatal(&format!("failed to write lib.def file: {}", e));
|
self.sess.emit_fatal(LibDefWriteFailure { error_description: format!("{e}") });
|
||||||
}
|
}
|
||||||
let mut arg = OsString::from("/DEF:");
|
let mut arg = OsString::from("/DEF:");
|
||||||
arg.push(path);
|
arg.push(path);
|
||||||
|
@ -7,3 +7,9 @@ use rustc_macros::SessionDiagnostic;
|
|||||||
pub struct MissingNativeStaticLibrary<'a> {
|
pub struct MissingNativeStaticLibrary<'a> {
|
||||||
pub library_name: &'a str,
|
pub library_name: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(SessionDiagnostic)]
|
||||||
|
#[diag(codegen_ssa::lib_def_write_failure)]
|
||||||
|
pub struct LibDefWriteFailure {
|
||||||
|
pub error_description: String,
|
||||||
|
}
|
||||||
|
@ -1 +1,3 @@
|
|||||||
codegen_ssa_missing_native_static_library = could not find native static library `{$library_name}`, perhaps an -L flag is missing?
|
codegen_ssa_missing_native_static_library = could not find native static library `{$library_name}`, perhaps an -L flag is missing?
|
||||||
|
|
||||||
|
codegen_ssa_lib_def_write_failure = failed to write lib.def file: {$error_description}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user