Configuration#

Everything about the matrix is configured from Cargo.toml metadata. The defaults — the powerset of a crate’s features, on the host target — need no configuration at all. You reach for configuration when you want to shape the matrix.

Read these in order the first time:

  1. Basics — where configuration lives.
  2. Shaping the feature matrix — the keys that add, remove, restrict, or pin combinations.
  3. The override model — the single precedence chain, patch operations, and inherit. This is the mental model that ties everything together.
  4. Per-target configuration — vary the matrix by target triple with cfg(...) selectors.
  5. Per-command configuration — vary the matrix by cargo subcommand.
  6. Flags in config — set cargo fc flag defaults.

If you just want a working snippet for a specific situation, the Recipes section has copy-paste configurations for common scenarios.