Open
Description
Problem
Hello,
When running cargo build --benches
, one might expect to only build the bench targets.
This is also the case for cargo bench
command.
When building the
Steps
- Create a hello world crate with some basic tests
- Add a basic bench
- Add a compilation error in a test
- Run
cargo build --benches
, see compilation error
Possible Solution(s)
I have not deep dived into the cargo code, but bench targets should not build the test target, especially since benches are generally built in a release profile, it kind of makes no sense to build the targets in the release profile as well.
Notes
Sorry if this makes no sense or if it's a duplicate.
If instructions on how to reproduce are not clear enough I can provide a simple repository!
Version
cargo 1.85.0 (d73d2caf9 2024-12-31)
release: 1.85.0
commit-hash: d73d2caf9e41a39daf2a8d6ce60ec80bf354d2a7
commit-date: 2024-12-31
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: NixOS 25.5.0 [64-bit]