CLI reference#

The authoritative reference is cargo fc --help. This page mirrors it.

Usage#

cargo fc [+toolchain] [SUBCOMMAND] [SUBCOMMAND_OPTIONS]
cargo fc [+toolchain] [OPTIONS] [CARGO_OPTIONS] [CARGO_SUBCOMMAND]

Subcommands#

SubcommandDescription
matrix [COMMAND]Print the JSON feature-combination matrix to stdout. Add --pretty for indented JSON. COMMAND is an optional cargo subcommand whose per-command configuration the matrix should reflect. See The matrix subcommand and cargo fc matrix --help.
versionPrint version information.

Both are cargo-fc’s own subcommands: they print and exit, so they parse everything after their token themselves instead of forwarding it to Cargo. cargo fc matrix --help prints the matrix help (not the matrix), and an argument neither subcommand can honor is an error rather than a silently dropped token.

Options#

FlagDescription
-h, --helpPrint help information.
-V, --versionPrint version information.
--manifest-path <path>Path to the Cargo.toml to inspect.
-p, --package <name>Include only this workspace package (repeatable).
--exclude <name>Exclude a workspace package (repeatable). Pairs with --workspace for Cargo-compatible selection.
--diagnostics-onlyShow only diagnostics (warnings/errors) per combination. Requires a command that emits rustc JSON diagnostics (build, check, clippy, doc, or an equivalent alias/wrapper).
--dedupeLike --diagnostics-only, but also deduplicate identical diagnostics across combinations.
--summary-onlyHide cargo output; show only the final summary.
--fail-fastStop on the first failing combination.
--errors-onlyAllow all warnings, show errors only (-A warnings). Appends to RUSTFLAGS.
--pedanticTreat warnings like errors in the summary and under --fail-fast.
--show-prunedShow pruned (redundant) combinations in the summary.
--prune-impliedAutomatic pruning of redundant combinations, on by default; =false disables it for the run.
--maximal-featuresRun only maximal feature sets: combinations that are not a subset of another generated combination. An unconstrained matrix collapses into a single all-features invocation per package-target, while matrix constraints keep one invocation per alternative.
--packages-onlyIn matrix mode, emit one row per package-target instead of per combination.
--only-packages-with-lib-targetOnly consider packages that have a library target.
--aggregate-targetsBatch a combination’s configured targets into a single Cargo invocation (one --target each). Faster on many cores; falls back to serial for run and pruned summaries.
--no-targetsIgnore configured target lists for this run; use Cargo’s default single target (--target, then CARGO_BUILD_TARGET, then host). With an explicit --target <triple> this also lifts package-level targets constraints, forcing every selected package onto that triple.
--install-missing-targetsInstall missing Rust target components with rustup before running. Explicit opt-in — may mutate the toolchain and use the network.
--omit-host-target-flagBuild a configured target that is the host without an injected --target, sharing target/debug with an ordinary cargo build. On by default; =false builds it under target/<triple>/ like every other configured target. See Configured targets.
--driver <bin>Program invoked in place of cargo for each build (e.g. cargo-zigbuild, cross). See Build drivers.
--env <KEY=VALUE>Set a variable in every matrix-cell Cargo process (repeatable; the last value for a key wins). Overrides scoped env config.
--unset-env <KEY>Remove a variable from every matrix-cell Cargo process (repeatable). Applied before CLI --env additions.

Most boolean flags can also be set as defaults in Cargo.toml; CLI flags always win for a single invocation.

Environment variables#

VariableEffect
CARGOProgram used for plain Cargo invocations. Set in child processes to the +toolchain cargo when an override is given, unless child env config overrides it.
CARGO_DRIVERSet in child processes to the resolved driver unless child env config or CLI overrides it.
RUSTUP_TOOLCHAINSet in child processes to the +toolchain override unless child env config overrides it.
CARGO_FC_VERBOSEBoolean default for verbose cargo fc headers.

Notes#

  • Cargo-fc boolean flags take an optional inline value: --summary-only means --summary-only=true, and --summary-only=false turns a Cargo.toml default back off for one invocation. no, off, and 0 are accepted alongside false (and yes/on/1 alongside true). There are no --no-<flag> spellings — those tokens belong to cargo (--no-fail-fast for test, --no-dedupe for tree) and cargo-fc forwards them untouched.
  • Switches with no configurable default — --workspace, --pretty, --help, --version — take no value. --pretty belongs to cargo fc matrix and must follow that subcommand.
  • --dedupe implies --diagnostics-only. Setting --dedupe together with diagnostics_only = false in config is rejected as contradictory.
  • Everything after -- is forwarded to the invoked program and never interpreted by cargo fc. cargo fc matrix and cargo fc version invoke nothing, so they reject -- instead of dropping what follows it.
  • Cargo’s lockfile flags (--frozen, --locked, --offline) are forwarded to every cargo invocation and applied to the initial cargo metadata discovery, so --locked cannot be defeated by the metadata step updating Cargo.lock. cargo fc matrix accepts them for the metadata step alone.
  • --env requires KEY=VALUE, split at the first =; KEY= sets an empty value.