Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more metadata to rustc_fingerprint #14761

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/cargo/util/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::sync::Mutex;

use anyhow::Context as _;
use cargo_util::{paths, ProcessBuilder, ProcessError};
use filetime::FileTime;
use serde::{Deserialize, Serialize};
use tracing::{debug, info, warn};

Expand Down Expand Up @@ -329,7 +330,13 @@ fn rustc_fingerprint(
let path = paths::resolve_executable(path)?;
path.hash(hasher);

paths::mtime(&path)?.hash(hasher);
let meta = paths::metadata(&path)?;
meta.len().hash(hasher);

// Often created and modified are the same, but not all filesystems support the former,
// and distro reproducible builds may clamp the latter, so we try to use both.
FileTime::from_creation_time(&meta).hash(hasher);
FileTime::from_last_modification_time(&meta).hash(hasher);
Ok(())
};

Expand Down