-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
If I move files around the src
directory, Cargo will think the directory is still fresh and won't compile on the next cargo build
.
I see this as a problem for two reasons:
- Ergonomics: I'd like to immediately build to see what files need to be changed after the move.
- Possibility for errors: If I'm not paying attention, I might think everything's okay, when in fact my program doesn't compile.
Here are the exact steps to reproduce. First, create a project:
$ cargo -V
cargo-nightly 0.1.0-pre (f720684 2014-07-26 04:21:30 +0000)
$ cargo new cargo-bug
$ cd cargo-bug/
Add a new module and build the project:
$ touch src/a.rs
$ echo "mod a;" > src/lib.rs
$ cargo build
Compiling cargo-bug v0.0.1 (file:/home/hanno/Desktop/Stuff/tmp/cargo-bug)
Move the file and attempt to rebuild:
$ mv src/a.rs src/b.rs
$ cargo build
Fresh cargo-bug v0.0.1 (file:/home/hanno/Desktop/Stuff/tmp/cargo-bug)
I get a green build, when in fact I expect to see this:
$ cargo build
Compiling cargo-bug v0.0.1 (file:/home/hanno/Desktop/Stuff/tmp/cargo-bug)
/home/hanno/Desktop/Stuff/tmp/cargo-bug/src/lib.rs:1:5: 1:6 error: file not found for module `a`
/home/hanno/Desktop/Stuff/tmp/cargo-bug/src/lib.rs:1 mod a;
^
Could not compile `cargo-bug`.
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
No labels