You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[target.'cfg(all())']
rustflags = ["-C", "linker=dylint-link"]
# For Rust versions 1.74.0 and onward, the following alternative can be used# (see https://github.com/rust-lang/cargo/pull/12535):# linker = "dylint-link"
The test works fine when run under cargo test, but fails when run under cargo-llvm-cov.
On the other hand, if you comment out the rustflags... line in the above, and uncomment the the # linker... line, the test works under cargo-llvm-cov.
Is it possible cargo-llvm-cov doesn't yet support target.'cfg(all())'.rustflags?
The following commands should reproduce the issue:
cargo install dylint-link
git clone https://github.com/trailofbits/dylint
cd dylint
cargo test -p cargo-dylint --test custom_toolchain
cargo llvm-cov -p cargo-dylint --test custom_toolchain
The text was updated successfully, but these errors were encountered:
The problem is that the config (that sets linker=dylint-link) is not the config of the workspace or package being compiled by cargo-llvm-cov, but a local config of a crate compiled by internally invoked (by test) commands. This is not taken into account where cargo-llvm-cov is invoked; cargo-llvm-cov passes rustflags as an environment variable (RUSTFLAGS by default) rather than config so that internally invoked commands can also participate in coverage, but because RUSTFLAGS environment variable take precedence over config files, internally invoked commands will ignore their local config will be ignored.
The workaround here is to have the cargo-llvm-cov set the TARGET_*_RUSTFLAGS instead of RUSTFLAGS to be merged with target.'cfg(,..)'.rustflags, which can be done by passing the --coverage-target-only flag (#167).
Ideally, I would like Cargo to support merging of rustflags by environment variables (rust-lang/cargo#5376)...
I have a test that involves the following
.cargo/config.toml
file:The test works fine when run under
cargo test
, but fails when run undercargo-llvm-cov
.On the other hand, if you comment out the
rustflags...
line in the above, and uncomment the the# linker...
line, the test works undercargo-llvm-cov
.Is it possible
cargo-llvm-cov
doesn't yet supporttarget.'cfg(all())'.rustflags
?The following commands should reproduce the issue:
The text was updated successfully, but these errors were encountered: