cargo: Cargo occasionally fails to detect changed source code files

Normally when I run cargo build, test, etc then any changes I’ve made to the code are picked up as expected & it re-compiles those parts of the binary.

Occasionally it does not do so, and I need to run cargo clean, then recompile to have my changes recognised.

This seems very similar to #2426 and would probably be solved by #6529

Meta

rustc --version --verbose:

$ rustc --version --verbose
rustc 1.42.0 (b8cedc004 2020-03-09)
binary: rustc
commit-hash: b8cedc00407a4c56a3bda1ed605c6fc166655447
commit-date: 2020-03-09
host: x86_64-unknown-linux-gnu
release: 1.42.0
LLVM version: 9.0

Checking whether it happens in nightly isn’t currently possible as it’s an intermittent issue. I will have to remember to check the next time the issue appears.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

If you are syncing with rsync, you have to be very careful with filesystem mtimes (such as dealing with the preserve-times feature). The two machines should have their time synced. Additionally, you should avoid this pattern:

  1. rsync -a
  2. Modify source file
  3. Build on server (from step 1)
  4. rsync -a
  5. Build on server (will not detect updates because build output from step 3 is newer than the changed source files from step 2).