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
General interpretation of cfg conditions seems difficult but we could at least skip #[cfg(windows)] on Unix and so on. At the moment they are mutated and reported as missed.
Rather than the module or individual functions having a #![cfg(windows)], it's the mod that includes them including module. Currently cargo-mutants doesn't look at mod statements at all, but rather it just reads everything. Maybe it would have to.
And, it's not even a simple #[cfg(windows)] but rather a cfg_if macro, though perhaps it could be rewritten.
Maybe there is a way to get the "preprocessed" expansion of cfg lines or even macros and look at that...
We could use --emit mir and then scrape that to try to determine which functions occur in the result.
sourcefrog
changed the title
Skip fns for other platforms
Doesn't understand cfg conditionals
Apr 26, 2023
sourcefrog
changed the title
Don't mutate code for other platforms, by interpreting cfg attributes
Better understanding of cfg attributes to skip excluded code
May 10, 2024
General interpretation of
cfg
conditions seems difficult but we could at least skip#[cfg(windows)]
on Unix and so on. At the moment they are mutated and reported as missed.This could perhaps use https://docs.rs/cargo-platform/0.1.2/cargo_platform/.
Cargo also seems to expose cfg variables to build scripts, but perhaps not otherwise. This might not be usable. https://doc.rust-lang.org/cargo/reference/environment-variables.html
https://docs.rs/target-spec/latest/target_spec/ exists and might be useful.
The text was updated successfully, but these errors were encountered: