I've only just realized I don't know the precise rules for when
#[cfg(test)] is enabled and when it isn't. Obviously
cargo test builds the code with the test "feature", and
cargo build doesn't. What about
cargo bench? Is it possible to configure that at all?
I thought it might be tied to the test/bench compilation profiles, but I don't see anything in the documentation about it.
The reason I'm asking is because I've had an issue on Criterion.rs from someone asking about using code from their
#[cfg(test)] modules in their benchmarks and I could sorta see that being useful? I'm not sure if it's even possible without changes to Cargo though.