-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsA-rustflagsArea: rustflagsArea: rustflagsC-bugCategory: bugCategory: bug
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.
MaxNanasy and codyps
Metadata
Metadata
Assignees
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsA-rustflagsArea: rustflagsArea: rustflagsC-bugCategory: bugCategory: bug