Skip to content

Commit 120ad80

Browse files
authored
fix(fingerprint): explicit reason rather than "stale; unknown reason" (#15617)
### What does this PR try to resolve? This was discovered during playing with rmeta reuse between cargo-check and cargo-build. An rmeta mtime failure is basically the same as "failed to read metadata". While we don't report in tracing log, that should be fine because dirty reason will be reported in the other place. ### How to test and review this PR? Should have no real user-facing behavior change.
2 parents d794004 + c6f5f3f commit 120ad80

File tree

1 file changed

+4
-7
lines changed
  • src/cargo/core/compiler/fingerprint

1 file changed

+4
-7
lines changed

src/cargo/core/compiler/fingerprint/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,15 +1167,12 @@ impl Fingerprint {
11671167
// minimum mtime as it's the one we'll be comparing to inputs and
11681168
// dependencies.
11691169
for output in self.outputs.iter() {
1170-
let mtime = match paths::mtime(output) {
1171-
Ok(mtime) => mtime,
1172-
1170+
let Ok(mtime) = paths::mtime(output) else {
11731171
// This path failed to report its `mtime`. It probably doesn't
11741172
// exists, so leave ourselves as stale and bail out.
1175-
Err(e) => {
1176-
debug!("failed to get mtime of {:?}: {}", output, e);
1177-
return Ok(());
1178-
}
1173+
let item = StaleItem::FailedToReadMetadata(output.clone());
1174+
self.fs_status = FsStatus::StaleItem(item);
1175+
return Ok(());
11791176
};
11801177
assert!(mtimes.insert(output.clone(), mtime).is_none());
11811178
}

0 commit comments

Comments
 (0)