From 64e8aea9ce6f40083445d9c161d233499ee559cd Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Fri, 18 Aug 2023 19:20:28 +0200 Subject: [PATCH] Ignore unexpected incr-comp session dirs Clearly the code path can be hit without the presence of a compiler bug. All it takes is mischief. See 71698. Ignore problematic directories instead of ICE:ing. `continue`ing is already done for problematic dirs in the code block above us. --- compiler/rustc_incremental/src/persist/fs.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index 6b894c3a69d8..db8ea2bfe48a 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -538,9 +538,13 @@ where continue; } - let timestamp = extract_timestamp_from_session_dir(&directory_name).unwrap_or_else(|e| { - bug!("unexpected incr-comp session dir: {}: {}", session_dir.display(), e) - }); + let timestamp = match extract_timestamp_from_session_dir(&directory_name) { + Ok(timestamp) => timestamp, + Err(e) => { + debug!("unexpected incr-comp session dir: {}: {}", session_dir.display(), e); + continue; + } + }; if timestamp > best_candidate.0 { best_candidate = (timestamp, Some(session_dir.clone()));