I was surprised to learn that renaming the project root dir invalidates the compilation cache. This is something that happens during every CI and deployment run, making it run quite a bit slower when none of the rust code was actually changed. Is this intentional / is there a way to keep the cache fresh when renaming the directory?
The behaviour can be reproduced as follows (stable 1.12.1):
/$ cargo new rrrrrr
Created library `rrrrrr` project
/$ cd rrrrrr/
/rrrrrr$ cargo build
Compiling rrrrrr v0.1.0 (file:///rrrrrr) <-- Code gets compiled
Finished debug [unoptimized + debuginfo] target(s) in 0.11 secs
/rrrrrr$ cargo build
Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs <-- Code does not re-compile
/rrrrrr$ cargo build
Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs <-- Code does not re-compile
/rrrrrr$ cd ..
/$ mv rrrrrr/ rrrrrr2/
/$ cd rrrrrr2/
/rrrrrr2$ cargo build
Compiling rrrrrr v0.1.0 (file:///rrrrrr2) <-- Code re-compiles
Finished debug [unoptimized + debuginfo] target(s) in 0.11 secs
I was surprised to learn that renaming the project root dir invalidates the compilation cache. This is something that happens during every CI and deployment run, making it run quite a bit slower when none of the rust code was actually changed. Is this intentional / is there a way to keep the cache fresh when renaming the directory?
The behaviour can be reproduced as follows (stable 1.12.1):
/$ cargo new rrrrrr Created library `rrrrrr` project /$ cd rrrrrr/ /rrrrrr$ cargo build Compiling rrrrrr v0.1.0 (file:///rrrrrr) <-- Code gets compiled Finished debug [unoptimized + debuginfo] target(s) in 0.11 secs /rrrrrr$ cargo build Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs <-- Code does not re-compile /rrrrrr$ cargo build Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs <-- Code does not re-compile /rrrrrr$ cd .. /$ mv rrrrrr/ rrrrrr2/ /$ cd rrrrrr2/ /rrrrrr2$ cargo build Compiling rrrrrr v0.1.0 (file:///rrrrrr2) <-- Code re-compiles Finished debug [unoptimized + debuginfo] target(s) in 0.11 secs