mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Use std::io::Error and remove useless to_string
This commit is contained in:
parent
e7ded9246c
commit
1c575c5fe0
@ -586,12 +586,12 @@ pub fn try_process_rlink(sess: &Session, compiler: &interface::Compiler) -> Comp
|
||||
sess.init_crate_types(collect_crate_types(sess, &[]));
|
||||
let outputs = compiler.build_output_filenames(sess, &[]);
|
||||
let rlink_data = fs::read(file).unwrap_or_else(|err| {
|
||||
sess.emit_fatal(RlinkUnableToRead { error_message: err.to_string() });
|
||||
sess.emit_fatal(RlinkUnableToRead { err });
|
||||
});
|
||||
let codegen_results = match CodegenResults::deserialize_rlink(rlink_data) {
|
||||
Ok(codegen) => codegen,
|
||||
Err(error) => {
|
||||
sess.emit_fatal(RlinkUnableToDeserialize { error_message: error.to_string() });
|
||||
Err(error_message) => {
|
||||
sess.emit_fatal(RlinkUnableToDeserialize { error_message });
|
||||
}
|
||||
};
|
||||
let result = compiler.codegen_backend().link(sess, codegen_results, &outputs);
|
||||
|
@ -3,7 +3,7 @@ use rustc_macros::SessionDiagnostic;
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[diag(driver::rlink_unable_to_read)]
|
||||
pub(crate) struct RlinkUnableToRead {
|
||||
pub error_message: String,
|
||||
pub err: std::io::Error,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
@ -14,4 +14,4 @@ pub(crate) struct RlinkUnableToDeserialize {
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[diag(driver::rlink_no_a_file)]
|
||||
pub(crate) struct RlinkNotAFile {}
|
||||
pub(crate) struct RlinkNotAFile;
|
||||
|
@ -1,4 +1,4 @@
|
||||
driver_rlink_unable_to_read = failed to read rlink file: `{$error_message}`
|
||||
driver_rlink_unable_to_read = failed to read rlink file: `{$err}`
|
||||
|
||||
driver_rlink_unable_to_deserialize = could not deserialize .rlink file: `{$error_message}`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user