About target.$triple + target.'cfg()' in cargo config

Cargo Book says:

# Similar for the $triple configuration, but using the `cfg` syntax.
# If several `cfg` and $triple targets are candidates, then the rustflags
# are concatenated. The `cfg` syntax only applies to rustflags, and not to
# linker.

In my Cargo.toml I added a feature:

featureA = [...]

In my .cargo/config I added:

linker = "ld.lld"
rustflags = [
    "-C", "link-arg=-Tlink.ld",
    "-C", "panic=abort"

[target.'cfg(feature = "featureA")']
rustflags = [
    "-C", "target-cpu=cortex-a72",
    "-C", "lto=yes"

target = "aarch64-unknown-none"

And I build all as

cargo xbuild --release --features featureA

Rust flags from [target.'cfg(feature = "featureA")'] are not applied. Maybe it's because of [build] specifying the exact target? How to properly make config and run cargo build so that rustflags are concatenated from target triple and selected features?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.