I'd like to pass a custom --cfg
flag to rustc
via Cargo. Normally, I can do this by putting this in .cargo/config
for a given crate:
[build]
rustflags = "--cfg procmacro2_semver_exempt"
However, in one of my crates, I am using a custom compilation target
, and that seems to break rustflags
;
[build]
target = "avr-atmega32u4.json"
rustflags = "--cfg procmacro2_semver_exempt"
[unstable]
build-std = ["core"]
[env]
AVR_CPU_FREQUENCY_HZ = "16_000_000"
In this case, the config flag is not passed to rustc
. I've tried moving rustflags
into a target-specific section:
[target.avr-atmega32u4.json]
rustflags = "--cfg procmacro2_semver_exempt"
but this doesn't seem to have any effect either.