Report I/O errors with emit_fatal not emit_err
This commit is contained in:
parent
3cdd004e55
commit
94c43ccd87
@ -55,18 +55,12 @@ where
|
|||||||
debug!("save: remove old file");
|
debug!("save: remove old file");
|
||||||
}
|
}
|
||||||
Err(err) if err.kind() == io::ErrorKind::NotFound => (),
|
Err(err) if err.kind() == io::ErrorKind::NotFound => (),
|
||||||
Err(err) => {
|
Err(err) => sess.dcx().emit_fatal(errors::DeleteOld { name, path: path_buf, err }),
|
||||||
sess.dcx().emit_err(errors::DeleteOld { name, path: path_buf, err });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut encoder = match FileEncoder::new(&path_buf) {
|
let mut encoder = match FileEncoder::new(&path_buf) {
|
||||||
Ok(encoder) => encoder,
|
Ok(encoder) => encoder,
|
||||||
Err(err) => {
|
Err(err) => sess.dcx().emit_fatal(errors::CreateNew { name, path: path_buf, err }),
|
||||||
sess.dcx().emit_err(errors::CreateNew { name, path: path_buf, err });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
write_file_header(&mut encoder, sess);
|
write_file_header(&mut encoder, sess);
|
||||||
@ -80,9 +74,7 @@ where
|
|||||||
);
|
);
|
||||||
debug!("save: data written to disk successfully");
|
debug!("save: data written to disk successfully");
|
||||||
}
|
}
|
||||||
Err((path, err)) => {
|
Err((path, err)) => sess.dcx().emit_fatal(errors::WriteNew { name, path, err }),
|
||||||
sess.dcx().emit_err(errors::WriteNew { name, path, err });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ impl Compiler {
|
|||||||
// the global context.
|
// the global context.
|
||||||
_timer = Some(self.sess.timer("free_global_ctxt"));
|
_timer = Some(self.sess.timer("free_global_ctxt"));
|
||||||
if let Err((path, error)) = queries.finish() {
|
if let Err((path, error)) = queries.finish() {
|
||||||
self.sess.dcx().emit_err(errors::FailedWritingFile { path: &path, error });
|
self.sess.dcx().emit_fatal(errors::FailedWritingFile { path: &path, error });
|
||||||
}
|
}
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -2241,12 +2241,12 @@ pub fn encode_metadata(tcx: TyCtxt<'_>, path: &Path) {
|
|||||||
// If we forget this, compilation can succeed with an incomplete rmeta file,
|
// If we forget this, compilation can succeed with an incomplete rmeta file,
|
||||||
// causing an ICE when the rmeta file is read by another compilation.
|
// causing an ICE when the rmeta file is read by another compilation.
|
||||||
if let Err((path, err)) = ecx.opaque.finish() {
|
if let Err((path, err)) = ecx.opaque.finish() {
|
||||||
tcx.dcx().emit_err(FailWriteFile { path: &path, err });
|
tcx.dcx().emit_fatal(FailWriteFile { path: &path, err });
|
||||||
}
|
}
|
||||||
|
|
||||||
let file = ecx.opaque.file();
|
let file = ecx.opaque.file();
|
||||||
if let Err(err) = encode_root_position(file, root.position.get()) {
|
if let Err(err) = encode_root_position(file, root.position.get()) {
|
||||||
tcx.dcx().emit_err(FailWriteFile { path: ecx.opaque.path(), err });
|
tcx.dcx().emit_fatal(FailWriteFile { path: ecx.opaque.path(), err });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record metadata size for self-profiling
|
// Record metadata size for self-profiling
|
||||||
|
Loading…
x
Reference in New Issue
Block a user