@@ -322,7 +322,7 @@ use std::sync::{Arc, Mutex};
322
322
use std:: time:: SystemTime ;
323
323
324
324
use anyhow:: { bail, format_err, Context as _} ;
325
- use cargo_util:: { paths, ProcessBuilder } ;
325
+ use cargo_util:: { hash_u64 , paths, to_hex , ProcessBuilder , StableHasher } ;
326
326
use filetime:: FileTime ;
327
327
use log:: { debug, info} ;
328
328
use serde:: de;
@@ -331,10 +331,9 @@ use serde::{Deserialize, Serialize};
331
331
332
332
use crate :: core:: compiler:: unit_graph:: UnitDep ;
333
333
use crate :: core:: Package ;
334
- use crate :: util;
335
334
use crate :: util:: errors:: CargoResult ;
336
335
use crate :: util:: interning:: InternedString ;
337
- use crate :: util:: { internal, path_args, profile, StableHasher } ;
336
+ use crate :: util:: { internal, path_args, profile} ;
338
337
use crate :: CARGO_ENV ;
339
338
340
339
use super :: custom_build:: BuildDeps ;
@@ -812,7 +811,7 @@ impl Fingerprint {
812
811
if let Some ( s) = * self . memoized_hash . lock ( ) . unwrap ( ) {
813
812
return s;
814
813
}
815
- let ret = util :: hash_u64 ( self ) ;
814
+ let ret = hash_u64 ( self ) ;
816
815
* self . memoized_hash . lock ( ) . unwrap ( ) = Some ( ret) ;
817
816
ret
818
817
}
@@ -1160,9 +1159,9 @@ impl DepFingerprint {
1160
1159
// `path` then we just hash the name, but otherwise we hash the full
1161
1160
// id as it won't change when the directory is renamed.
1162
1161
let pkg_id = if dep. unit . pkg . package_id ( ) . source_id ( ) . is_path ( ) {
1163
- util :: hash_u64 ( dep. unit . pkg . package_id ( ) . name ( ) )
1162
+ hash_u64 ( dep. unit . pkg . package_id ( ) . name ( ) )
1164
1163
} else {
1165
- util :: hash_u64 ( dep. unit . pkg . package_id ( ) )
1164
+ hash_u64 ( dep. unit . pkg . package_id ( ) )
1166
1165
} ;
1167
1166
1168
1167
Ok ( DepFingerprint {
@@ -1309,15 +1308,15 @@ fn calculate_normal(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Finger
1309
1308
}
1310
1309
. to_vec ( ) ;
1311
1310
1312
- let profile_hash = util :: hash_u64 ( (
1311
+ let profile_hash = hash_u64 ( (
1313
1312
& unit. profile ,
1314
1313
unit. mode ,
1315
1314
cx. bcx . extra_args_for ( unit) ,
1316
1315
cx. lto [ unit] ,
1317
1316
) ) ;
1318
1317
// Include metadata since it is exposed as environment variables.
1319
1318
let m = unit. pkg . manifest ( ) . metadata ( ) ;
1320
- let metadata = util :: hash_u64 ( ( & m. authors , & m. description , & m. homepage , & m. repository ) ) ;
1319
+ let metadata = hash_u64 ( ( & m. authors , & m. description , & m. homepage , & m. repository ) ) ;
1321
1320
let mut config = StableHasher :: new ( ) ;
1322
1321
if let Some ( linker) = cx. bcx . linker ( unit. kind ) {
1323
1322
linker. hash ( & mut config) ;
@@ -1332,12 +1331,12 @@ fn calculate_normal(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Finger
1332
1331
}
1333
1332
let compile_kind = unit. kind . fingerprint_hash ( ) ;
1334
1333
Ok ( Fingerprint {
1335
- rustc : util :: hash_u64 ( & cx. bcx . rustc ( ) . verbose_version ) ,
1336
- target : util :: hash_u64 ( & unit. target ) ,
1334
+ rustc : hash_u64 ( & cx. bcx . rustc ( ) . verbose_version ) ,
1335
+ target : hash_u64 ( & unit. target ) ,
1337
1336
profile : profile_hash,
1338
1337
// Note that .0 is hashed here, not .1 which is the cwd. That doesn't
1339
1338
// actually affect the output artifact so there's no need to hash it.
1340
- path : util :: hash_u64 ( path_args ( cx. bcx . ws , unit) . 0 ) ,
1339
+ path : hash_u64 ( path_args ( cx. bcx . ws , unit) . 0 ) ,
1341
1340
features : format ! ( "{:?}" , unit. features) ,
1342
1341
deps,
1343
1342
local : Mutex :: new ( local) ,
@@ -1402,7 +1401,7 @@ See https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-change
1402
1401
1403
1402
Ok ( Fingerprint {
1404
1403
local : Mutex :: new ( local) ,
1405
- rustc : util :: hash_u64 ( & cx. bcx . rustc ( ) . verbose_version ) ,
1404
+ rustc : hash_u64 ( & cx. bcx . rustc ( ) . verbose_version ) ,
1406
1405
deps,
1407
1406
outputs : if overridden { Vec :: new ( ) } else { vec ! [ output] } ,
1408
1407
@@ -1532,10 +1531,7 @@ fn build_script_override_fingerprint(
1532
1531
let metadata = cx. get_run_build_script_metadata ( unit) ;
1533
1532
// Returns None if it is not overridden.
1534
1533
let output = build_script_outputs. get ( metadata) ?;
1535
- let s = format ! (
1536
- "overridden build state with hash: {}" ,
1537
- util:: hash_u64( output)
1538
- ) ;
1534
+ let s = format ! ( "overridden build state with hash: {}" , hash_u64( output) ) ;
1539
1535
Some ( LocalFingerprint :: Precalculated ( s) )
1540
1536
}
1541
1537
@@ -1586,7 +1582,7 @@ fn write_fingerprint(loc: &Path, fingerprint: &Fingerprint) -> CargoResult<()> {
1586
1582
// as we can use the full hash.
1587
1583
let hash = fingerprint. hash_u64 ( ) ;
1588
1584
debug ! ( "write fingerprint ({:x}) : {}" , hash, loc. display( ) ) ;
1589
- paths:: write ( loc, util :: to_hex ( hash) . as_bytes ( ) ) ?;
1585
+ paths:: write ( loc, to_hex ( hash) . as_bytes ( ) ) ?;
1590
1586
1591
1587
let json = serde_json:: to_string ( fingerprint) . unwrap ( ) ;
1592
1588
if cfg ! ( debug_assertions) {
@@ -1637,7 +1633,7 @@ fn compare_old_fingerprint(
1637
1633
1638
1634
let new_hash = new_fingerprint. hash_u64 ( ) ;
1639
1635
1640
- if util :: to_hex ( new_hash) == old_fingerprint_short && new_fingerprint. fs_status . up_to_date ( ) {
1636
+ if to_hex ( new_hash) == old_fingerprint_short && new_fingerprint. fs_status . up_to_date ( ) {
1641
1637
return Ok ( ( ) ) ;
1642
1638
}
1643
1639
@@ -1646,10 +1642,7 @@ fn compare_old_fingerprint(
1646
1642
. with_context ( || internal ( "failed to deserialize json" ) ) ?;
1647
1643
// Fingerprint can be empty after a failed rebuild (see comment in prepare_target).
1648
1644
if !old_fingerprint_short. is_empty ( ) {
1649
- debug_assert_eq ! (
1650
- util:: to_hex( old_fingerprint. hash_u64( ) ) ,
1651
- old_fingerprint_short
1652
- ) ;
1645
+ debug_assert_eq ! ( to_hex( old_fingerprint. hash_u64( ) ) , old_fingerprint_short) ;
1653
1646
}
1654
1647
let result = new_fingerprint. compare ( & old_fingerprint) ;
1655
1648
assert ! ( result. is_err( ) ) ;
0 commit comments