Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow testing common cfg flags in the feature powerset #148

Open
CAD97 opened this issue Apr 1, 2022 · 3 comments
Open

Allow testing common cfg flags in the feature powerset #148

CAD97 opened this issue Apr 1, 2022 · 3 comments
Labels
C-enhancement Category: A new feature or an improvement for an existing one

Comments

@CAD97
Copy link

CAD97 commented Apr 1, 2022

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.

@taiki-e taiki-e added the C-enhancement Category: A new feature or an improvement for an existing one label Apr 3, 2022
@taiki-e
Copy link
Owner

taiki-e commented Jul 20, 2022

  • 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.

@wmmc88
Copy link

wmmc88 commented Dec 3, 2024

Supporting the former is relatively easy

@taiki-e do you have plans to support user-defined cfgs? There are some crates that use cfgs to enable non-additive codepaths, and it would be cool if they could use cargo-hack to test those codepaths.

Ex. tokio, uuid, windows-rs

@taiki-e
Copy link
Owner

taiki-e commented Dec 4, 2024

I would accept a PR to implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: A new feature or an improvement for an existing one
Projects
None yet
Development

No branches or pull requests

3 participants