Skip to content

Commit

Permalink
refactor: call log_compare in fingerprint compare fn
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Jan 28, 2024
1 parent 91f2010 commit edc6410
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/cargo/core/compiler/fingerprint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,7 @@ pub fn prepare_target(cx: &mut Context<'_, '_>, unit: &Unit, force: bool) -> Car
// information about failed comparisons to aid in debugging.
let fingerprint = calculate(cx, unit)?;
let mtime_on_use = cx.bcx.config.cli_unstable().mtime_on_use;
let compare = compare_old_fingerprint(&loc, &*fingerprint, mtime_on_use);
log_compare(unit, &compare);
let compare = compare_old_fingerprint(unit, &loc, &*fingerprint, mtime_on_use);

// If our comparison failed or reported dirty (e.g., we're going to trigger
// a rebuild of this crate), then we also ensure the source of the crate
Expand Down Expand Up @@ -1752,6 +1751,17 @@ fn target_root(cx: &Context<'_, '_>) -> PathBuf {
/// If dirty, it then restores the detailed information
/// from the fingerprint JSON file, and provides an rich dirty reason.
fn compare_old_fingerprint(
unit: &Unit,
old_hash_path: &Path,
new_fingerprint: &Fingerprint,
mtime_on_use: bool,
) -> CargoResult<Option<DirtyReason>> {
let compare = _compare_old_fingerprint(old_hash_path, new_fingerprint, mtime_on_use);
log_compare(unit, &compare);
compare
}

fn _compare_old_fingerprint(
old_hash_path: &Path,
new_fingerprint: &Fingerprint,
mtime_on_use: bool,
Expand Down

0 comments on commit edc6410

Please sign in to comment.