fix(fingerprint): explicit reason than "stale; unknown reason"

This was discovered during playing with rmeta reuse
between cargo-check and cargo-build
This commit is contained in:
Weihang Lo 2025-05-31 18:49:44 -04:00
parent 64a1246070
commit c6f5f3fcae
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7

View File

@ -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());
}