Incompatible features#

Scenario: an HTTP client crate offers two TLS backends, native-tls and rustls. A consumer picks one — enabling both is a real conflict (here the code even compile_error!s on it). You want the matrix to skip that combination.

[package]
name = "http-client"
version = "0.1.0"
edition = "2024"

[features]
native-tls = []
rustls = []

[package.metadata.cargo-fc]
# native-tls and rustls are two TLS backends — never both at once.
exclude_feature_sets = [["native-tls", "rustls"]]

[workspace]

Any generated combination that is a superset of {native-tls, rustls} is removed. Every other combination — each backend alone, and neither — is still checked. cargo fc check visits exactly three combinations; the {native-tls, rustls} pair never appears:

$ cargo fc --summary-only check
 
     Checking [1/3] http-client ( features = [] )
     Checking [2/3] http-client ( features = [native-tls] )
     Checking [3/3] http-client ( features = [rustls] )
 
    Finished 3 feature combinations for 1 package in 0.00s
 
        PASS http-client ( 0 errors, 0 warnings, features = [] )
        PASS http-client ( 0 errors, 0 warnings, features = [native-tls] )
        PASS http-client ( 0 errors, 0 warnings, features = [rustls] )

More than one incompatible pair#

exclude_feature_sets takes a list, so list each forbidden grouping:

[package.metadata.cargo-fc]
exclude_feature_sets = [
  ["native-tls", "rustls"],   # TLS backends
  ["tokio", "async-std"],     # async runtimes
]

Only incompatible on some targets#

If a pair conflicts only on one target, add it there instead of the base — use add so it extends rather than replaces:

[package.metadata.cargo-fc]
exclude_feature_sets = [["native-tls", "rustls"]]

[package.metadata.cargo-fc.target.'cfg(target_os = "windows")']
exclude_feature_sets = { add = [["metal", "vulkan"]] }

See Per-target configuration.