From c6f5f3fcae6facebdacb38c3b94ed85c7cfa6882 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 31 May 2025 18:49:44 -0400 Subject: [PATCH] fix(fingerprint): explicit reason than "stale; unknown reason" This was discovered during playing with rmeta reuse between cargo-check and cargo-build --- src/cargo/core/compiler/fingerprint/mod.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cargo/core/compiler/fingerprint/mod.rs b/src/cargo/core/compiler/fingerprint/mod.rs index 1df368ee0..af7ddf2d2 100644 --- a/src/cargo/core/compiler/fingerprint/mod.rs +++ b/src/cargo/core/compiler/fingerprint/mod.rs @@ -1167,15 +1167,12 @@ impl Fingerprint { // minimum mtime as it's the one we'll be comparing to inputs and // dependencies. for output in self.outputs.iter() { - let mtime = match paths::mtime(output) { - Ok(mtime) => mtime, - + let Ok(mtime) = paths::mtime(output) else { // This path failed to report its `mtime`. It probably doesn't // exists, so leave ourselves as stale and bail out. - Err(e) => { - debug!("failed to get mtime of {:?}: {}", output, e); - return Ok(()); - } + let item = StaleItem::FailedToReadMetadata(output.clone()); + self.fs_status = FsStatus::StaleItem(item); + return Ok(()); }; assert!(mtimes.insert(output.clone(), mtime).is_none()); }