File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -761,8 +761,9 @@ where
761761 }
762762 } ;
763763
764- // Note that equal mtimes are considered "stale". For filesystems with
765- // not much timestamp precision like 1s this is a conservative approximation
764+ // TODO: fix #5918
765+ // Note that equal mtimes should be considered "stale". For filesystems with
766+ // not much timestamp precision like 1s this is would be a conservative approximation
766767 // to handle the case where a file is modified within the same second after
767768 // a build starts. We want to make sure that incremental rebuilds pick that up!
768769 //
@@ -774,10 +775,11 @@ where
774775 // a file is updated at most 10ms after a build starts then Cargo may not
775776 // pick up the build changes.
776777 //
777- // All in all, the equality check here is a conservative assumption that,
778+ // All in all, an equality check here would be a conservative assumption that,
778779 // if equal, files were changed just after a previous build finished.
779- // It's hoped this doesn't cause too many issues in practice!
780- if mtime2 >= mtime {
780+ // Unfortunately this became problematic when (in #6484) cargo switch to more accurately
781+ // measuring the start time of builds.
782+ if mtime2 > mtime {
781783 info ! ( "stale: {} -- {} vs {}" , path. display( ) , mtime2, mtime) ;
782784 true
783785 } else {
Original file line number Diff line number Diff line change @@ -1283,6 +1283,9 @@ fn bust_patched_dep() {
12831283 . build ( ) ;
12841284
12851285 p. cargo ( "build" ) . run ( ) ;
1286+ if is_coarse_mtime ( ) {
1287+ sleep_ms ( 1000 ) ;
1288+ }
12861289
12871290 File :: create ( & p. root ( ) . join ( "reg1new/src/lib.rs" ) ) . unwrap ( ) ;
12881291 if is_coarse_mtime ( ) {
@@ -1385,6 +1388,7 @@ fn rebuild_on_mid_build_file_modification() {
13851388
13861389 let t = thread:: spawn ( move || {
13871390 let socket = server. accept ( ) . unwrap ( ) . 0 ;
1391+ sleep_ms ( 1000 ) ;
13881392 let mut file = OpenOptions :: new ( )
13891393 . write ( true )
13901394 . append ( true )
Original file line number Diff line number Diff line change @@ -356,6 +356,7 @@ fn deep_dependencies_trigger_rebuild() {
356356 //
357357 // We base recompilation off mtime, so sleep for at least a second to ensure
358358 // that this write will change the mtime.
359+ sleep_ms ( 1000 ) ;
359360 File :: create ( & p. root ( ) . join ( "baz/src/baz.rs" ) )
360361 . unwrap ( )
361362 . write_all ( br#"pub fn baz() { println!("hello!"); }"# )
@@ -372,6 +373,7 @@ fn deep_dependencies_trigger_rebuild() {
372373 . run ( ) ;
373374
374375 // Make sure an update to bar doesn't trigger baz
376+ sleep_ms ( 1000 ) ;
375377 File :: create ( & p. root ( ) . join ( "bar/src/bar.rs" ) )
376378 . unwrap ( )
377379 . write_all (
You can’t perform that action at this time.
0 commit comments