From bb8d4307eb723850e98bcb52d71d860a4aba220a Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 22 Jan 2022 18:49:12 -0600 Subject: rustc_error: make ErrorReported impossible to construct There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name. --- compiler/rustc_incremental/src/persist/fs.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'compiler/rustc_incremental/src') diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index ed7ec51d629..b13f0b0d3da 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -225,12 +225,12 @@ pub fn prepare_session_directory( let crate_dir = match crate_dir.canonicalize() { Ok(v) => v, Err(err) => { - sess.err(&format!( + let reported = sess.err(&format!( "incremental compilation: error canonicalizing path `{}`: {}", crate_dir.display(), err )); - return Err(ErrorGuaranteed); + return Err(reported); } }; @@ -489,14 +489,14 @@ fn create_dir(sess: &Session, path: &Path, dir_tag: &str) -> Result<(), ErrorGua Ok(()) } Err(err) => { - sess.err(&format!( + let reported = sess.err(&format!( "Could not create incremental compilation {} \ directory `{}`: {}", dir_tag, path.display(), err )); - Err(ErrorGuaranteed) + Err(reported) } } } @@ -545,8 +545,7 @@ fn lock_directory( ); } } - err.emit(); - Err(ErrorGuaranteed) + Err(err.emit()) } } } -- cgit 1.4.1-3-g733a5