Closed
Description
Consider this setup:
outer
├── .cargo
│ └── config
└── inner
├── .cargo
│ └── config
├── Cargo.toml
└── src
└── main.rs
Less specific outer/.cargo/config
contains
[build]
rustflags = ["-Ccodegen-units=1"]
More specific outer/inner/.cargo/config
contains
[build]
rustflags = ["-Ccodegen-units=2"]
The compiler's command line in this case is
rustc --crate-name inner --edition=2018 'src\main.rs' ... -Ccodegen-units=2 -Ccodegen-units=1
rustc
like many other tools prefers the last specified value for the given option to support hierarchical build systems.
With Cargo's flag concatenation behavior this means that less specific flags override more specific flags, which is not a correct behavior.