cargo-hack
cargo-hack copied to clipboard
Allow testing common `cfg` flags in the feature powerset
Notably, cfg(debug_assertions)
can be used to enable/disable code paths, and it might also be useful to test on profiles both with overflow-checks on and off.
- User-defined cfgs are set by passing the --cfg flag to rustflags.
- rustc/cargo built-in cfgs are set by profiles or specific flags. In most cases, they are not set by the --cfg flag (from the user's point of view).
Supporting the former is relatively easy, except that there is no stable way to handle config properly. (To handle it properly, we need to call cargo-config like rust-analyzer and cargo-llvm-cov do.) Supporting the latter is a bit more complicated because the cfg mapping is needed.