@@ -354,7 +354,7 @@ struct DepFingerprint {
354354///
355355/// Note that dependencies are taken into account for fingerprints because rustc
356356/// requires that whenever an upstream crate is recompiled that all downstream
357- /// dependants are also recompiled. This is typically tracked through
357+ /// dependents are also recompiled. This is typically tracked through
358358/// `DependencyQueue`, but it also needs to be retained here because Cargo can
359359/// be interrupted while executing, losing the state of the `DependencyQueue`
360360/// graph.
@@ -504,7 +504,7 @@ enum LocalFingerprint {
504504 CheckDepInfo { dep_info : PathBuf } ,
505505
506506 /// This represents a nonempty set of `rerun-if-changed` annotations printed
507- /// out by a build script. The `output` file is a arelative file anchored at
507+ /// out by a build script. The `output` file is a relative file anchored at
508508 /// `target_root(...)` which is the actual output of the build script. That
509509 /// output has already been parsed and the paths printed out via
510510 /// `rerun-if-changed` are listed in `paths`. The `paths` field is relative
@@ -799,7 +799,8 @@ impl Fingerprint {
799799 assert ! ( mtimes. insert( output. clone( ) , mtime) . is_none( ) ) ;
800800 }
801801
802- let max_mtime = match mtimes. values ( ) . max ( ) {
802+ let opt_max = mtimes. iter ( ) . max_by_key ( |kv| kv. 1 ) ;
803+ let ( max_path, max_mtime) = match opt_max {
803804 Some ( mtime) => mtime,
804805
805806 // We had no output files. This means we're an overridden build
@@ -810,6 +811,10 @@ impl Fingerprint {
810811 return Ok ( ( ) ) ;
811812 }
812813 } ;
814+ debug ! (
815+ "max output mtime for {:?} is {:?} {}" ,
816+ pkg_root, max_path, max_mtime
817+ ) ;
813818
814819 for dep in self . deps . iter ( ) {
815820 let dep_mtimes = match & dep. fingerprint . fs_status {
@@ -850,7 +855,10 @@ impl Fingerprint {
850855 // for a discussion of why it's `>` see the discussion about #5918
851856 // below in `find_stale`.
852857 if dep_mtime > max_mtime {
853- log:: info!( "dependency on `{}` is newer than we are" , dep. name) ;
858+ info ! (
859+ "dependency on `{}` is newer than we are {} > {} {:?}" ,
860+ dep. pkg_id, dep_mtime, max_mtime, pkg_root
861+ ) ;
854862 return Ok ( ( ) ) ;
855863 }
856864 }
@@ -868,6 +876,7 @@ impl Fingerprint {
868876
869877 // Everything was up to date! Record such.
870878 self . fs_status = FsStatus :: UpToDate { mtimes } ;
879+ debug ! ( "filesystem up-to-date {:?}" , pkg_root) ;
871880
872881 Ok ( ( ) )
873882 }
@@ -984,17 +993,17 @@ impl StaleFile {
984993 fn log ( & self ) {
985994 match self {
986995 StaleFile :: Missing ( path) => {
987- log :: info!( "stale: missing {:?}" , path) ;
996+ info ! ( "stale: missing {:?}" , path) ;
988997 }
989998 StaleFile :: Changed {
990999 reference,
9911000 reference_mtime,
9921001 stale,
9931002 stale_mtime,
9941003 } => {
995- log :: info!( "stale: changed {:?}" , stale) ;
996- log :: info!( " (vs) {:?}" , reference) ;
997- log :: info!( " {:?} != {:?}" , reference_mtime, stale_mtime) ;
1004+ info ! ( "stale: changed {:?}" , stale) ;
1005+ info ! ( " (vs) {:?}" , reference) ;
1006+ info ! ( " {:?} != {:?}" , reference_mtime, stale_mtime) ;
9981007 }
9991008 }
10001009 }
@@ -1229,7 +1238,7 @@ fn build_script_local_fingerprints<'a, 'cfg>(
12291238 // First up, if this build script is entirely overridden, then we just
12301239 // return the hash of what we overrode it with. This is the easy case!
12311240 if let Some ( fingerprint) = build_script_override_fingerprint ( cx, unit) {
1232- debug ! ( "override local fingerprints deps" ) ;
1241+ debug ! ( "override local fingerprints deps {}" , unit . pkg ) ;
12331242 return (
12341243 Box :: new (
12351244 move |_: & BuildDeps , _: Option < & dyn Fn ( ) -> CargoResult < String > > | {
@@ -1264,8 +1273,11 @@ fn build_script_local_fingerprints<'a, 'cfg>(
12641273 // (like for a path dependency). Those list of files would
12651274 // be stored here rather than the the mtime of them.
12661275 Some ( f) => {
1267- debug ! ( "old local fingerprints deps" ) ;
12681276 let s = f ( ) ?;
1277+ debug ! (
1278+ "old local fingerprints deps {:?} precalculated={:?}" ,
1279+ pkg_root, s
1280+ ) ;
12691281 return Ok ( Some ( vec ! [ LocalFingerprint :: Precalculated ( s) ] ) ) ;
12701282 }
12711283 None => return Ok ( None ) ,
@@ -1309,7 +1321,7 @@ fn local_fingerprints_deps(
13091321 target_root : & Path ,
13101322 pkg_root : & Path ,
13111323) -> Vec < LocalFingerprint > {
1312- debug ! ( "new local fingerprints deps" ) ;
1324+ debug ! ( "new local fingerprints deps {:?}" , pkg_root ) ;
13131325 let mut local = Vec :: new ( ) ;
13141326
13151327 if !deps. rerun_if_changed . is_empty ( ) {
@@ -1520,6 +1532,10 @@ where
15201532 } ) ;
15211533 }
15221534
1535+ debug ! (
1536+ "all paths up-to-date relative to {:?} mtime={}" ,
1537+ reference, reference_mtime
1538+ ) ;
15231539 None
15241540}
15251541
0 commit comments