-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
A-cargo-apiArea: cargo-the-library API and internal code issuesArea: cargo-the-library API and internal code issuesA-rebuild-detectionArea: rebuild detection and fingerprintingArea: rebuild detection and fingerprintingC-bugCategory: bugCategory: bugCommand-build
Description
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
Metadata
Metadata
Assignees
Labels
A-cargo-apiArea: cargo-the-library API and internal code issuesArea: cargo-the-library API and internal code issuesA-rebuild-detectionArea: rebuild detection and fingerprintingArea: rebuild detection and fingerprintingC-bugCategory: bugCategory: bugCommand-build