From a365287e10c1bbdc2cb5ba33ce71b7a1d56d79f6 Mon Sep 17 00:00:00 2001 From: Markus Westerlind Date: Tue, 26 Mar 2019 23:45:40 +0100 Subject: [PATCH] fix: Make incremental artifact deletion more robust Should fix the intermittent errors reported in #57958 cc #48614 --- src/librustc_incremental/persist/fs.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs index 7dcd5c94bf298..7f697b5448464 100644 --- a/src/librustc_incremental/persist/fs.rs +++ b/src/librustc_incremental/persist/fs.rs @@ -886,7 +886,10 @@ fn safe_remove_dir_all(p: &Path) -> io::Result<()> { fn safe_remove_file(p: &Path) -> io::Result<()> { if p.exists() { let canonicalized = p.canonicalize()?; - std_fs::remove_file(canonicalized) + match std_fs::remove_file(canonicalized) { + Err(ref err) if err.kind() == io::ErrorKind::NotFound => Ok(()), + result => result, + } } else { Ok(()) }