Skip to content

Commit d844f17

Browse files
committed
Report I/O errors with emit_fatal not emit_err
1 parent 3cdd004 commit d844f17

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

compiler/rustc_incremental/src/persist/file_format.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,14 @@ where
5656
}
5757
Err(err) if err.kind() == io::ErrorKind::NotFound => (),
5858
Err(err) => {
59-
sess.dcx().emit_err(errors::DeleteOld { name, path: path_buf, err });
60-
return;
59+
sess.dcx().emit_fatal(errors::DeleteOld { name, path: path_buf, err });
6160
}
6261
}
6362

6463
let mut encoder = match FileEncoder::new(&path_buf) {
6564
Ok(encoder) => encoder,
6665
Err(err) => {
67-
sess.dcx().emit_err(errors::CreateNew { name, path: path_buf, err });
68-
return;
66+
sess.dcx().emit_fatal(errors::CreateNew { name, path: path_buf, err });
6967
}
7068
};
7169

@@ -81,7 +79,7 @@ where
8179
debug!("save: data written to disk successfully");
8280
}
8381
Err((path, err)) => {
84-
sess.dcx().emit_err(errors::WriteNew { name, path, err });
82+
sess.dcx().emit_fatal(errors::WriteNew { name, path, err });
8583
}
8684
}
8785
}

compiler/rustc_interface/src/queries.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl Compiler {
332332
// the global context.
333333
_timer = Some(self.sess.timer("free_global_ctxt"));
334334
if let Err((path, error)) = queries.finish() {
335-
self.sess.dcx().emit_err(errors::FailedWritingFile { path: &path, error });
335+
self.sess.dcx().emit_fatal(errors::FailedWritingFile { path: &path, error });
336336
}
337337

338338
ret

compiler/rustc_metadata/src/rmeta/encoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2241,12 +2241,12 @@ pub fn encode_metadata(tcx: TyCtxt<'_>, path: &Path) {
22412241
// If we forget this, compilation can succeed with an incomplete rmeta file,
22422242
// causing an ICE when the rmeta file is read by another compilation.
22432243
if let Err((path, err)) = ecx.opaque.finish() {
2244-
tcx.dcx().emit_err(FailWriteFile { path: &path, err });
2244+
tcx.dcx().emit_fatal(FailWriteFile { path: &path, err });
22452245
}
22462246

22472247
let file = ecx.opaque.file();
22482248
if let Err(err) = encode_root_position(file, root.position.get()) {
2249-
tcx.dcx().emit_err(FailWriteFile { path: ecx.opaque.path(), err });
2249+
tcx.dcx().emit_fatal(FailWriteFile { path: ecx.opaque.path(), err });
22502250
}
22512251

22522252
// Record metadata size for self-profiling

0 commit comments

Comments
 (0)