Closed
Description
Steps to reproduce
- Create a crate with the following
Cargo.toml
:[package] name = "cargo_cache_is_frustrating" version = "0.1.0" edition = "2018" [dependencies] bitflags = "1.2" [profile.dev] opt-level = 3 debug = false rpath = false lto = false debug-assertions = false codegen-units = 16 panic = 'unwind' incremental = false overflow-checks = false [profile.release] # exactly the same opt-level = 3 debug = false rpath = false lto = false debug-assertions = false codegen-units = 16 panic = 'unwind' incremental = false overflow-checks = false
cargo build
cargo build --release
Actual result
> cargo build
Compiling bitflags v1.2.1
Compiling cargo_cache_is_frustrating v0.1.0 (...\cargo_cache_is_frustrating)
Finished dev [optimized] target(s) in 1.92s
> cargo build --release
Compiling bitflags v1.2.1
Compiling cargo_cache_is_frustrating v0.1.0 (...\cargo_cache_is_frustrating)
Finished release [optimized] target(s) in 4.33s
Expected result
> cargo build
Compiling bitflags v1.2.1
Compiling cargo_cache_is_frustrating v0.1.0 (...\cargo_cache_is_frustrating)
Finished dev [optimized] target(s) in 1.92s
> cargo build --release
Finished release [optimized] target(s) in 0.00s
I checked cargo --build-plan
outputs and they're identical
except they use paths in target/debug
and target/release
and
{
"invocations": [
...
{
"package_name": "bitflags",
...
"env": {
...
- "PROFILE": "debug",
+ "PROFILE": "release",
Why do I care
In this case maybe I don't. It's just a small repro. However, this also happens with dependency profile overrides, and there it entirely defeats one of their main purposes.
Version info
> cargo version --verbose
cargo 1.41.0-nightly (8280633db 2019-11-11)
release: 1.41.0
commit-hash: 8280633db680dec5bfe1de25156d1a1d53e6d190
commit-date: 2019-11-11