-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cargo not rebuilding with file changed via move #7982
Comments
Thanks for the report. There's an explanation of this here: #7181 (comment). Using alternate change-detection strategies is tracked in #6529. Additionally, you may want to read up on #2644. There are some sample Docker files in the comments that illustrate using |
I'm not sure this is the case. (Edit: Well, maybe the case with docker, but not with the
The mtime on the original Another Edit: Even with adding a sleep between |
Cargo doesn't keep track of the original mtimes of the files. It compares the mtime of the source files to the output files. In your example you have:
|
Ah, I see, my mistake! At any rate, the |
Problem
I first noticed this when using a "dummy"
main.rs
in a docker build along with myCargo.toml/lock
to cache the dependencies before building the actual code. It seems that when things are updated via a dockerCOPY
or file move, cargo doesn't notice that they're changed and need to be rebuilt.Steps
cargo new
src/main.rs
tosrc/main.rs.whatever
src/main.rs.whatever
to greet someone other than "world"cargo run
- outputs "Hello, world!"mv src/main.rs{.whatever,}
cargo run
- outputs "Hello, world!" again, despitemain.rs
having both a newer mtime and different contents than beforeAttaching a script for quick verification of the above steps. Zipped because github doesn't like scripts.
demo.zip
Output of
cargo version
:Tested on Arch Linux,
rustup show
saysThe text was updated successfully, but these errors were encountered: