diff options
| author | Martin Nordholts <enselic@gmail.com> | 2023-08-18 19:20:28 +0200 |
|---|---|---|
| committer | Martin Nordholts <enselic@gmail.com> | 2023-08-18 19:57:41 +0200 |
| commit | df8aed400b9e496062f865f4991af7606c6c1e87 (patch) | |
| tree | a54ae6f40c678dcfe69d74be4985274e0fd55519 /compiler/rustc_incremental | |
| parent | c94cb834d05888ef5beeae2cc460156f435e2fb3 (diff) | |
| download | rust-df8aed400b9e496062f865f4991af7606c6c1e87.tar.gz rust-df8aed400b9e496062f865f4991af7606c6c1e87.zip | |
More error details upon unexpected incr-comp session dir
Diffstat (limited to 'compiler/rustc_incremental')
| -rw-r--r-- | compiler/rustc_incremental/src/persist/fs.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index 1111a1a17e2..6b894c3a69d 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -538,8 +538,8 @@ where continue; } - let timestamp = extract_timestamp_from_session_dir(&directory_name).unwrap_or_else(|_| { - bug!("unexpected incr-comp session dir: {}", session_dir.display()) + let timestamp = extract_timestamp_from_session_dir(&directory_name).unwrap_or_else(|e| { + bug!("unexpected incr-comp session dir: {}: {}", session_dir.display(), e) }); if timestamp > best_candidate.0 { @@ -562,14 +562,14 @@ fn is_session_directory_lock_file(file_name: &str) -> bool { file_name.starts_with("s-") && file_name.ends_with(LOCK_FILE_EXT) } -fn extract_timestamp_from_session_dir(directory_name: &str) -> Result<SystemTime, ()> { +fn extract_timestamp_from_session_dir(directory_name: &str) -> Result<SystemTime, &'static str> { if !is_session_directory(directory_name) { - return Err(()); + return Err("not a directory"); } let dash_indices: Vec<_> = directory_name.match_indices('-').map(|(idx, _)| idx).collect(); if dash_indices.len() != 3 { - return Err(()); + return Err("not three dashes in name"); } string_to_timestamp(&directory_name[dash_indices[0] + 1..dash_indices[1]]) @@ -581,11 +581,11 @@ fn timestamp_to_string(timestamp: SystemTime) -> String { base_n::encode(micros as u128, INT_ENCODE_BASE) } -fn string_to_timestamp(s: &str) -> Result<SystemTime, ()> { +fn string_to_timestamp(s: &str) -> Result<SystemTime, &'static str> { let micros_since_unix_epoch = u64::from_str_radix(s, INT_ENCODE_BASE as u32); if micros_since_unix_epoch.is_err() { - return Err(()); + return Err("timestamp not an int"); } let micros_since_unix_epoch = micros_since_unix_epoch.unwrap(); |
