Documentation · mitts 0.5.9
Mitts documentation
How to install and use Mitts, how the machine-wide cache decides what to rebuild, and every command, option and environment variable. The option tables are generated from the installed binary, so they match this version.
Install
Mitts is one binary for macOS (Apple Silicon), Linux (x86_64 and aarch64) and Windows (x86-64, MSVC). The installer downloads the release for your platform and verifies its checksum. If GitHub cannot be reached, or your platform has no prebuilt binary (Intel macOS, other architectures), and Cargo is installed, it builds the same version from crates.io instead; set MITTS_NO_SOURCE_FALLBACK=1 to fail rather than compile. See the environment variables.
curl -fsSL https://mittsbuild.com/install.sh | sh
mitts --version
On Windows, in PowerShell:
irm https://mittsbuild.com/install.ps1 | iex
From source, or through crates.io, once you already have a Rust toolchain:
cargo install mitts --locked # from crates.io
cargo install --path . # from a clone of the repository
Mitts reads your existing Cargo.toml and Cargo.lock. There is nothing to configure and no second manifest. Outputs go to Cargo's usual target/debug and target/release (or the root chosen by CARGO_TARGET_DIR or --target-dir); Mitts keeps its own build lock and file index under target/mitts/.
Quick start
- Build. From any Cargo workspace:
The first build compiles and stores each unit. The progress line counts finished units and names the ones compiling right now with how long each has run; the summary at the end splits compiled from cached units.cd your-workspace mitts build - Build again. Nothing changed, so Mitts returns almost immediately (the no-op fast path).
- Make a second checkout and build it.
Every dependency is restored from the machine-wide store instead of compiled. Your own crates (workspace members and path dependencies) are compiled again in each checkout, unlessgit worktree add ../your-workspace-2 HEAD cd ../your-workspace-2 mitts buildMITTS_SHARE_WORKSPACE_CRATES=1is set. See what a second checkout reuses and the worktree guide. - Ask why.
mitts explain # the plan and every unit's cache eligibility mitts explain --keys k.json # each unit's action key, for diffing between commits - Run the tests, fast.
mitts test -c # every test in its own process, all cores
How it works: the global cache
This section describes the build and cache protocol as implemented. Where the implementation has a known gap, the gap is stated next to the rule it weakens.
Principles
The cache follows four rules. Everything else on this page is their consequence.
- A cache hit needs a complete key. Every input that can change an output is part of the action key. An input Mitts cannot see is a reason to rebuild, never a reason to reuse.
- Shared objects are immutable. A published object is read-only and is hashed when it is published (an optional re-hash on restore is described below). Workspaces get their own copy, reflink or read-only hardlink, never a writable alias.
- The language core is neutral. The store, the action cache, the locks and the garbage collector know nothing about Cargo. A Rust adapter turns a Cargo workspace into actions.
- Cargo stays the contract.
Cargo.tomlandCargo.lockare read as they are. Mitts never writes a lockfile of its own. Outputs go to Cargo's usualtarget/debugandtarget/release, and Mitts records the files it put there somitts cleanremoves only those.
The global cache in one picture
Cargo keeps its cache in each workspace's target/, so every new clone, worktree or project starts empty. Mitts keeps compiled work in one store per machine and restores it into whichever workspace asks for it.
- The action cache (
ac/manifests) maps an action key to the list of objects that unit produced. - The content-addressed store (
cas/objects/<sha256>) holds those objects. Two units that produce identical bytes share one object. - A workspace (
target/) is a mutable view. Deleting it loses nothing: the next build restores from the store.
Two clones, two worktrees, two projects that use the same crate at the same version with the same inputs compile it once, on this machine, and every later build restores it.
The pipeline
A build runs six phases. A warm build skips most of them (see the no-op fast path).
| Phase | What happens |
|---|---|
resolve | Reuse Cargo.lock when it matches the manifests. Otherwise resolve against the crates.io sparse index and write a standard Cargo.lock. Registries, mirrors, vendored directories, git dependencies and [patch] follow Cargo's configuration. |
fetch | Download missing .crate archives in parallel, verify each SHA-256 against Cargo.lock, unpack once per machine into sources/. |
plan | Build the compilation units (library, binary, test, build script, proc macro) with features, targets and dependency edges, using Cargo's resolver rules. |
key | Derive one action key per unit, in topological order. |
execute | Run the unit graph in parallel: restore hits, compile misses. |
publish | Store each new output in the CAS, then record the action cache entry. |
mitts explain prints the plan and the key of every unit without compiling anything. mitts fetch runs only the first two phases.
Action keys: what decides a hit
An action key is the SHA-256 of a canonical text made of everything that can change the output of a unit.
toolchain: <rustc -vV>
target: <target triple>
profile: <dev | release | ...>
flags: <unit flags, in invocation order>
features: <sorted feature list>
sources: <sorted (path, content hash) pairs>
deps: <sorted (dependency unit, dependency action key) pairs>
- Sources
- For a registry dependency: the package files that came with the download. For a workspace unit, tracking is per unit. Package inputs are manifests, lockfiles, applicable
.cargo/config.tomlandclippy.toml, and root files includingbuild.rs. Unit inputs are thesrc/tree for libraries and binaries, and only the declaredsrc_pathfor integration tests, benchmarks and examples, so editing one integration test never invalidates its siblings or the library. Extra inputs (include_str!,include_bytes!,#[path]targets,tests/support/) are read from rustc's dep-info after the first compile and recorded in the manifest. - Environment
CARGO_*,RUST_*,RUSTFLAGS,RUSTDOCFLAGS,RUSTC_WRAPPER,RUSTC_WORKSPACE_WRAPPER,TARGET,HOSTandPROFILEenter the flags. Variables a crate reads throughenv!oroption_env!are discovered per unit and keyed with their values; an unset variable is recorded as<unset>.- Dependencies
- A unit's key contains its dependencies' keys, not their output bytes. A change anywhere below a unit therefore changes every key above it, and nothing else.
- Anything unknown
- An input Mitts cannot account for makes the unit uncached or explicitly unsupported. It is never treated as unchanged.
What a second checkout reuses
Dependencies (registry and git crates, their build-script runs and proc macros) are keyed without any path of yours, so a second clone or worktree restores them from the store. Your own crates (workspace members and path dependencies) change with every edit, so by default they are kept in a store inside each checkout's target/, one version each: a build with nothing changed restores them, an edit replaces them, mitts clean removes them, and a second checkout compiles them again. MITTS_SHARE_WORKSPACE_CRATES=1 puts them in the machine-wide store too, under the rules below.
An absolute path in a key would make every clone a miss. Mitts compiles workspace crates with --remap-path-prefix=<workspace_root>/=, so diagnostics, file!(), panic locations and debug info use relative paths such as src/main.rs. A unit that qualifies receives a path-independent key and hits across independent checkouts, clones and agent worktrees.
A unit qualifies when it:
- does not read
CARGO_MANIFEST_DIRat compile time throughenv!oroption_env!; - has no custom
build.rs; - does not depend on a proc macro the project declared impure;
- lives inside the workspace root (not
../shared).
Units that do not qualify keep the local absolute path in their key and are rebuilt per checkout. That is slower, not wrong.
Proc macros are pure by default. A project lists the ones that read package files or the package path while expanding (sqlx, askama, rust-embed, a local derive) under [workspace.metadata.mitts] impure-proc-macros in the root Cargo.toml. Their direct dependents are then keyed on the whole package tree and on the absolute path. There is no built-in list.
Defence in depth. Before publishing, Mitts scans every generated artifact for the bytes of the workspace root path. If it finds them, the artifact is never published under the path-independent key.
macOS linking. ld64 records each linked object's absolute path in the output's debug stabs, where --remap-path-prefix does not reach. Mitts passes -Wl,-oso_prefix,<workspace root>/ so the stabs read target/debug/deps/lib....rlib in every checkout, and a debugger started in the workspace still resolves them.
Store layout
One resolver picks the root of every store, in this order: --cache-dir, $MITTS_CACHE_DIR, $XDG_CACHE_HOME/mitts, ~/.cache/mitts. Setting it relocates all of them together; nothing falls back to the default on its own.
<cache root>/
├── cas/
│ ├── objects/<sha256> immutable objects, mode 0444
│ ├── artifacts/ named views of objects for rustc -L / --extern
│ ├── build_scripts/<base>/<exec>/{meta.toml, out/}
│ └── tmp/ staging for atomic publish
├── ac/manifests/ action cache entries
├── locks/ single-flight lock per action key
├── jobserver/ managed token pool
├── sources/<crate>-<version>/ unpacked registry sources
├── git/ bare mirrors and checkouts of git dependencies
└── index/ cached sparse-index entries
The workspace output is Cargo's target/, or $CARGO_TARGET_DIR, or --target-dir (which wins). Mitts creates CACHEDIR.TAG and a .gitignore there. mitts clean removes only the indexed outputs that still match their recorded metadata, so unrelated files in a shared target directory are left alone.
Executing a unit: hit, miss, publish
- Look up the action key in the action cache.
- Hit. Restore the objects into the workspace: a reflink where the filesystem supports it (APFS, XFS with reflink, Btrfs), otherwise a read-only hardlink to the immutable object, otherwise a copy. A corrupt object is discarded and the unit is rebuilt.
- Miss. Take the per-key lock, then look the key up again. Another process may have finished the unit while this one waited (double-checked locking). If it is still missing, compile.
- Publish. Copy each output into
cas/tmp/, mark it read-only, thenrenameit intoobjects/. The action cache entry is written only after every output is stored, so an interrupted build never leaves a partial object or an entry pointing at one.
By default a restore trusts objects that were published atomically and read-only, and does not re-read their bytes. MITTS_VERIFY_RESTORE=1 re-hashes every object before restoring it, for audits or suspect disks.
Concurrency: one compile for many builds
- Units run in waves over a work queue. A worker first tries the key lock without blocking. If another build holds it, the unit is marked contested and the worker moves on to other ready units, returning later.
- Two terminals, worktrees or agents building the same dependency therefore compile it once. The second build waits for, then restores, the first one's result.
rustcis pipelined: dependents start from the.rmetaas soon as metadata is ready, before the.rlibis finished.- Parallelism is bounded by a jobserver shared by all Mitts processes on the machine, so ten simultaneous builds do not start ten times the cores. An inherited
--jobserver-authfrom a parent build is respected.-j NorMITTS_JOBS=Nlowers the limit.
Build scripts
Build scripts are compiled and run by Mitts, and their results are cached too.
- Base key
- The script's sources, package, features, target, profile, tracked environment and build-dependency keys.
- Execution entry
- The directives it printed (
rustc-cfg,rustc-link-lib,rustc-env, ...), itsOUT_DIR, and the evidence it declared: content hashes ofrerun-if-changedpaths and values ofrerun-if-env-changedvariables. - Reuse rule
- A cached run is reused only if every declared path has the same content hash and every declared variable the same value. Otherwise the script runs again.
- Dynamic key
- The script runs first, in an isolated staging directory, before the unit's lock. The compile-affecting directives are canonicalised and hashed into the unit's key (
<base_key>:bd:<directives_hash>), so two builds that obtain different directives never share a compile. - Limit
- The staging directory is not an OS sandbox. A script that reads files or variables it did not declare can still cause a stale hit. As with Cargo, declaring inputs is the script author's job.
The no-op fast path
After a successful build Mitts writes target/mitts/build-<profile>.lock: the toolchain, the package selection, the features, and stat snapshots (path, size, mtime) of Cargo.lock, the manifests, the source files and directories, and the outputs.
On the next build, if every snapshot still matches, Mitts skips planning and keying and returns at once. Directory snapshots catch added and removed files. Any mismatch falls through to the normal keyed build, so the fast path can only skip work the full protocol would also skip. It is local to one workspace and never shared. With an explicit --cache-dir it is off unless MITTS_FAST_LOCK=1.
Size limit and garbage collection
The store is bounded by default, with no cron job. After a command that uses the cache (build, check, clippy, test, bench, coverage, llvm-cov, run, rustc), Mitts checks the size of the store and, over the limit, prunes it until it is under it.
- Old versions of tests and binaries go first: each change relinks them, so a busy workspace leaves many copies. The version of each target used last stays.
- Then the least recently used objects. A cache hit counts as a use.
- Pruning does not wait for running builds. While one holds the cache, objects used in the last two hours, those of units being built and those still linked into a workspace are kept. A pruned object costs one recompile, nothing else.
MITTS_CACHE_MAX_BYTESsets the limit (500M,2G, oroff/0); the default is 100 GiB.MITTS_GC_INTERVAL_SECSis the least time between checks (default 3600).- Build-script entries are removed by an atomic rename to
.gc.*and then deleted, so a concurrent reader sees the whole entry or none of it. Leftovertmpfiles older than one hour go too. mitts gc --max-bytes N --max-age-secs Sprunes on demand.- A build with
--no-cacheuses a privatecas-ephemeral-<id>store, removed by the next build or bymitts gcafter the process has exited, and adds nothing to the shared one.
Compiler wrappers
A rustc-wrapper in the Cargo config, or RUSTC_WRAPPER, CARGO_BUILD_RUSTC_WRAPPER, RUSTC_WORKSPACE_WRAPPER or CARGO_BUILD_RUSTC_WORKSPACE_WRAPPER, is an input Mitts cannot know: it may change what the compiler produces. By default a build with a wrapper is therefore not cached, and Mitts prints a warning that names the wrapper and how to clear it. Its -C metadata and -C extra-filename stay stable from run to run.
Opt in. If your wrapper is deterministic (a pass-through, a launcher, an analysis tool), set MITTS_RUSTC_WRAPPER_CACHE=1. The wrapper's path, canonical path and executable SHA-256 then go into every key, together with MITTS_RUSTC_WRAPPER_SALT if you set one, so a different or changed wrapper never reuses entries made by another. If the wrapper cannot be resolved or hashed, the build is not cached (it fails closed).
sccache is the one exception. It caches compiler results without changing them, so Mitts leaves it out, compiles without it, and reuses units from the Mitts store.
Compatibility with Cargo
- Mitts writes into the same
target/debugandtarget/releaselayout as Cargo (honouringCARGO_TARGET_DIRand--target-dir); its own lock and file index live undertarget/mitts/. mitts build --cargodelegates execution to Cargo. It is the differential oracle Mitts uses to compare diagnostics, exit codes and program behaviour.- Unsupported cases are reported as unsupported, not as a successful build.
Not supported yet
- A remote or team cache. The planned design is a second store tier over S3 or HTTP, written only by trusted CI.
- Empty or omitted
workspace.membersmeans the root package only; path dependencies outside it must be listed. Wildcards in intermediate directories (crates/*/sub) and character-class globs fail closed.
Commands
Every command accepts -h / --help. Options marked in the tables are generated from the binary; the paragraph under each option adds what the one-line help cannot say. Exit codes: 0 success, 101 a test failed, 2 a usage error.
Build
mitts build Build
Compile the package and its dependencies with Mitts' own graph executor. Every unit is looked up in the shared store first; only units whose inputs changed are compiled.
mitts build [OPTIONS] [-- <EXTRA_ARGS>...]
Examples
mitts buildDebug build of the package in the current directory. The first run compiles; later runs restore.mitts build --release -p apiOptimised build of one workspace member.mitts build --locked --offlineReproducible CI build: no resolution, no network.mitts build -j 4 --message-format shortAt most 4 units at once, one-line diagnostics.mitts build --no-cacheProve the build works from nothing and keep it out of the shared store.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--timings[=<FMTS>] | Write a per-unit timing report to target/cargo-timings (html by default; html,json) |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--slow-units <DURATION> | Report every compiler or build-script process still running after DURATION (30s, 10m, 1h; off = never; default 5m) Every compiler or build-script process still running after this long gets a line above the progress bar: how long it has run, its full command (runnable as is) and the codegen settings that make it slow ( |
--ignore-rust-version | Build even when a package's rust-version is newer than the rustc in use |
--future-incompat-report | Print a report of future-incompatibility warnings at the end of the build |
-j, --jobs <N> | Limit concurrent native build units (same as MITTS_JOBS; the flag wins) Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
-p, --package <PACKAGES> | Packages to build (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-r, --release | Build artifacts in release mode, with optimizations Use the release profile (optimisations). Outputs go under |
--profile <PROFILE-NAME> | Build with the named profile (dev, release, test, bench or a [profile.NAME] with inherits) |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-cache | Do not read from or write to the shared action cache Neither read nor write the shared store. The build uses a private store that is deleted afterwards. Use it to prove a build works from nothing, or to keep a one-off build out of the shared store. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--locked | Require an existing compatible Cargo.lock; do not resolve or write one Fail if |
--offline | Do not use the network to resolve dependencies; use only local sources No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Require a compatible Cargo.lock and use only locally available sources
|
--target <TARGET> | Select target triple; outputs go under target/<triple> Select a target triple. Outputs go under |
--example <EXAMPLE> | Build a named example target (repeatable; output under target/<profile>/examples) Build a named example. Repeat for several. Output is under |
--examples | Build all example targets |
--bench <NAME> | Build the named benchmark target (repeatable) |
--benches | Build all benchmark targets |
--keep-going | Do not stop at the first failed unit: skip what depends on it, build the rest, fail at the end |
-q, --quiet | Suppress Mitts progress and success summaries; keep errors and program output Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
--message-format <FMT> | Diagnostic output format: human, short, json, or Cargo json-* variants [default: human] How diagnostics are printed: |
--crate-type <CRATE_TYPES> | Override library crate types (for example, staticlib; use with --lib) Override the library's crate types, for example |
--native | Force native rustc DAG compilation (zero intermediate target bloat) Force Mitts' own rustc graph executor (the default path). |
--cargo | Force fallback to Cargo execution engine Delegate execution to Cargo instead. This is the reference Mitts is checked against; nothing is cached in the Mitts store. |
-v, --verbose... | -v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output Print more. |
--config <CONFIG> | Override a Cargo configuration value: TOML KEY=VALUE (e.g. build.jobs=2) or a TOML file Override a Cargo configuration value, as |
--exclude <SPEC> | Exclude packages from being built Leave these workspace members out (used with |
--bin <BIN> | Build the named binary target (repeatable; combines with other target selectors) Select one binary target. Repeat for several; combines with the other target selectors. |
--bins | Build all binary targets Select every binary target. |
--lib | Build only this package's library Select only the library. |
--workspace | Build all packages in the workspace [alias: --all] Every member of the workspace (alias |
--test <NAME> | Build the named test target without running it (repeatable) |
--tests | Build all test targets without running them |
--all-targets | Build all targets: lib, bins, tests, benches and examples |
--artifact-dir <PATH> | Copy final artifacts to this directory (unstable in Cargo: needs -Z unstable-options) [alias: --out-dir] |
Use -j N, or set MITTS_JOBS=N, to limit concurrent native build units. N must be a positive integer; the flag wins over the variable.
Arguments after -- are passed to the underlying builder.
mitts check Build
Type-check without producing binaries. Keyed and cached like build, so a second worktree of the same code restores its units instead of checking them again.
mitts check [OPTIONS] [-- <EXTRA_ARGS>...]
Examples
mitts checkCheck the current package.mitts check --workspace --all-targetsCheck every member including tests and benches.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--timings[=<FMTS>] | Write a per-unit timing report to target/cargo-timings (html by default; html,json) |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--slow-units <DURATION> | Report every compiler or build-script process still running after DURATION (30s, 10m, 1h; off = never; default 5m) Every compiler or build-script process still running after this long gets a line above the progress bar: how long it has run, its full command (runnable as is) and the codegen settings that make it slow ( |
--ignore-rust-version | Build even when a package's rust-version is newer than the rustc in use |
--future-incompat-report | Print a report of future-incompatibility warnings at the end of the build |
-j, --jobs <N> | Limit concurrent native build units (same as MITTS_JOBS; the flag wins) Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
--message-format <FMT> | Diagnostic output format: human, short, json, or Cargo json-* variants [default: human] How diagnostics are printed: |
-q, --quiet | Suppress Mitts progress and success summaries; keep diagnostics and errors Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
-p, --package <PACKAGES> | Packages to check (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-r, --release | Check artifacts in release mode Use the release profile (optimisations). Outputs go under |
--profile <PROFILE-NAME> | Use the named profile (dev, release, test, bench or a [profile.NAME] with inherits) |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-cache | Do not read from or write to the shared action cache Neither read nor write the shared store. The build uses a private store that is deleted afterwards. Use it to prove a build works from nothing, or to keep a one-off build out of the shared store. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--target <TARGET> | Select target triple for cross-compilation Select a target triple. Outputs go under |
--locked | Require an existing compatible Cargo.lock; do not resolve or write one Fail if |
--offline | Do not use the network to resolve dependencies; use only local sources No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Require a compatible Cargo.lock and use only locally available sources
|
-v, --verbose... | -v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output Print more. |
--config <CONFIG> | Override a Cargo configuration value: TOML KEY=VALUE (e.g. build.jobs=2) or a TOML file Override a Cargo configuration value, as |
--exclude <SPEC> | Exclude packages from being checked Leave these workspace members out (used with |
--workspace | Check all packages in the workspace [alias: --all] Every member of the workspace (alias |
--lib | Check only this package's library Select only the library. |
--bin <NAME> | Check the named binary target (repeatable; combines with other target selectors) Select one binary target. Repeat for several; combines with the other target selectors. |
--bins | Check all binaries Select every binary target. |
--test <NAME> | Check the named test target (repeatable; combines with --bin) |
--tests | Check all tests |
--example <NAME> | Check the named example target (repeatable; combines with other target selectors) Build a named example. Repeat for several. Output is under |
--examples | Check all examples |
--bench <NAME> | Check the named benchmark target (repeatable; combines with other target selectors) |
--benches | Check all benchmarks |
--all-targets | Check all targets |
--keep-going | Do not stop at the first failed unit: skip what depends on it, check the rest, fail at the end |
Use -j N, or set MITTS_JOBS=N, to limit concurrent native build units. N must be a positive integer; the flag wins over the variable.
mitts clippy Build
Run Clippy over the workspace's own packages. Lint results are cached per unit like compile results.
mitts clippy [OPTIONS] [-- <EXTRA_ARGS>...]
Examples
mitts clippyLint the current package.mitts clippy -- -D warningsPass-D warningsto Clippy: any warning fails the command (exit code 101).
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--timings[=<FMTS>] | Write a per-unit timing report to target/cargo-timings (html by default; html,json) |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--slow-units <DURATION> | Report every compiler or build-script process still running after DURATION (30s, 10m, 1h; off = never; default 5m) Every compiler or build-script process still running after this long gets a line above the progress bar: how long it has run, its full command (runnable as is) and the codegen settings that make it slow ( |
--ignore-rust-version | Build even when a package's rust-version is newer than the rustc in use |
--future-incompat-report | Print a report of future-incompatibility warnings at the end of the build |
-j, --jobs <N> | Limit concurrent native build units (same as MITTS_JOBS; the flag wins) Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
--message-format <FMT> | Diagnostic output format: human, short, json, or Cargo json-* variants [default: human] How diagnostics are printed: |
-q, --quiet | Suppress Mitts progress and success summaries; keep diagnostics and errors Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
-p, --package <PACKAGES> | Packages to lint (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-r, --release | Lint artifacts in release mode Use the release profile (optimisations). Outputs go under |
--profile <PROFILE-NAME> | Use the named profile (dev, release, test, bench or a [profile.NAME] with inherits) |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-cache | Do not read from or write to the shared action cache Neither read nor write the shared store. The build uses a private store that is deleted afterwards. Use it to prove a build works from nothing, or to keep a one-off build out of the shared store. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--target <TARGET> | Select target triple for cross-compilation Select a target triple. Outputs go under |
--locked | Require an existing compatible Cargo.lock; do not resolve or write one Fail if |
--offline | Do not use the network to resolve dependencies; use only local sources No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Require a compatible Cargo.lock and use only locally available sources
|
-v, --verbose... | -v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output Print more. |
--config <CONFIG> | Override a Cargo configuration value: TOML KEY=VALUE (e.g. build.jobs=2) or a TOML file Override a Cargo configuration value, as |
--exclude <SPEC> | Exclude packages from being linted Leave these workspace members out (used with |
--workspace | Lint all packages in the workspace [alias: --all] Every member of the workspace (alias |
--lib | Lint only this package's library Select only the library. |
--bin <NAME> | Lint the named binary target (repeatable; combines with other target selectors) Select one binary target. Repeat for several; combines with the other target selectors. |
--bins | Lint all binaries Select every binary target. |
--test <NAME> | Lint the named test target (repeatable; combines with --bin) |
--tests | Lint all tests |
--example <NAME> | Lint the named example target (repeatable; combines with other target selectors) Build a named example. Repeat for several. Output is under |
--examples | Lint all examples |
--bench <NAME> | Lint the named benchmark target (repeatable; combines with other target selectors) |
--benches | Lint all benchmarks |
--all-targets | Lint all targets |
--keep-going | Do not stop at the first failed unit: skip what depends on it, lint the rest, fail at the end |
Use -j N, or set MITTS_JOBS=N, to limit concurrent native build units. N must be a positive integer; the flag wins over the variable.
mitts fmt Build
Format Rust sources with rustfmt.
mitts fmt [OPTIONS] [-- <EXTRA_ARGS>...]
Examples
mitts fmt --allFormat every package.mitts fmt --all --checkFail if anything is unformatted (CI).
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
-p, --package <PACKAGE> | Package to format Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--check | Run in 'check' mode to exit with an error if files are unformatted Do not rewrite files; exit non-zero if any would change. |
--all | Format all packages in the workspace Every package in the workspace. |
-v, --verbose... | Use verbose output Passed on to rustfmt as |
mitts rustc Build
Run a native rustc query for the selected target, for example to print cfg values or the sysroot.
mitts rustc [OPTIONS] [-- <EXTRA_ARGS>...]
Examples
mitts rustc --lib -- --print cfgPrint the cfg set rustc uses for the package's library.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--timings[=<FMTS>] | Write a per-unit timing report to target/cargo-timings (html by default; html,json) |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--slow-units <DURATION> | Report every compiler or build-script process still running after DURATION (30s, 10m, 1h; off = never; default 5m)
|
--ignore-rust-version | Build even when a package's rust-version is newer than the rustc in use |
--future-incompat-report | Print a report of future-incompatibility warnings at the end of the build |
-j, --jobs <N> | Limit concurrent native build units (same as MITTS_JOBS; the flag wins) Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
-p, --package <PACKAGES> | Packages to build (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-r, --release | Build artifacts in release mode, with optimizations Use the release profile (optimisations). Outputs go under |
--profile <PROFILE-NAME> | Build with the named profile (dev, release, test, bench or a [profile.NAME] with inherits) |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-cache | Do not read from or write to the shared action cache Neither read nor write the shared store. The build uses a private store that is deleted afterwards. Use it to prove a build works from nothing, or to keep a one-off build out of the shared store. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--locked | Require an existing compatible Cargo.lock; do not resolve or write one Fail if |
--offline | Do not use the network to resolve dependencies; use only local sources No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Require a compatible Cargo.lock and use only locally available sources
|
--target <TARGET> | Select target triple; outputs go under target/<triple> Select a target triple. Outputs go under |
--example <EXAMPLE> | Build a named example target (repeatable; output under target/<profile>/examples) Build a named example. Repeat for several. Output is under |
--examples | Build all example targets |
--bench <NAME> | Build the named benchmark target (repeatable) |
--benches | Build all benchmark targets |
--keep-going | Do not stop at the first failed unit: skip what depends on it, build the rest, fail at the end |
-q, --quiet | Suppress Mitts progress and success summaries; keep errors and program output Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
--message-format <FMT> | Diagnostic output format: human, short, json, or Cargo json-* variants [default: human] How diagnostics are printed: |
--crate-type <CRATE_TYPES> | Override library crate types (for example, staticlib; use with --lib) Override the library's crate types, for example |
--native | Force native rustc DAG compilation (zero intermediate target bloat) Force Mitts' own rustc graph executor (the default path). |
--cargo | Force fallback to Cargo execution engine Delegate execution to Cargo instead. This is the reference Mitts is checked against; nothing is cached in the Mitts store. |
-v, --verbose... | -v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output Print more. |
--config <CONFIG> | Override a Cargo configuration value: TOML KEY=VALUE (e.g. build.jobs=2) or a TOML file Override a Cargo configuration value, as |
--exclude <SPEC> | Exclude packages from being built Leave these workspace members out (used with |
--bin <BIN> | Build the named binary target (repeatable; combines with other target selectors) Select one binary target. Repeat for several; combines with the other target selectors. |
--bins | Build all binary targets Select every binary target. |
--lib | Build only this package's library Select only the library. |
--workspace | Build all packages in the workspace [alias: --all] Every member of the workspace (alias |
--test <NAME> | Build the named test target without running it (repeatable) |
--tests | Build all test targets without running them |
--all-targets | Build all targets: lib, bins, tests, benches and examples |
--artifact-dir <PATH> | Copy final artifacts to this directory (unstable in Cargo: needs -Z unstable-options) [alias: --out-dir] |
Today mitts rustc requires --lib; it exits with an error without it. Arguments after -- go to rustc.
mitts run Build
Build a binary and run it. Arguments after -- go to the program.
mitts run [OPTIONS] [-- <EXTRA_ARGS>...]
Examples
mitts run --release -- --port 8080Run the release binary with--port 8080.mitts run --bin migratePick one of several binaries.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--timings[=<FMTS>] | Write a per-unit timing report to target/cargo-timings (html by default; html,json) |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--slow-units <DURATION> | Report every compiler or build-script process still running after DURATION (30s, 10m, 1h; off = never; default 5m) Every compiler or build-script process still running after this long gets a line above the progress bar: how long it has run, its full command (runnable as is) and the codegen settings that make it slow ( |
--ignore-rust-version | Build even when a package's rust-version is newer than the rustc in use |
--future-incompat-report | Print a report of future-incompatibility warnings at the end of the build |
-j, --jobs <N> | Limit concurrent native build units (same as MITTS_JOBS; the flag wins) Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
-p, --package <PACKAGES> | Packages to build (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-r, --release | Build artifacts in release mode, with optimizations Use the release profile (optimisations). Outputs go under |
--profile <PROFILE-NAME> | Build with the named profile (dev, release, test, bench or a [profile.NAME] with inherits) |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-cache | Do not read from or write to the shared action cache Neither read nor write the shared store. The build uses a private store that is deleted afterwards. Use it to prove a build works from nothing, or to keep a one-off build out of the shared store. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--locked | Require an existing compatible Cargo.lock; do not resolve or write one Fail if |
--offline | Do not use the network to resolve dependencies; use only local sources No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Require a compatible Cargo.lock and use only locally available sources
|
--target <TARGET> | Select target triple; outputs go under target/<triple> Select a target triple. Outputs go under |
--example <EXAMPLE> | Build a named example target (repeatable; output under target/<profile>/examples) Build a named example. Repeat for several. Output is under |
--examples | Build all example targets |
--bench <NAME> | Build the named benchmark target (repeatable) |
--benches | Build all benchmark targets |
--keep-going | Do not stop at the first failed unit: skip what depends on it, build the rest, fail at the end |
-q, --quiet | Suppress Mitts progress and success summaries; keep errors and program output Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
--message-format <FMT> | Diagnostic output format: human, short, json, or Cargo json-* variants [default: human] How diagnostics are printed: |
--crate-type <CRATE_TYPES> | Override library crate types (for example, staticlib; use with --lib) Override the library's crate types, for example |
--native | Force native rustc DAG compilation (zero intermediate target bloat) Force Mitts' own rustc graph executor (the default path). |
--cargo | Force fallback to Cargo execution engine Delegate execution to Cargo instead. This is the reference Mitts is checked against; nothing is cached in the Mitts store. |
-v, --verbose... | -v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output Print more. |
--config <CONFIG> | Override a Cargo configuration value: TOML KEY=VALUE (e.g. build.jobs=2) or a TOML file Override a Cargo configuration value, as |
--exclude <SPEC> | Exclude packages from being built Leave these workspace members out (used with |
--bin <BIN> | Build the named binary target (repeatable; combines with other target selectors) Select one binary target. Repeat for several; combines with the other target selectors. |
--bins | Build all binary targets Select every binary target. |
--lib | Build only this package's library Select only the library. |
--workspace | Build all packages in the workspace [alias: --all] Every member of the workspace (alias |
--test <NAME> | Build the named test target without running it (repeatable) |
--tests | Build all test targets without running them |
--all-targets | Build all targets: lib, bins, tests, benches and examples |
--artifact-dir <PATH> | Copy final artifacts to this directory (unstable in Cargo: needs -Z unstable-options) [alias: --out-dir] |
Test
mitts test Test
Build and run unit, integration and doc tests. By default test binaries run one after another and the tests inside each on threads; -c runs every test in its own process from one shared pool.
mitts test [OPTIONS] [TESTNAME] [-- <TEST_ARGS>...]
Examples
mitts testRun all tests of the current package.mitts test parse_Only tests whose name containsparse_.mitts test --workspace --no-fail-fastEvery member; list all failures.mitts test -cEvery test in its own process, all cores.mitts test -c=8 --no-fail-fastEight processes at once, run everything.mitts test --no-runCompile and link only: warms the cache for CI jobs that run tests elsewhere.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--timings[=<FMTS>] | Write a per-unit timing report to target/cargo-timings (html by default; html,json) |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--slow-units <DURATION> | Report every compiler or build-script process still running after DURATION (30s, 10m, 1h; off = never; default 5m) Every compiler or build-script process still running after this long gets a line above the progress bar: how long it has run, its full command (runnable as is) and the codegen settings that make it slow ( |
--ignore-rust-version | Build even when a package's rust-version is newer than the rustc in use |
--future-incompat-report | Print a report of future-incompatibility warnings at the end of the build |
-j, --jobs <N> | Limit concurrent native build units (same as MITTS_JOBS; the flag wins) Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
-q, --quiet | Suppress Mitts banners and per-test pass lines; keep failures and summaries Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
--message-format <FMT> | Diagnostic output format: human, short, json, or Cargo json-* variants [default: human] How diagnostics are printed: |
-p, --package <PACKAGES> | Packages to test (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
--workspace | Test all packages in the workspace [alias: --all] Every member of the workspace (alias |
--exclude <SPEC> | Exclude packages from being tested Leave these workspace members out (used with |
-r, --release | Build and run tests in release mode Use the release profile (optimisations). Outputs go under |
--profile <PROFILE-NAME> | Use the named profile (dev, release, test, bench or a [profile.NAME] with inherits) |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-cache | Do not read from or write to the shared action cache Neither read nor write the shared store. The build uses a private store that is deleted afterwards. Use it to prove a build works from nothing, or to keep a one-off build out of the shared store. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--target <TARGET> | Select target triple for cross-compilation Select a target triple. Outputs go under |
--locked | Require an existing compatible Cargo.lock; do not resolve or write one Fail if |
--offline | Do not use the network to resolve dependencies; use only local sources No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Require a compatible Cargo.lock and use only locally available sources
|
--no-run | Compile, but don't run tests Compile and link, but do not execute. The build half of a test run, and the cheapest way to warm the cache for tests. |
--coverage | Collect code coverage while running tests (compatible with cargo test --coverage) |
-v, --verbose... | -v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output Print more. |
--config <CONFIG> | Override a Cargo configuration value: TOML KEY=VALUE (e.g. build.jobs=2) or a TOML file Override a Cargo configuration value, as |
--no-fail-fast | Run all tests regardless of failure (default is fail-fast) Do not stop at the first failing test; run everything and report all failures. |
--test <TEST> | Test the named integration target (repeatable; combines with --bin) |
--tests | Test all integration test targets |
--benches | Test all benchmarks |
--keep-going | Keep compiling test targets past a failed unit (skip only what depends on it); the command still fails, and no tests run, when any target failed to compile |
--all-targets | Test all targets, including examples and benchmarks |
--bin <BIN> | Test the named binary target (repeatable; combines with --test) Select one binary target. Repeat for several; combines with the other target selectors. |
--bins | Test all binary targets Select every binary target. |
--lib | Test only this package's library unit tests Select only the library. |
--doc | Test only this package's library documentation |
-c, --concurrency[=<N>] | Run every test in its own process, many at a time (like cargo-nextest) Without a number the pool is all the cores; -c=N or --concurrency=N runs N processes at once. Write the number with =: a bare -c leaves the next word to the test filter (mitts test -c quick). Each test binary lists its tests, then each test runs as binary --exact NAME; the tests of all binaries share one pool. Output of a test is shown when it fails. The first failure stops new tests unless --no-fail-fast. Binaries with harness = false run once as a whole; arguments after -- are not passed to the test processes. Not related to -j, which limits concurrent build units. Tests that share a fixed port, file, database or cache with each other can fail when run at once: see docs/test-concurrency.md for the dangers and how to write independent tests. Run every test in a process of its own, many at a time, like cargo-nextest. Bare |
--nocapture | Run tests without capturing output (equivalent to -- --nocapture) Show test output as it happens instead of only on failure. |
--exact | Require exact test-name matches; pass before --, with filters after it Match test names exactly, not by substring. |
--ignored | Run only ignored tests (equivalent to -- --ignored) Run only |
--bench <NAME> | Test the named benchmark target (repeatable) |
--example <NAME> | Test the named example target (repeatable) Build a named example. Repeat for several. Output is under |
--examples | Test all example targets |
Use -j N, or set MITTS_JOBS=N, to limit concurrent native build units. N must be a positive integer; the flag wins over the variable.
How -c works
Each test binary is asked for its test list (--list); then every test runs as binary --exact NAME. The tests of all binaries share one pool, so a crash or hang loses one test, and tests cannot change each other's memory, statics or environment. A failing test's output is printed with its name; the first failure stops new tests unless --no-fail-fast; the exit code is 101. Binaries with harness = false run once as a whole. Tests that share a fixed port, file or database can fail when run at once. On this repository's own suite (945 tests, 244 binaries, 32 cores): 95 s serial, 18 s with -c.
mitts coverage Test
Build instrumented test binaries, run them, and report coverage with LLVM's tools (needs the llvm-tools-preview component). Instrumented units carry their own cache keys.
mitts coverage [OPTIONS] [TESTNAME] [-- <TEST_ARGS>...]
Examples
mitts coverage --summary-onlyOne-table summary.mitts coverage --html --openHTML report in the browser.mitts coverage --lcov --output-path lcov.infoLCOV file for a coverage service.mitts coverage -c --fail-under-lines 90Run tests in parallel processes (each writes its own profile; the report merges them) and fail below 90%.mitts coverage --ignore-filename-regex '(tests/|vendored/)' --fail-under-lines 90Gate on the filtered code only.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--timings[=<FMTS>] | Write a per-unit timing report to target/cargo-timings (html by default; html,json) |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--slow-units <DURATION> | Report every compiler or build-script process still running after DURATION (30s, 10m, 1h; off = never; default 5m) Every compiler or build-script process still running after this long gets a line above the progress bar: how long it has run, its full command (runnable as is) and the codegen settings that make it slow ( |
--ignore-rust-version | Build even when a package's rust-version is newer than the rustc in use |
--future-incompat-report | Print a report of future-incompatibility warnings at the end of the build |
-j, --jobs <N> | Limit concurrent native build units (same as MITTS_JOBS; the flag wins) Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
-p, --package <PACKAGES> | Packages to measure (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-r, --release | Build and run tests in release mode Use the release profile (optimisations). Outputs go under |
-q, --quiet | Suppress Mitts progress and stage banners; keep errors and the coverage report Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
--summary-only | Only print high-level coverage summary table Print just the summary table (or, with |
--html | Generate HTML coverage report Write an HTML report to a directory ( |
--lcov | Generate LCOV coverage report (lcov.info) Write an LCOV report ( |
--json | Generate JSON coverage report Machine-readable output. |
--text | Generate plain text coverage report Print a plain text report. |
--output-dir <OUTPUT_DIR> | Output directory for HTML or LCOV reports Directory for the HTML or LCOV report. |
--output-path <FILE> | Write a JSON, LCOV or text report to this file instead of stdout (or lcov.info) Write one JSON, LCOV or text report to exactly this file (parent directories are created) instead of stdout. Use it with exactly one format; with |
--open | Automatically open the generated HTML report Open the HTML report in the browser when done. |
--fail-under-lines <FAIL_UNDER_LINES> | Minimum line coverage percentage (fails if below threshold) Exit non-zero if line coverage is below this percentage. The gate is measured after |
--ignore-filename-regex <IGNORE_FILENAME_REGEX> | Exclude matching source filenames from reports and the coverage threshold Drop files whose path matches this regular expression from every report and from the totals the threshold checks. Paths are workspace-relative, so |
--workspace | Build all targets in the workspace [alias: --all] Every member of the workspace (alias |
--exclude <SPEC> | Exclude packages from being tested Leave these workspace members out (used with |
--all-targets | Build all targets (bins, tests, benches) |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-cache | Do not read from or write to the shared action cache Neither read nor write the shared store. The build uses a private store that is deleted afterwards. Use it to prove a build works from nothing, or to keep a one-off build out of the shared store. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--target <TARGET> | Select target triple for cross-compilation Select a target triple. Outputs go under |
--locked | Require an existing compatible Cargo.lock; do not resolve or write one Fail if |
--offline | Do not use the network to resolve dependencies; use only local sources No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Require a compatible Cargo.lock and use only locally available sources
|
--no-run | Compile, but don't run tests or collect profiles Compile and link, but do not execute. The build half of a test run, and the cheapest way to warm the cache for tests. |
--no-fail-fast | Run all tests regardless of failure (default is fail-fast) Do not stop at the first failing test; run everything and report all failures. |
--test <TEST> | Test the named integration target (repeatable; combines with --bin) |
--tests | Test all integration test targets |
--bin <BIN> | Test the named binary target (repeatable; combines with --test) Select one binary target. Repeat for several; combines with the other target selectors. |
--bins | Test all binary targets Select every binary target. |
--lib | Test only this package's library unit tests Select only the library. |
--doc | Test only this package's library documentation |
--nocapture | Run tests without capturing output (equivalent to -- --nocapture) Show test output as it happens instead of only on failure. |
--exact | Require exact test-name matches; pass before --, with filters after it Match test names exactly, not by substring. |
--ignored | Run only ignored tests (equivalent to -- --ignored) Run only |
-c, --concurrency[=<N>] | Run every test in its own process, many at a time, as mitts test -c does Without a number the pool is all the cores; -c=N runs N processes at once. Each process writes its own profile file, so the report is the same as for a serial run. Run every test in a process of its own, many at a time, like cargo-nextest. Bare |
-v, --verbose... | -v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output Print more. |
--config <CONFIG> | Override a Cargo configuration value: TOML KEY=VALUE (e.g. build.jobs=2) or a TOML file Override a Cargo configuration value, as |
Files are reported by workspace-relative path; registry and git dependencies and the standard library are left out. mitts llvm-cov is the same command under Cargo's name.
mitts llvm-cov Test
The same as mitts coverage, under the name cargo llvm-cov users know.
mitts llvm-cov [OPTIONS] [TESTNAME] [-- <TEST_ARGS>...]
Examples
mitts llvm-cov --workspace --json --summary-only --output-path target/coverage.jsonPer-file summaries and totals as JSON.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--timings[=<FMTS>] | Write a per-unit timing report to target/cargo-timings (html by default; html,json) |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--slow-units <DURATION> | Report every compiler or build-script process still running after DURATION (30s, 10m, 1h; off = never; default 5m) Every compiler or build-script process still running after this long gets a line above the progress bar: how long it has run, its full command (runnable as is) and the codegen settings that make it slow ( |
--ignore-rust-version | Build even when a package's rust-version is newer than the rustc in use |
--future-incompat-report | Print a report of future-incompatibility warnings at the end of the build |
-j, --jobs <N> | Limit concurrent native build units (same as MITTS_JOBS; the flag wins) Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
-p, --package <PACKAGES> | Packages to measure (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-r, --release | Build and run tests in release mode Use the release profile (optimisations). Outputs go under |
-q, --quiet | Suppress Mitts progress and stage banners; keep errors and the coverage report Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
--summary-only | Only print high-level coverage summary table Print just the summary table (or, with |
--html | Generate HTML coverage report Write an HTML report to a directory ( |
--lcov | Generate LCOV coverage report (lcov.info) Write an LCOV report ( |
--json | Generate JSON coverage report Machine-readable output. |
--text | Generate plain text coverage report Print a plain text report. |
--output-dir <OUTPUT_DIR> | Output directory for HTML or LCOV reports Directory for the HTML or LCOV report. |
--output-path <FILE> | Write a JSON, LCOV or text report to this file instead of stdout (or lcov.info) Write one JSON, LCOV or text report to exactly this file (parent directories are created) instead of stdout. Use it with exactly one format; with |
--open | Automatically open the generated HTML report Open the HTML report in the browser when done. |
--fail-under-lines <FAIL_UNDER_LINES> | Minimum line coverage percentage (fails if below threshold) Exit non-zero if line coverage is below this percentage. The gate is measured after |
--ignore-filename-regex <IGNORE_FILENAME_REGEX> | Exclude matching source filenames from reports and the coverage threshold Drop files whose path matches this regular expression from every report and from the totals the threshold checks. Paths are workspace-relative, so |
--workspace | Build all targets in the workspace [alias: --all] Every member of the workspace (alias |
--exclude <SPEC> | Exclude packages from being tested Leave these workspace members out (used with |
--all-targets | Build all targets (bins, tests, benches) |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-cache | Do not read from or write to the shared action cache Neither read nor write the shared store. The build uses a private store that is deleted afterwards. Use it to prove a build works from nothing, or to keep a one-off build out of the shared store. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--target <TARGET> | Select target triple for cross-compilation Select a target triple. Outputs go under |
--locked | Require an existing compatible Cargo.lock; do not resolve or write one Fail if |
--offline | Do not use the network to resolve dependencies; use only local sources No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Require a compatible Cargo.lock and use only locally available sources
|
--no-run | Compile, but don't run tests or collect profiles Compile and link, but do not execute. The build half of a test run, and the cheapest way to warm the cache for tests. |
--no-fail-fast | Run all tests regardless of failure (default is fail-fast) Do not stop at the first failing test; run everything and report all failures. |
--test <TEST> | Test the named integration target (repeatable; combines with --bin) |
--tests | Test all integration test targets |
--bin <BIN> | Test the named binary target (repeatable; combines with --test) Select one binary target. Repeat for several; combines with the other target selectors. |
--bins | Test all binary targets Select every binary target. |
--lib | Test only this package's library unit tests Select only the library. |
--doc | Test only this package's library documentation |
--nocapture | Run tests without capturing output (equivalent to -- --nocapture) Show test output as it happens instead of only on failure. |
--exact | Require exact test-name matches; pass before --, with filters after it Match test names exactly, not by substring. |
--ignored | Run only ignored tests (equivalent to -- --ignored) Run only |
-c, --concurrency[=<N>] | Run every test in its own process, many at a time, as mitts test -c does Without a number the pool is all the cores; -c=N runs N processes at once. Each process writes its own profile file, so the report is the same as for a serial run. Run every test in a process of its own, many at a time, like cargo-nextest. Bare |
-v, --verbose... | -v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output Print more. |
--config <CONFIG> | Override a Cargo configuration value: TOML KEY=VALUE (e.g. build.jobs=2) or a TOML file Override a Cargo configuration value, as |
mitts bench Test
Compile and run benchmark targets in the bench profile.
mitts bench [OPTIONS] [BENCHNAME] [-- <BENCH_ARGS>...]
Examples
mitts benchRun the package's benchmarks.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--timings[=<FMTS>] | Write a per-unit timing report to target/cargo-timings (html by default; html,json) |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--slow-units <DURATION> | Report every compiler or build-script process still running after DURATION (30s, 10m, 1h; off = never; default 5m) Every compiler or build-script process still running after this long gets a line above the progress bar: how long it has run, its full command (runnable as is) and the codegen settings that make it slow ( |
--ignore-rust-version | Build even when a package's rust-version is newer than the rustc in use |
--future-incompat-report | Print a report of future-incompatibility warnings at the end of the build |
-j, --jobs <N> | Limit concurrent native build units (same as MITTS_JOBS; the flag wins) Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
-q, --quiet | Suppress Mitts banners and stage summaries Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
--message-format <FMT> | Diagnostic output format: human, short, json, or Cargo json-* variants [default: human] How diagnostics are printed: |
-p, --package <PACKAGES> | Packages to benchmark (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
--workspace | Benchmark all packages in the workspace [alias: --all] Every member of the workspace (alias |
--exclude <SPEC> | Exclude packages from being benchmarked Leave these workspace members out (used with |
--bench <NAME> | Benchmark only the named benchmark target (repeatable); default is every benchmark target |
--benches | Benchmark all benchmark targets (the default when nothing is selected) |
--lib | Benchmark only this package's library Select only the library. |
--bin <NAME> | Benchmark only the specified binary (repeatable) Select one binary target. Repeat for several; combines with the other target selectors. |
--bins | Benchmark all binaries Select every binary target. |
--example <NAME> | Benchmark only the specified example (repeatable) Build a named example. Repeat for several. Output is under |
--examples | Benchmark all examples |
--test <NAME> | Benchmark only the specified test target (repeatable) |
--tests | Benchmark all targets that have test = true set |
--all-targets | Benchmark all targets |
--profile <PROFILE-NAME> | Build artifacts with the specified profile (default: bench) |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-cache | Do not read from or write to the shared action cache Neither read nor write the shared store. The build uses a private store that is deleted afterwards. Use it to prove a build works from nothing, or to keep a one-off build out of the shared store. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--target <TARGET> | Select target triple for cross-compilation Select a target triple. Outputs go under |
--locked | Require an existing compatible Cargo.lock; do not resolve or write one Fail if |
--offline | Do not use the network to resolve dependencies; use only local sources No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Require a compatible Cargo.lock and use only locally available sources
|
--no-run | Compile the benchmarks, but don't run them Compile and link, but do not execute. The build half of a test run, and the cheapest way to warm the cache for tests. |
--no-fail-fast | Run all benchmark targets regardless of failure (default is fail-fast) Do not stop at the first failing test; run everything and report all failures. |
-v, --verbose... | -v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output Print more. |
--config <CONFIG> | Override a Cargo configuration value: TOML KEY=VALUE (e.g. build.jobs=2) or a TOML file Override a Cargo configuration value, as |
Builds [[bench]] and benches/ targets with the release profile plus [profile.bench] and runs each with `--bench` (a libtest or harness = false benchmark such as Criterion measures instead of testing). Select targets with --bench NAME; BENCHNAME and arguments after `--` go to the benchmark binaries. Library and binary unit tests and documentation tests are not run. Use -j N, or set MITTS_JOBS=N, to limit concurrent native build units.
Inspect
mitts explain Inspect
Print the build plan without compiling: every unit, its features, its dependencies, its action key, and whether it is eligible for the cache.
mitts explain [OPTIONS]
Examples
mitts explainHuman-readable plan.mitts explain --jsonThe same as JSON, for scripts.mitts explain --keys keys-before.jsonSave every unit's key. Check out another commit, save again, and diff to see exactly which units changed.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
-p, --package <PACKAGES> | Packages to explain (repeat for multiple packages) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
-r, --release | Check release mode profile Use the release profile (optimisations). Outputs go under |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--json | Output explanation in JSON format Machine-readable output. |
--keys <FILE> | Write derived compilation unit ActionKeys (JSON) to a file Write the derived action key of every unit to a JSON file. Diff two files to see which units changed key between two commits. |
It is the tool to answer "why did this rebuild?": the key of a unit changes only when one of the inputs listed under Action keys changed.
mitts metadata Inspect
Print the package and dependency graph for the active build units as JSON (format version 1): packages, workspace members, resolve.root, resolve.nodes, dependency kinds and selected features.
mitts metadata [OPTIONS]
Examples
mitts metadata --filter-platform x86_64-unknown-linux-gnuOnly dependencies active on that target.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
-p, --package <PACKAGE> | Package whose dependency graph should be selected Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
-F, --features <FEATURES>... | Space or comma separated list of features to activate Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--no-default-features | Do not activate the default feature Do not enable the package's |
--all-features | Activate all available features Enable every feature of the selected packages. |
--filter-platform <FILTER_PLATFORM> | Filter dependencies for a target triple Keep only dependencies active for this target triple. |
--locked | Require an existing compatible Cargo.lock Fail if |
--offline | Resolve using local index and source data only No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Combine locked and offline resolution
|
--format-version <FORMAT_VERSION> | Metadata JSON format version [default: 1] Metadata JSON format version. Only |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and source cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--no-deps | Output information only about the workspace members and don't fetch dependencies |
-q, --quiet | Do not print Mitts log messages Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
-v, --verbose... | Use verbose output Print more. |
Format 1 includes packages, workspace members, resolve.root, resolve.nodes, dependency kinds, and selected features. The graph describes active native build units for the requested platform and features.
mitts fetch Inspect
Download and unpack dependencies into the machine-wide source store, without building.
mitts fetch [OPTIONS]
Examples
mitts fetch --lockedFetch exactly whatCargo.locksays.mitts fetch --offlineCheck that everything is already local.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--cache-dir <CACHE_DIR> | Directory for the global source store Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--offline | Run in offline mode without network access No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--locked | Require Cargo.lock and cache to be up to date Fail if |
--frozen | Require Cargo.lock to be unchanged
|
--target <TARGET> | Fetch only what a build for this target triple uses (repeatable); without it, every package in Cargo.lock Select a target triple. Outputs go under |
-q, --quiet | Do not print Mitts log messages Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
-v, --verbose... | Use verbose output Print more. |
Release
mitts package Release
Create the .crate source archive and verify it by building the extracted package. Git packages need a clean repository with the package at its root.
mitts package [OPTIONS]
Examples
mitts package --lockedPackage and verify.mitts package --no-verifyPackage only.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to the package manifest (default: the nearest Cargo.toml here or in a parent) Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--target-dir <TARGET_DIR> | Output directory for the crate archive Where this workspace's outputs go. Overrides |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--cache-dir <CACHE_DIR> | Shared Mitts cache for verification builds Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--locked | Require an existing compatible lockfile Fail if |
--offline | Resolve using local data only No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Combine locked and offline resolution
|
--no-verify | Skip building the extracted package Skip the verification build of the extracted package. |
-p, --package <SPEC> | Package(s) to assemble Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
--workspace | Assemble all packages in the workspace [alias: --all] Every member of the workspace (alias |
--exclude <SPEC> | Don't assemble specified packages Leave these workspace members out (used with |
-l, --list | Print files included in a package without making one |
--allow-dirty | Allow dirty working directories to be packaged |
--no-metadata | Ignore warnings about a lack of human-usable metadata |
--exclude-lockfile | Don't include the lock file when packaging (unstable in Cargo) |
-F, --features <FEATURES>... | Space or comma separated list of features to activate (verification build) Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-default-features | Do not activate the default feature Do not enable the package's |
--target <TARGET> | Build for the target triple (verification build) Select a target triple. Outputs go under |
-j, --jobs <N> | Number of parallel jobs Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
--keep-going | Do not abort the build as soon as there is an error |
--registry <REGISTRY> | Registry to package for / publish to |
--index <INDEX> | Registry index URL to package for / publish to |
--message-format <FMT> | Output representation (unstable in Cargo) How diagnostics are printed: |
-q, --quiet | Do not print Mitts log messages Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
-v, --verbose... | Use verbose output Print more. |
Git packages currently require a clean repository with the package at its root. Include/exclude patterns are supported; include can select ignored files. Nested workspace packages and symlinked directories are not yet supported.
mitts publish Release
Publish to crates.io using CARGO_REGISTRY_TOKEN. The default creates and verifies the package; --archive uploads one prepared earlier.
mitts publish [OPTIONS]
Examples
mitts publish --dry-runEverything except the upload.mitts publish --archive target/package/name-1.0.0.crateUpload a prepared archive.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to the package manifest (default: the nearest Cargo.toml here or in a parent) Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--target-dir <TARGET_DIR> | Output directory for the crate archive Where this workspace's outputs go. Overrides |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--cache-dir <CACHE_DIR> | Shared Mitts cache for verification builds Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--locked | Require an existing compatible lockfile Fail if |
--offline | Resolve using local data only No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Combine locked and offline resolution
|
--no-verify | Skip building the extracted package Skip the verification build of the extracted package. |
-p, --package <SPEC> | Package(s) to assemble Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
--workspace | Assemble all packages in the workspace [alias: --all] Every member of the workspace (alias |
--exclude <SPEC> | Don't assemble specified packages Leave these workspace members out (used with |
-l, --list | Print files included in a package without making one |
--allow-dirty | Allow dirty working directories to be packaged |
--no-metadata | Ignore warnings about a lack of human-usable metadata |
--exclude-lockfile | Don't include the lock file when packaging (unstable in Cargo) |
-F, --features <FEATURES>... | Space or comma separated list of features to activate (verification build) Features to enable, space or comma separated. Features are part of the action key, so two feature sets of the same crate are two cached units and never overwrite each other. Example: |
--all-features | Activate all available features Enable every feature of the selected packages. |
--no-default-features | Do not activate the default feature Do not enable the package's |
--target <TARGET> | Build for the target triple (verification build) Select a target triple. Outputs go under |
-j, --jobs <N> | Number of parallel jobs Caps how many compilation units run at once. Without it Mitts uses every core, shared with other Mitts processes through the machine-wide jobserver. Lower it on a busy laptop or a small CI runner. |
--keep-going | Do not abort the build as soon as there is an error |
--registry <REGISTRY> | Registry to package for / publish to |
--index <INDEX> | Registry index URL to package for / publish to |
--message-format <FMT> | Output representation (unstable in Cargo) How diagnostics are printed: |
-q, --quiet | Do not print Mitts log messages Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
-v, --verbose... | Use verbose output Print more. |
-n, --dry-run | Prepare the package without uploading it Build and verify the package, print what would be uploaded, upload nothing. |
--archive <ARCHIVE> | Publish a previously prepared crate archive Publish a crate archive prepared earlier (by |
--token <TOKEN> | Token to use when uploading |
Publishes to crates.io using CARGO_REGISTRY_TOKEN. The default operation creates and verifies a package; --archive accepts a previously prepared archive.
Cache
mitts gc Cache
Prune the shared store by size and by age: old versions of tests and binaries first, then the least recently used. While a build runs, what it may still use is kept. The store also prunes itself past its size limit (default 100 GiB); use this command to prune on demand.
mitts gc [OPTIONS]
Examples
mitts gc --max-bytes 20000000000Shrink the store to about 20 GB.mitts gc --max-age-secs 2592000Drop objects older than 30 days.
Options
| Option | What it does |
|---|---|
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--max-bytes <MAX_BYTES> | Maximum cache size in bytes (old test/binary versions first, then least recently used) Prune until the store is under this many bytes (old test and binary versions first, then least recently used). |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
--max-age-secs <MAX_AGE_SECS> | Prune CAS objects older than specified seconds Prune objects older than this many seconds. |
mitts clean Cache
Remove this workspace's generated outputs and its fast build lock. The shared store is untouched unless --cache is given.
mitts clean [OPTIONS]
Examples
mitts cleanEmpty this workspace's outputs; the next build restores from the store.mitts clean --releaseOnly release outputs.
Options
| Option | What it does |
|---|---|
--color <WHEN> | Coloring of Mitts' output: auto, always or never (default: CARGO_TERM_COLOR, else auto) [possible values: auto, always, never] |
--manifest-path <MANIFEST_PATH> | Path to Cargo.toml Use a Cargo.toml other than the one in the current directory. The workspace root is found from it. Example: |
--target-dir <TARGET_DIR> | Directory for all generated artifacts Where this workspace's outputs go. Overrides |
-Z <FLAG> | Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS |
-r, --release | Clean release artifacts only Use the release profile (optimisations). Outputs go under |
--cache | Clean the shared global artifact and action cache as well Also empty the shared store, not only this workspace. Affects every project on the machine. |
--cache-dir <CACHE_DIR> | Directory for the shared artifact and action cache Use this directory as the root of every store (objects, action cache, sources, index, locks). Equivalent to |
-p, --package <SPEC> | Package to clean artifacts for (repeatable) Select workspace members by name. Repeat it for several. Without it Mitts builds the package in the current directory (or the root package). Example: |
--workspace | Clean artifacts of the workspace members only Every member of the workspace (alias |
--doc | Whether or not to clean just the documentation directory |
-n, --dry-run | Display what would be deleted without deleting anything Build and verify the package, print what would be uploaded, upload nothing. |
--profile <PROFILE-NAME> | Clean artifacts of the specified profile |
--target <TARGET> | Target triple to clean output for Select a target triple. Outputs go under |
-q, --quiet | Do not print Mitts log messages Suppress Mitts' own progress, banners and summaries. Errors, diagnostics and the program's output stay, and the exit code is unchanged. |
-v, --verbose... | Use verbose output Print more. |
--locked | Require Cargo.lock is up to date (accepted for Cargo compatibility) Fail if |
--offline | Run without accessing the network (accepted for Cargo compatibility) No network. Resolution and fetching use only what is already in the local index and source store. Fails when something is missing. |
--frozen | Equivalent to specifying both --locked and --offline
|
Environment variables
Flags always win over variables. The diagnostic variables change how the work is done, never what is cached.
| Variable | Value | Meaning and example |
|---|---|---|
MITTS_JOBS | N | Limit concurrent build units. -j wins.
|
MITTS_CACHE_DIR | path | Root of every store. --cache-dir wins; default $XDG_CACHE_HOME/mitts or ~/.cache/mitts.
|
MITTS_CACHE_MAX_BYTES | size | off | Size limit that triggers automatic pruning. Suffixes K, M, G, T; off or 0 disables. Default 100 GiB.
|
MITTS_GC_INTERVAL_SECS | N | Least time between two size checks (the check scans the store). Default 3600.
|
MITTS_TIMINGS | 1 | Print sub-millisecond phase timings ([mitts::phases]) and I/O byte and file counters ([mitts::io]) on stderr.
|
MITTS_FAST_LOCK | 0 | 1 | The no-op fast path. Default: on only for the default cache root; 1 forces it with --cache-dir.
|
MITTS_STORE_HARDLINKS | 0 | 1 | How a store object reaches target/. Default: reflink where possible, else a read-only hardlink. 0 copies; 1 prefers links everywhere.
|
MITTS_NO_REFLINK | 1 | Disable copy-on-write cloning (FICLONE / clonefile). Objects then arrive as read-only hardlinks; add MITTS_STORE_HARDLINKS=0 to force real byte copies. For measurement.
|
MITTS_NO_HARDLINK | 1 | Disable the hardlinks between files inside one workspace (libfoo-<hash>.rlib to libfoo.rlib).
|
MITTS_VERIFY_RESTORE | 1 | Re-hash every object before restoring it. One read of every restored byte; for audits and suspect disks.
|
MITTS_CACHE_IO_BUDGET | N | How many workers may read the cache at once. 0 unbounded. Default 1 on macOS, unbounded elsewhere.
|
MITTS_INDEX_TTL_SECS | N | How long cached sparse-index entries are trusted while online. Default 900. Offline, the cached copy always serves.
|
MITTS_NET_RETRY | N | How many times a registry download is retried after a network error, 408, 429 or 5xx, waiting 1, 3 and 5 seconds. Default 3; 0 disables retries. Like Cargo's net.retry.
|
MITTS_NET_RETRY_DELAY_MS | N | Length of one retry delay step in milliseconds (the waits are 1, 3 and 5 steps). Default 1000.
|
MITTS_GIT | path | The git binary used to clone git dependencies. Default: git on PATH. Authentication is git's own; prompts are disabled so a missing credential fails fast.
|
MITTS_RUSTC_WRAPPER_CACHE | 1 | Cache builds that use a RUSTC_WRAPPER other than sccache. The wrapper's path, canonical path, executable SHA-256 and the salt go into every key; a wrapper that cannot be resolved fails closed. Without it such builds are not cached and Mitts warns.
|
MITTS_RUSTC_WRAPPER_SALT | text | Extra text mixed into the keys together with the wrapper. Change it when the wrapper's behaviour depends on something that is not in its executable.
|
MITTS_VERBOSE | 1 | 2 | The verbosity when no -v is given: 1 is -v (every rustc and build-script command, units restored from the cache, the compiler path, the slowest units), 2 is -vv (also the commands' environment and the build scripts' output).
|
MITTS_SLOW_UNITS | duration | off | A rustc or build-script process still running after this long (default 5m; 30s, 10m, 1h30m) is reported with its phase (for a library built as an rlib: still in the front end, or how long the front end took and how long code generation has run), its codegen settings and command, then again without the command at every further multiple; the summary names the slowest units. --slow-units=DURATION wins over it; off turns the reports off. The progress line always shows the running units and their times.
|
MITTS_LINK_TIMING | 0 | Turns link timing off. Otherwise, when rustc links a unit of the host target (a binary, test, example, bench or shared library; not a proc macro or build script) with a cc-style driver (cc, gcc, clang and their C++ forms), Mitts runs that driver for rustc, and the build summary names the linker with its version and the link time, no -v needed. Nothing is timed when nothing is linked (rlib libraries only, check, clippy, everything restored from the cache), on Windows, or when RUSTFLAGS picks the linker.
|
RUSTUP_TOOLCHAIN | name | The rustup toolchain to build with; mitts +nightly build sets it for one command, like cargo +nightly build. The toolchain is part of every key, so nightly and stable builds never share entries.
|
MITTS_LOG_COMPILE | 1 | Log each compile action and every build-script hit or miss with its key, and the inputs of the build-script key.
|
MITTS_LOG_KEYS | any | Log the inputs of every unit key, and units whose key had to use an absolute manifest directory. For finding out why a unit missed the cache.
|
MITTS_STATS | json | Print one JSON line on stderr after the build: units compiled, cached, tainted, total, and whether the fast path served it.
|
MITTS_CRATES_IO_URL | url | Where .crate archives are downloaded from. Default https://static.crates.io/crates. For a mirror or an offline proxy.
|
MITTS_SPARSE_INDEX_URL | url | The sparse registry index used for crates.io. For a mirror.
|
MITTS_LLVM_COV | path | The llvm-cov binary used by mitts coverage, instead of the automatic lookup.
|
MITTS_LLVM_PROFDATA | path | The llvm-profdata binary used by mitts coverage, instead of the automatic lookup.
|
MITTS_VERSION | vX.Y.Z | Installer. Release to install instead of the latest. Pinning skips the latest-release lookup.
|
MITTS_INSTALL_ROOT | path | Installer. The binary goes to <root>/bin. Falls back to CARGO_INSTALL_ROOT, then CARGO_HOME, then ~/.cargo.
|
MITTS_NO_SOURCE_FALLBACK | 1 | Installer. Without it, when GitHub is unreachable or the platform has no prebuilt binary, the installer builds from crates.io with Cargo if Cargo is installed. Set it to fail instead (for CI).
|
CARGO_TARGET_DIR | path | Workspace output root when --target-dir is not given.
|
CARGO_BUILD_TARGET_DIR | path | Output root when neither --target-dir nor CARGO_TARGET_DIR is set; wins over build.target-dir in .cargo/config.toml.
|
CARGO_TERM_COLOR | auto | always | never | Coloring of Mitts' output when --color is not given.
|
CARGO_REGISTRY_TOKEN | token | Token used by mitts publish.
|
Output formats
--message-format on build, check, clippy, test, bench and run selects how diagnostics are printed. Cached runs replay diagnostics in exactly the requested format; each format has its own cache entries.
| Value | Output |
|---|---|
human (default) | Progress, banners and rendered multi-line diagnostics. |
short | One line per diagnostic, file:line:col: level: message, on stderr; no banners. |
json | Cargo-compatible JSON lines on stdout. Nothing else is printed there while compiling. |
json-diagnostic-short | JSON lines whose message.rendered is the short single-line text. |
json-diagnostic-rendered-ansi | JSON lines whose message.rendered keeps ANSI colour escapes. |
json-render-diagnostics | No compiler-message records on stdout; diagnostics render to stderr; build-finished is still emitted. |
Cargo's comma-separated modifiers work (json,json-diagnostic-short). Conflicting combinations such as human,json, or unknown values, are rejected with exit code 2.
The JSON stream
Each stdout line is one object with a reason. compiler-message appears once per diagnostic, in the order units finish; build-finished closes the stream with success false if any unit failed. The exit code matches human mode.
{"reason":"compiler-message","package_id":"demo@0.1.0","target":{"kind":["lib"],"name":"demo"},
"message":{"level":"error","code":{"code":"E0308"},"rendered":"..."}}
{"reason":"build-finished","success":false}
Quiet mode
-q / --quiet removes Mitts' banners, progress bars and stat lines. In mitts test -q libtest receives -q, failures and the final test result line remain. In mitts test -c -q the PASS lines go, FAIL output and the Summary line stay.
Configuration
Mitts has no configuration file of its own. It follows Cargo's, with one different default, and has one project-level table.
- Debug info: line tables by default
- When nothing sets
debug,devandtestbuilds get-C debuginfo=line-tables-only, not Cargo's full debug info. Panic backtraces still show file and line (on macOS not yet for the workspace's own crates, with any setting: Apple's linker leaves their objects out of the debug map; a fix is planned); what is left out are the variables and types a debugger (gdb, lldb, an IDE) reads, which made up about 90% of a large test binary we measured. Binaries and the cache get several times smaller. To debug with variables, set it back, for one project, for every project of a user, or for one run:
Any explicit# Cargo.toml, or ~/.cargo/config.toml for every project [profile.dev] debug = true # one run CARGO_PROFILE_DEV_DEBUG=true mitts builddebugis passed to rustc as written, the same as in Cargo. - Cache location
--cache-dir, thenMITTS_CACHE_DIR, then$XDG_CACHE_HOME/mitts, then~/.cache/mitts.- Impure proc macros
- Proc macros are pure by default. List the ones that read package files or the package path while expanding, in the root manifest:
Their direct dependents are then keyed on the whole package tree and on the absolute path, so an edited template invalidates them and a second checkout rebuilds them.[workspace.metadata.mitts] impure-proc-macros = ["sqlx-macros", "askama_derive", "rust-embed-impl"] - Registries and mirrors
[registries.<name>] index,[source.<name>] registry | directory | gitandreplace-withare read from Cargo's config chain, as are vendored directories and[patch]. Tokens come from Cargo's credential providers:cargo:token(CARGO_REGISTRIES_<NAME>_TOKENorcredentials.toml),cargo:macos-keychain,cargo:libsecret,cargo:token-from-stdout, and plugins.[env]tables- Merged over the config chain (the closer file wins).
force = falsekeeps a variable the environment already has;relative = truejoins the value to the parent of the config's.cargo. Applied to compiler runs, build scripts and programs started bymitts runandmitts test. Config files are part of the package inputs, so a change invalidates the units that read it. - Git dependencies
- Cloned with the system
git(MITTS_GIT) into<cache>/git: a bare mirror underdb/and one checkout per locked commit. Authentication is git's own (SSH agent, credential helpers). - Compiler wrappers
- See Compiler wrappers: any wrapper except
sccachedisables caching by default, unlessMITTS_RUSTC_WRAPPER_CACHE=1is set.
GitHub Actions
Two small composite actions install a verified release and keep the build cache between runs.
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: alex09x/mitts@v0.5.9
- run: mitts test
- uses: alex09x/mitts/save@v0.5.9
if: always()
Pin the action to a release tag or a full commit SHA. The setup action installs the release you ask for with the installer that ships in the same ref, and the installer checks the archive against the published SHA-256 sums.
What gets cached
The whole Mitts cache directory (store and action cache, by default ~/.cache/mitts), and nothing else: the Cargo registry and target/ do not need restoring. The key is mitts-v1, the runner OS and architecture, the Mitts version, your cache-key text and a hash of every Cargo.lock. On a miss the newest cache with the same prefix is restored, so a changed dependency set rebuilds only what changed.
Setup action: alex09x/mitts
| Input | Default | Meaning |
|---|---|---|
version | latest stable | Release to install, vX.Y.Z or X.Y.Z. |
cache | true | Restore the cache. false only installs. |
cache-key | empty | Extra text in the key, for example a job name, when jobs build different things. |
cache-dir | platform default | Cache root. When empty: MITTS_CACHE_DIR, XDG_CACHE_HOME/mitts, ~/.cache/mitts. |
Outputs: version, cache-dir (also exported as MITTS_CACHE_DIR for the rest of the job) and cache-hit (true when the exact key was restored).
Save action: alex09x/mitts/save
Runs mitts gc to bound the store, then saves it; nothing is saved after an exact hit. max-bytes (default 2 GiB) is the size the store is pruned to first, oldest objects first. Use if: always() to keep the work of a failed build, and run it after the setup action in the same job.
Runners: Linux x86-64 and ARM64, macOS on Apple Silicon. A Rust toolchain and a native linker must already be present. GitHub keeps 10 GB of caches per repository; lower max-bytes when workflows share that budget.