File tree 3 files changed +13
-5
lines changed
3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -761,8 +761,9 @@ where
761
761
}
762
762
} ;
763
763
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
766
767
// to handle the case where a file is modified within the same second after
767
768
// a build starts. We want to make sure that incremental rebuilds pick that up!
768
769
//
@@ -774,10 +775,11 @@ where
774
775
// a file is updated at most 10ms after a build starts then Cargo may not
775
776
// pick up the build changes.
776
777
//
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,
778
779
// 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 {
781
783
info ! ( "stale: {} -- {} vs {}" , path. display( ) , mtime2, mtime) ;
782
784
true
783
785
} else {
Original file line number Diff line number Diff line change @@ -1283,6 +1283,9 @@ fn bust_patched_dep() {
1283
1283
. build ( ) ;
1284
1284
1285
1285
p. cargo ( "build" ) . run ( ) ;
1286
+ if is_coarse_mtime ( ) {
1287
+ sleep_ms ( 1000 ) ;
1288
+ }
1286
1289
1287
1290
File :: create ( & p. root ( ) . join ( "reg1new/src/lib.rs" ) ) . unwrap ( ) ;
1288
1291
if is_coarse_mtime ( ) {
@@ -1385,6 +1388,7 @@ fn rebuild_on_mid_build_file_modification() {
1385
1388
1386
1389
let t = thread:: spawn ( move || {
1387
1390
let socket = server. accept ( ) . unwrap ( ) . 0 ;
1391
+ sleep_ms ( 1000 ) ;
1388
1392
let mut file = OpenOptions :: new ( )
1389
1393
. write ( true )
1390
1394
. append ( true )
Original file line number Diff line number Diff line change @@ -356,6 +356,7 @@ fn deep_dependencies_trigger_rebuild() {
356
356
//
357
357
// We base recompilation off mtime, so sleep for at least a second to ensure
358
358
// that this write will change the mtime.
359
+ sleep_ms ( 1000 ) ;
359
360
File :: create ( & p. root ( ) . join ( "baz/src/baz.rs" ) )
360
361
. unwrap ( )
361
362
. write_all ( br#"pub fn baz() { println!("hello!"); }"# )
@@ -372,6 +373,7 @@ fn deep_dependencies_trigger_rebuild() {
372
373
. run ( ) ;
373
374
374
375
// Make sure an update to bar doesn't trigger baz
376
+ sleep_ms ( 1000 ) ;
375
377
File :: create ( & p. root ( ) . join ( "bar/src/bar.rs" ) )
376
378
. unwrap ( )
377
379
. write_all (
You can’t perform that action at this time.
0 commit comments