mitts/build

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

  1. Build. From any Cargo workspace:
    cd your-workspace
    mitts build
    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.
  2. Build again. Nothing changed, so Mitts returns almost immediately (the no-op fast path).
  3. Make a second checkout and build it.
    git worktree add ../your-workspace-2 HEAD
    cd ../your-workspace-2
    mitts build
    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, unless MITTS_SHARE_WORKSPACE_CRATES=1 is set. See what a second checkout reuses and the worktree guide.
  4. 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
  5. 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.

  1. 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.
  2. 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.
  3. 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.
  4. Cargo stays the contract. Cargo.toml and Cargo.lock are read as they are. Mitts never writes a lockfile of its own. Outputs go to Cargo's usual target/debug and target/release, and Mitts records the files it put there so mitts clean removes 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.

project-a/targetworkspace (mutable) project-a worktree 2another checkout, same code project-b/targetother project, same serde ~/.cache/mitts (one per machine) ac/manifestsaction key → list of output objects cas/objects/<sha256>immutable, read-only (0444) sources/ · index/ · locks/ · jobserver/unpacked crates, registry index, single-flight locks restorerestorerestore
  • 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).

PhaseWhat happens
resolveReuse 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.
fetchDownload missing .crate archives in parallel, verify each SHA-256 against Cargo.lock, unpack once per machine into sources/.
planBuild the compilation units (library, binary, test, build script, proc macro) with features, targets and dependency edges, using Cargo's resolver rules.
keyDerive one action key per unit, in topological order.
executeRun the unit graph in parallel: restore hits, compile misses.
publishStore 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 triple · profile flags (in invocation order) features (sorted) sources: (path, content hash) dependency action keys tracked env: CARGO_*, RUSTFLAGS, env!() SHA-256canonical text action keyone per 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.toml and clippy.toml, and root files including build.rs. Unit inputs are the src/ tree for libraries and binaries, and only the declared src_path for 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, HOST and PROFILE enter the flags. Variables a crate reads through env! or option_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_DIR at compile time through env! or option_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 key hitrestore to target/ misstake the key lock, look again rustc publishtmp, 0444, rename
  1. Look up the action key in the action cache.
  2. 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.
  3. 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.
  4. Publish. Copy each output into cas/tmp/, mark it read-only, then rename it into objects/. 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.
  • rustc is pipelined: dependents start from the .rmeta as soon as metadata is ready, before the .rlib is 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-auth from a parent build is respected. -j N or MITTS_JOBS=N lowers 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, ...), its OUT_DIR, and the evidence it declared: content hashes of rerun-if-changed paths and values of rerun-if-env-changed variables.
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_BYTES sets the limit (500M, 2G, or off / 0); the default is 100 GiB. MITTS_GC_INTERVAL_SECS is 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. Leftover tmp files older than one hour go too.
  • mitts gc --max-bytes N --max-age-secs S prunes on demand.
  • A build with --no-cache uses a private cas-ephemeral-<id> store, removed by the next build or by mitts gc after 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/debug and target/release layout as Cargo (honouring CARGO_TARGET_DIR and --target-dir); its own lock and file index live under target/mitts/.
  • mitts build --cargo delegates 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.members means 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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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 (opt-level, codegen-units, lto). For a library built as an rlib (rustc writes its .rmeta) the line also splits the front end (parsing, macros, type checking) from code generation; cdylib, staticlib and dylib units and check/clippy runs have no split. A shorter reminder without the command follows at each further multiple of the threshold, and a finished in line when the unit ends. Default 5m; off disables it. MITTS_SLOW_UNITS does the same; the flag wins.

--ignore-rust-versionBuild even when a package's rust-version is newer than the rustc in use
--future-incompat-reportPrint 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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

-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: mitts build -p api -p worker.

-r, --releaseBuild artifacts in release mode, with optimizations

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

--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 $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-cacheDo 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--lockedRequire an existing compatible Cargo.lock; do not resolve or write one

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineDo 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.

--frozenRequire a compatible Cargo.lock and use only locally available sources

--locked and --offline together.

--target <TARGET>Select target triple; outputs go under target/<triple>

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

--example <EXAMPLE>Build a named example target (repeatable; output under target/<profile>/examples)

Build a named example. Repeat for several. Output is under target/<profile>/examples.

--examplesBuild all example targets
--bench <NAME>Build the named benchmark target (repeatable)
--benchesBuild all benchmark targets
--keep-goingDo not stop at the first failed unit: skip what depends on it, build the rest, fail at the end
-q, --quietSuppress 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: human (default), short (one line per diagnostic), json (Cargo-compatible JSON lines on stdout) and the json-* variants. See Output formats.

--crate-type <CRATE_TYPES>Override library crate types (for example, staticlib; use with --lib)

Override the library's crate types, for example staticlib. Use it with --lib.

--nativeForce native rustc DAG compilation (zero intermediate target bloat)

Force Mitts' own rustc graph executor (the default path).

--cargoForce 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--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 cargo --config does: a TOML KEY=VALUE or a TOML file. Repeat it for several. Example: mitts build --release --config 'profile.release.lto="thin"' --config profile.release.codegen-units=16.

--exclude <SPEC>Exclude packages from being built

Leave these workspace members out (used with --workspace).

--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.

--binsBuild all binary targets

Select every binary target.

--libBuild only this package's library

Select only the library.

--workspaceBuild all packages in the workspace [alias: --all]

Every member of the workspace (alias --all).

--test <NAME>Build the named test target without running it (repeatable)
--testsBuild all test targets without running them
--all-targetsBuild 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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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 (opt-level, codegen-units, lto). For a library built as an rlib (rustc writes its .rmeta) the line also splits the front end (parsing, macros, type checking) from code generation; cdylib, staticlib and dylib units and check/clippy runs have no split. A shorter reminder without the command follows at each further multiple of the threshold, and a finished in line when the unit ends. Default 5m; off disables it. MITTS_SLOW_UNITS does the same; the flag wins.

--ignore-rust-versionBuild even when a package's rust-version is newer than the rustc in use
--future-incompat-reportPrint 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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

--message-format <FMT>Diagnostic output format: human, short, json, or Cargo json-* variants [default: human]

How diagnostics are printed: human (default), short (one line per diagnostic), json (Cargo-compatible JSON lines on stdout) and the json-* variants. See Output formats.

-q, --quietSuppress 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: mitts build -p api -p worker.

-r, --releaseCheck artifacts in release mode

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

--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 $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-cacheDo 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--target <TARGET>Select target triple for cross-compilation

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

--lockedRequire an existing compatible Cargo.lock; do not resolve or write one

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineDo 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.

--frozenRequire a compatible Cargo.lock and use only locally available sources

--locked and --offline together.

-v, --verbose...-v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output

Print more. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--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 cargo --config does: a TOML KEY=VALUE or a TOML file. Repeat it for several. Example: mitts build --release --config 'profile.release.lto="thin"' --config profile.release.codegen-units=16.

--exclude <SPEC>Exclude packages from being checked

Leave these workspace members out (used with --workspace).

--workspaceCheck all packages in the workspace [alias: --all]

Every member of the workspace (alias --all).

--libCheck 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.

--binsCheck all binaries

Select every binary target.

--test <NAME>Check the named test target (repeatable; combines with --bin)
--testsCheck 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 target/<profile>/examples.

--examplesCheck all examples
--bench <NAME>Check the named benchmark target (repeatable; combines with other target selectors)
--benchesCheck all benchmarks
--all-targetsCheck all targets
--keep-goingDo 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 warnings to Clippy: any warning fails the command (exit code 101).

Options

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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 (opt-level, codegen-units, lto). For a library built as an rlib (rustc writes its .rmeta) the line also splits the front end (parsing, macros, type checking) from code generation; cdylib, staticlib and dylib units and check/clippy runs have no split. A shorter reminder without the command follows at each further multiple of the threshold, and a finished in line when the unit ends. Default 5m; off disables it. MITTS_SLOW_UNITS does the same; the flag wins.

--ignore-rust-versionBuild even when a package's rust-version is newer than the rustc in use
--future-incompat-reportPrint 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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

--message-format <FMT>Diagnostic output format: human, short, json, or Cargo json-* variants [default: human]

How diagnostics are printed: human (default), short (one line per diagnostic), json (Cargo-compatible JSON lines on stdout) and the json-* variants. See Output formats.

-q, --quietSuppress 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: mitts build -p api -p worker.

-r, --releaseLint artifacts in release mode

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

--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 $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-cacheDo 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--target <TARGET>Select target triple for cross-compilation

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

--lockedRequire an existing compatible Cargo.lock; do not resolve or write one

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineDo 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.

--frozenRequire a compatible Cargo.lock and use only locally available sources

--locked and --offline together.

-v, --verbose...-v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output

Print more. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--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 cargo --config does: a TOML KEY=VALUE or a TOML file. Repeat it for several. Example: mitts build --release --config 'profile.release.lto="thin"' --config profile.release.codegen-units=16.

--exclude <SPEC>Exclude packages from being linted

Leave these workspace members out (used with --workspace).

--workspaceLint all packages in the workspace [alias: --all]

Every member of the workspace (alias --all).

--libLint 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.

--binsLint all binaries

Select every binary target.

--test <NAME>Lint the named test target (repeatable; combines with --bin)
--testsLint 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 target/<profile>/examples.

--examplesLint all examples
--bench <NAME>Lint the named benchmark target (repeatable; combines with other target selectors)
--benchesLint all benchmarks
--all-targetsLint all targets
--keep-goingDo 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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

-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: mitts build -p api -p worker.

-Z <FLAG>Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS
--checkRun in 'check' mode to exit with an error if files are unformatted

Do not rewrite files; exit non-zero if any would change.

--allFormat all packages in the workspace

Every package in the workspace.

-v, --verbose...Use verbose output

Passed on to rustfmt as -v.

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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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)

mitts rustc runs quietly, so no slow-unit lines are printed.

--ignore-rust-versionBuild even when a package's rust-version is newer than the rustc in use
--future-incompat-reportPrint 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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

-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: mitts build -p api -p worker.

-r, --releaseBuild artifacts in release mode, with optimizations

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

--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 $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-cacheDo 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--lockedRequire an existing compatible Cargo.lock; do not resolve or write one

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineDo 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.

--frozenRequire a compatible Cargo.lock and use only locally available sources

--locked and --offline together.

--target <TARGET>Select target triple; outputs go under target/<triple>

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

--example <EXAMPLE>Build a named example target (repeatable; output under target/<profile>/examples)

Build a named example. Repeat for several. Output is under target/<profile>/examples.

--examplesBuild all example targets
--bench <NAME>Build the named benchmark target (repeatable)
--benchesBuild all benchmark targets
--keep-goingDo not stop at the first failed unit: skip what depends on it, build the rest, fail at the end
-q, --quietSuppress 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: human (default), short (one line per diagnostic), json (Cargo-compatible JSON lines on stdout) and the json-* variants. See Output formats.

--crate-type <CRATE_TYPES>Override library crate types (for example, staticlib; use with --lib)

Override the library's crate types, for example staticlib. Use it with --lib.

--nativeForce native rustc DAG compilation (zero intermediate target bloat)

Force Mitts' own rustc graph executor (the default path).

--cargoForce 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--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 cargo --config does: a TOML KEY=VALUE or a TOML file. Repeat it for several. Example: mitts build --release --config 'profile.release.lto="thin"' --config profile.release.codegen-units=16.

--exclude <SPEC>Exclude packages from being built

Leave these workspace members out (used with --workspace).

--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.

--binsBuild all binary targets

Select every binary target.

--libBuild only this package's library

Select only the library.

--workspaceBuild all packages in the workspace [alias: --all]

Every member of the workspace (alias --all).

--test <NAME>Build the named test target without running it (repeatable)
--testsBuild all test targets without running them
--all-targetsBuild 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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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 (opt-level, codegen-units, lto). For a library built as an rlib (rustc writes its .rmeta) the line also splits the front end (parsing, macros, type checking) from code generation; cdylib, staticlib and dylib units and check/clippy runs have no split. A shorter reminder without the command follows at each further multiple of the threshold, and a finished in line when the unit ends. Default 5m; off disables it. MITTS_SLOW_UNITS does the same; the flag wins.

--ignore-rust-versionBuild even when a package's rust-version is newer than the rustc in use
--future-incompat-reportPrint 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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

-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: mitts build -p api -p worker.

-r, --releaseBuild artifacts in release mode, with optimizations

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

--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 $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-cacheDo 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--lockedRequire an existing compatible Cargo.lock; do not resolve or write one

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineDo 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.

--frozenRequire a compatible Cargo.lock and use only locally available sources

--locked and --offline together.

--target <TARGET>Select target triple; outputs go under target/<triple>

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

--example <EXAMPLE>Build a named example target (repeatable; output under target/<profile>/examples)

Build a named example. Repeat for several. Output is under target/<profile>/examples.

--examplesBuild all example targets
--bench <NAME>Build the named benchmark target (repeatable)
--benchesBuild all benchmark targets
--keep-goingDo not stop at the first failed unit: skip what depends on it, build the rest, fail at the end
-q, --quietSuppress 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: human (default), short (one line per diagnostic), json (Cargo-compatible JSON lines on stdout) and the json-* variants. See Output formats.

--crate-type <CRATE_TYPES>Override library crate types (for example, staticlib; use with --lib)

Override the library's crate types, for example staticlib. Use it with --lib.

--nativeForce native rustc DAG compilation (zero intermediate target bloat)

Force Mitts' own rustc graph executor (the default path).

--cargoForce 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--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 cargo --config does: a TOML KEY=VALUE or a TOML file. Repeat it for several. Example: mitts build --release --config 'profile.release.lto="thin"' --config profile.release.codegen-units=16.

--exclude <SPEC>Exclude packages from being built

Leave these workspace members out (used with --workspace).

--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.

--binsBuild all binary targets

Select every binary target.

--libBuild only this package's library

Select only the library.

--workspaceBuild all packages in the workspace [alias: --all]

Every member of the workspace (alias --all).

--test <NAME>Build the named test target without running it (repeatable)
--testsBuild all test targets without running them
--all-targetsBuild 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 contains parse_.
  • 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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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 (opt-level, codegen-units, lto). For a library built as an rlib (rustc writes its .rmeta) the line also splits the front end (parsing, macros, type checking) from code generation; cdylib, staticlib and dylib units and check/clippy runs have no split. A shorter reminder without the command follows at each further multiple of the threshold, and a finished in line when the unit ends. Default 5m; off disables it. MITTS_SLOW_UNITS does the same; the flag wins.

--ignore-rust-versionBuild even when a package's rust-version is newer than the rustc in use
--future-incompat-reportPrint 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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

-q, --quietSuppress 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: human (default), short (one line per diagnostic), json (Cargo-compatible JSON lines on stdout) and the json-* variants. See Output formats.

-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: mitts build -p api -p worker.

--workspaceTest all packages in the workspace [alias: --all]

Every member of the workspace (alias --all).

--exclude <SPEC>Exclude packages from being tested

Leave these workspace members out (used with --workspace).

-r, --releaseBuild and run tests in release mode

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

--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 $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-cacheDo 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--target <TARGET>Select target triple for cross-compilation

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

--lockedRequire an existing compatible Cargo.lock; do not resolve or write one

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineDo 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.

--frozenRequire a compatible Cargo.lock and use only locally available sources

--locked and --offline together.

--no-runCompile, 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.

--coverageCollect 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--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 cargo --config does: a TOML KEY=VALUE or a TOML file. Repeat it for several. Example: mitts build --release --config 'profile.release.lto="thin"' --config profile.release.codegen-units=16.

--no-fail-fastRun 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)
--testsTest all integration test targets
--benchesTest all benchmarks
--keep-goingKeep 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-targetsTest 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.

--binsTest all binary targets

Select every binary target.

--libTest only this package's library unit tests

Select only the library.

--docTest 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 -c uses all cores, -c=8 uses 8. The = is required; mitts test -c quick filters on quick. See mitts test.

--nocaptureRun tests without capturing output (equivalent to -- --nocapture)

Show test output as it happens instead of only on failure.

--exactRequire exact test-name matches; pass before --, with filters after it

Match test names exactly, not by substring.

--ignoredRun only ignored tests (equivalent to -- --ignored)

Run only #[ignore] tests.

--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 target/<profile>/examples.

--examplesTest 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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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 (opt-level, codegen-units, lto). For a library built as an rlib (rustc writes its .rmeta) the line also splits the front end (parsing, macros, type checking) from code generation; cdylib, staticlib and dylib units and check/clippy runs have no split. A shorter reminder without the command follows at each further multiple of the threshold, and a finished in line when the unit ends. Default 5m; off disables it. MITTS_SLOW_UNITS does the same; the flag wins.

--ignore-rust-versionBuild even when a package's rust-version is newer than the rustc in use
--future-incompat-reportPrint 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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

-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: mitts build -p api -p worker.

-r, --releaseBuild and run tests in release mode

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

-q, --quietSuppress 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-onlyOnly print high-level coverage summary table

Print just the summary table (or, with --json, per-file summaries and totals).

--htmlGenerate HTML coverage report

Write an HTML report to a directory (--output-dir).

--lcovGenerate LCOV coverage report (lcov.info)

Write an LCOV report (lcov.info).

--jsonGenerate JSON coverage report

Machine-readable output.

--textGenerate 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 --html it is a usage error.

--openAutomatically 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 <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 '(tests/|vendored/)' works the same on every OS.

--workspaceBuild all targets in the workspace [alias: --all]

Every member of the workspace (alias --all).

--exclude <SPEC>Exclude packages from being tested

Leave these workspace members out (used with --workspace).

--all-targetsBuild all targets (bins, tests, benches)
--target-dir <TARGET_DIR>Directory for all generated artifacts

Where this workspace's outputs go. Overrides $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-cacheDo 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--target <TARGET>Select target triple for cross-compilation

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

--lockedRequire an existing compatible Cargo.lock; do not resolve or write one

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineDo 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.

--frozenRequire a compatible Cargo.lock and use only locally available sources

--locked and --offline together.

--no-runCompile, 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-fastRun 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)
--testsTest 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.

--binsTest all binary targets

Select every binary target.

--libTest only this package's library unit tests

Select only the library.

--docTest only this package's library documentation
--nocaptureRun tests without capturing output (equivalent to -- --nocapture)

Show test output as it happens instead of only on failure.

--exactRequire exact test-name matches; pass before --, with filters after it

Match test names exactly, not by substring.

--ignoredRun only ignored tests (equivalent to -- --ignored)

Run only #[ignore] tests.

-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 -c uses all cores, -c=8 uses 8. The = is required; mitts test -c quick filters on quick. See mitts test.

-v, --verbose...-v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output

Print more. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--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 cargo --config does: a TOML KEY=VALUE or a TOML file. Repeat it for several. Example: mitts build --release --config 'profile.release.lto="thin"' --config profile.release.codegen-units=16.

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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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 (opt-level, codegen-units, lto). For a library built as an rlib (rustc writes its .rmeta) the line also splits the front end (parsing, macros, type checking) from code generation; cdylib, staticlib and dylib units and check/clippy runs have no split. A shorter reminder without the command follows at each further multiple of the threshold, and a finished in line when the unit ends. Default 5m; off disables it. MITTS_SLOW_UNITS does the same; the flag wins.

--ignore-rust-versionBuild even when a package's rust-version is newer than the rustc in use
--future-incompat-reportPrint 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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

-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: mitts build -p api -p worker.

-r, --releaseBuild and run tests in release mode

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

-q, --quietSuppress 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-onlyOnly print high-level coverage summary table

Print just the summary table (or, with --json, per-file summaries and totals).

--htmlGenerate HTML coverage report

Write an HTML report to a directory (--output-dir).

--lcovGenerate LCOV coverage report (lcov.info)

Write an LCOV report (lcov.info).

--jsonGenerate JSON coverage report

Machine-readable output.

--textGenerate 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 --html it is a usage error.

--openAutomatically 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 <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 '(tests/|vendored/)' works the same on every OS.

--workspaceBuild all targets in the workspace [alias: --all]

Every member of the workspace (alias --all).

--exclude <SPEC>Exclude packages from being tested

Leave these workspace members out (used with --workspace).

--all-targetsBuild all targets (bins, tests, benches)
--target-dir <TARGET_DIR>Directory for all generated artifacts

Where this workspace's outputs go. Overrides $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-cacheDo 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--target <TARGET>Select target triple for cross-compilation

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

--lockedRequire an existing compatible Cargo.lock; do not resolve or write one

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineDo 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.

--frozenRequire a compatible Cargo.lock and use only locally available sources

--locked and --offline together.

--no-runCompile, 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-fastRun 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)
--testsTest 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.

--binsTest all binary targets

Select every binary target.

--libTest only this package's library unit tests

Select only the library.

--docTest only this package's library documentation
--nocaptureRun tests without capturing output (equivalent to -- --nocapture)

Show test output as it happens instead of only on failure.

--exactRequire exact test-name matches; pass before --, with filters after it

Match test names exactly, not by substring.

--ignoredRun only ignored tests (equivalent to -- --ignored)

Run only #[ignore] tests.

-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 -c uses all cores, -c=8 uses 8. The = is required; mitts test -c quick filters on quick. See mitts test.

-v, --verbose...-v: every rustc command, cache hits, compiler path, slowest units; -vv: also their environment and build-script output

Print more. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--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 cargo --config does: a TOML KEY=VALUE or a TOML file. Repeat it for several. Example: mitts build --release --config 'profile.release.lto="thin"' --config profile.release.codegen-units=16.

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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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 (opt-level, codegen-units, lto). For a library built as an rlib (rustc writes its .rmeta) the line also splits the front end (parsing, macros, type checking) from code generation; cdylib, staticlib and dylib units and check/clippy runs have no split. A shorter reminder without the command follows at each further multiple of the threshold, and a finished in line when the unit ends. Default 5m; off disables it. MITTS_SLOW_UNITS does the same; the flag wins.

--ignore-rust-versionBuild even when a package's rust-version is newer than the rustc in use
--future-incompat-reportPrint 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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

-q, --quietSuppress 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: human (default), short (one line per diagnostic), json (Cargo-compatible JSON lines on stdout) and the json-* variants. See Output formats.

-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: mitts build -p api -p worker.

--workspaceBenchmark all packages in the workspace [alias: --all]

Every member of the workspace (alias --all).

--exclude <SPEC>Exclude packages from being benchmarked

Leave these workspace members out (used with --workspace).

--bench <NAME>Benchmark only the named benchmark target (repeatable); default is every benchmark target
--benchesBenchmark all benchmark targets (the default when nothing is selected)
--libBenchmark 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.

--binsBenchmark all binaries

Select every binary target.

--example <NAME>Benchmark only the specified example (repeatable)

Build a named example. Repeat for several. Output is under target/<profile>/examples.

--examplesBenchmark all examples
--test <NAME>Benchmark only the specified test target (repeatable)
--testsBenchmark all targets that have test = true set
--all-targetsBenchmark 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 $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-cacheDo 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--target <TARGET>Select target triple for cross-compilation

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

--lockedRequire an existing compatible Cargo.lock; do not resolve or write one

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineDo 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.

--frozenRequire a compatible Cargo.lock and use only locally available sources

--locked and --offline together.

--no-runCompile 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-fastRun 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--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 cargo --config does: a TOML KEY=VALUE or a TOML file. Repeat it for several. Example: mitts build --release --config 'profile.release.lto="thin"' --config profile.release.codegen-units=16.

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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

-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: mitts build -p api -p worker.

-Z <FLAG>Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS
-r, --releaseCheck release mode profile

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--jsonOutput 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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

-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: mitts build -p api -p worker.

-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: mitts build -F "tls json".

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--all-featuresActivate 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.

--lockedRequire an existing compatible Cargo.lock

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineResolve 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.

--frozenCombine locked and offline resolution

--locked and --offline together.

--format-version <FORMAT_VERSION>Metadata JSON format version [default: 1]

Metadata JSON format version. Only 1 exists.

--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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--no-depsOutput information only about the workspace members and don't fetch dependencies
-q, --quietDo 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

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 what Cargo.lock says.
  • mitts fetch --offlineCheck that everything is already local.

Options

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

-Z <FLAG>Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS
--offlineRun 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.

--lockedRequire Cargo.lock and cache to be up to date

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--frozenRequire Cargo.lock to be unchanged

--locked and --offline together.

--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 target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

-q, --quietDo 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--target-dir <TARGET_DIR>Output directory for the crate archive

Where this workspace's outputs go. Overrides $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--lockedRequire an existing compatible lockfile

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineResolve 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.

--frozenCombine locked and offline resolution

--locked and --offline together.

--no-verifySkip 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: mitts build -p api -p worker.

--workspaceAssemble all packages in the workspace [alias: --all]

Every member of the workspace (alias --all).

--exclude <SPEC>Don't assemble specified packages

Leave these workspace members out (used with --workspace).

-l, --listPrint files included in a package without making one
--allow-dirtyAllow dirty working directories to be packaged
--no-metadataIgnore warnings about a lack of human-usable metadata
--exclude-lockfileDon'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: mitts build -F "tls json".

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--target <TARGET>Build for the target triple (verification build)

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

-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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

--keep-goingDo 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: human (default), short (one line per diagnostic), json (Cargo-compatible JSON lines on stdout) and the json-* variants. See Output formats.

-q, --quietDo 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--target-dir <TARGET_DIR>Output directory for the crate archive

Where this workspace's outputs go. Overrides $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--lockedRequire an existing compatible lockfile

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineResolve 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.

--frozenCombine locked and offline resolution

--locked and --offline together.

--no-verifySkip 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: mitts build -p api -p worker.

--workspaceAssemble all packages in the workspace [alias: --all]

Every member of the workspace (alias --all).

--exclude <SPEC>Don't assemble specified packages

Leave these workspace members out (used with --workspace).

-l, --listPrint files included in a package without making one
--allow-dirtyAllow dirty working directories to be packaged
--no-metadataIgnore warnings about a lack of human-usable metadata
--exclude-lockfileDon'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: mitts build -F "tls json".

--all-featuresActivate all available features

Enable every feature of the selected packages.

--no-default-featuresDo not activate the default feature

Do not enable the package's default feature.

--target <TARGET>Build for the target triple (verification build)

Select a target triple. Outputs go under target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

-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. MITTS_JOBS=4 does the same; the flag wins. Not related to -c of mitts test, which sets how many tests run at once.

--keep-goingDo 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: human (default), short (one line per diagnostic), json (Cargo-compatible JSON lines on stdout) and the json-* variants. See Output formats.

-q, --quietDo 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

-n, --dry-runPrepare 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 mitts package) instead of packaging again.

--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

OptionWhat 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

--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

OptionWhat 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: mitts build --manifest-path crates/api/Cargo.toml.

--target-dir <TARGET_DIR>Directory for all generated artifacts

Where this workspace's outputs go. Overrides $CARGO_TARGET_DIR and the default target/. The shared store is not affected; use --cache-dir for that.

-Z <FLAG>Unstable Cargo flags: -Z unstable-options is accepted; rustc's -Z flags go in RUSTFLAGS
-r, --releaseClean release artifacts only

Use the release profile (optimisations). Outputs go under target/release, and release units have their own action keys, so a debug build never satisfies a release one.

--cacheClean 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 MITTS_CACHE_DIR; the flag wins. Give each CI job or test its own to isolate it. With an explicit directory the no-op fast lock is off unless MITTS_FAST_LOCK=1.

-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: mitts build -p api -p worker.

--workspaceClean artifacts of the workspace members only

Every member of the workspace (alias --all).

--docWhether or not to clean just the documentation directory
-n, --dry-runDisplay 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 target/<triple>. Example: mitts build --target aarch64-unknown-linux-gnu.

-q, --quietDo 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. -v prints every rustc and build-script command, the units restored from the cache, the compiler path and the slowest units; -vv adds their environment and build-script output. MITTS_VERBOSE=1|2 does the same.

--lockedRequire Cargo.lock is up to date (accepted for Cargo compatibility)

Fail if Cargo.lock is missing or does not match the manifests; never resolve or write one. The right flag for CI.

--offlineRun 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.

--frozenEquivalent to specifying both --locked and --offline

--locked and --offline together.

Environment variables

Flags always win over variables. The diagnostic variables change how the work is done, never what is cached.

VariableValueMeaning and example
MITTS_JOBSNLimit concurrent build units. -j wins.

MITTS_JOBS=4 mitts build

MITTS_CACHE_DIRpathRoot of every store. --cache-dir wins; default $XDG_CACHE_HOME/mitts or ~/.cache/mitts.

MITTS_CACHE_DIR=/ci/cache mitts build

MITTS_CACHE_MAX_BYTESsize | offSize limit that triggers automatic pruning. Suffixes K, M, G, T; off or 0 disables. Default 100 GiB.

MITTS_CACHE_MAX_BYTES=20G mitts build

MITTS_GC_INTERVAL_SECSNLeast time between two size checks (the check scans the store). Default 3600.

MITTS_GC_INTERVAL_SECS=600

MITTS_TIMINGS1Print sub-millisecond phase timings ([mitts::phases]) and I/O byte and file counters ([mitts::io]) on stderr.

MITTS_TIMINGS=1 mitts build

MITTS_FAST_LOCK0 | 1The no-op fast path. Default: on only for the default cache root; 1 forces it with --cache-dir.

MITTS_FAST_LOCK=1 mitts build --cache-dir /tmp/c

MITTS_STORE_HARDLINKS0 | 1How a store object reaches target/. Default: reflink where possible, else a read-only hardlink. 0 copies; 1 prefers links everywhere.

MITTS_STORE_HARDLINKS=0 mitts build

MITTS_NO_REFLINK1Disable 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_REFLINK=1 MITTS_STORE_HARDLINKS=0 mitts build

MITTS_NO_HARDLINK1Disable the hardlinks between files inside one workspace (libfoo-<hash>.rlib to libfoo.rlib).

MITTS_NO_HARDLINK=1 mitts build

MITTS_VERIFY_RESTORE1Re-hash every object before restoring it. One read of every restored byte; for audits and suspect disks.

MITTS_VERIFY_RESTORE=1 mitts build

MITTS_CACHE_IO_BUDGETNHow many workers may read the cache at once. 0 unbounded. Default 1 on macOS, unbounded elsewhere.

MITTS_CACHE_IO_BUDGET=4

MITTS_INDEX_TTL_SECSNHow long cached sparse-index entries are trusted while online. Default 900. Offline, the cached copy always serves.

MITTS_INDEX_TTL_SECS=60

MITTS_NET_RETRYNHow 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=5 mitts fetch

MITTS_NET_RETRY_DELAY_MSNLength of one retry delay step in milliseconds (the waits are 1, 3 and 5 steps). Default 1000.

MITTS_NET_RETRY_DELAY_MS=200

MITTS_GITpathThe 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_GIT=/opt/git/bin/git

MITTS_RUSTC_WRAPPER_CACHE1Cache 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_CACHE=1 RUSTC_WRAPPER=/opt/w mitts build

MITTS_RUSTC_WRAPPER_SALTtextExtra 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_RUSTC_WRAPPER_SALT=v2

MITTS_VERBOSE1 | 2The 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_VERBOSE=2 mitts build

MITTS_SLOW_UNITSduration | offA 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_SLOW_UNITS=10m mitts build --release

MITTS_LINK_TIMING0Turns 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.

MITTS_LINK_TIMING=0 mitts build

RUSTUP_TOOLCHAINnameThe 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.

RUSTUP_TOOLCHAIN=nightly mitts build

MITTS_LOG_COMPILE1Log each compile action and every build-script hit or miss with its key, and the inputs of the build-script key.

MITTS_LOG_COMPILE=1 mitts build

MITTS_LOG_KEYSanyLog 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_LOG_KEYS=1 mitts build

MITTS_STATSjsonPrint one JSON line on stderr after the build: units compiled, cached, tainted, total, and whether the fast path served it.

MITTS_STATS=json mitts build

MITTS_CRATES_IO_URLurlWhere .crate archives are downloaded from. Default https://static.crates.io/crates. For a mirror or an offline proxy.

MITTS_CRATES_IO_URL=https://mirror.example/crates

MITTS_SPARSE_INDEX_URLurlThe sparse registry index used for crates.io. For a mirror.

MITTS_SPARSE_INDEX_URL=https://mirror.example/index

MITTS_LLVM_COVpathThe llvm-cov binary used by mitts coverage, instead of the automatic lookup.

MITTS_LLVM_COV=/opt/llvm/bin/llvm-cov

MITTS_LLVM_PROFDATApathThe llvm-profdata binary used by mitts coverage, instead of the automatic lookup.

MITTS_LLVM_PROFDATA=/opt/llvm/bin/llvm-profdata

MITTS_VERSIONvX.Y.ZInstaller. Release to install instead of the latest. Pinning skips the latest-release lookup.

MITTS_VERSION=v0.3.34 sh install.sh

MITTS_INSTALL_ROOTpathInstaller. The binary goes to <root>/bin. Falls back to CARGO_INSTALL_ROOT, then CARGO_HOME, then ~/.cargo.

MITTS_INSTALL_ROOT=/opt/mitts sh install.sh

MITTS_NO_SOURCE_FALLBACK1Installer. 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).

MITTS_NO_SOURCE_FALLBACK=1 sh install.sh

CARGO_TARGET_DIRpathWorkspace output root when --target-dir is not given.

CARGO_TARGET_DIR=/fast/target

CARGO_BUILD_TARGET_DIRpathOutput root when neither --target-dir nor CARGO_TARGET_DIR is set; wins over build.target-dir in .cargo/config.toml.

CARGO_BUILD_TARGET_DIR=/fast/target

CARGO_TERM_COLORauto | always | neverColoring of Mitts' output when --color is not given.

CARGO_TERM_COLOR=never mitts build

CARGO_REGISTRY_TOKENtokenToken used by mitts publish.

(set in the CI secret store)

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.

ValueOutput
human (default)Progress, banners and rendered multi-line diagnostics.
shortOne line per diagnostic, file:line:col: level: message, on stderr; no banners.
jsonCargo-compatible JSON lines on stdout. Nothing else is printed there while compiling.
json-diagnostic-shortJSON lines whose message.rendered is the short single-line text.
json-diagnostic-rendered-ansiJSON lines whose message.rendered keeps ANSI colour escapes.
json-render-diagnosticsNo 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, dev and test builds 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:
# Cargo.toml, or ~/.cargo/config.toml for every project
[profile.dev]
debug = true

# one run
CARGO_PROFILE_DEV_DEBUG=true mitts build
Any explicit debug is passed to rustc as written, the same as in Cargo.
Cache location
--cache-dir, then MITTS_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:
[workspace.metadata.mitts]
impure-proc-macros = ["sqlx-macros", "askama_derive", "rust-embed-impl"]
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.
Registries and mirrors
[registries.<name>] index, [source.<name>] registry | directory | git and replace-with are read from Cargo's config chain, as are vendored directories and [patch]. Tokens come from Cargo's credential providers: cargo:token (CARGO_REGISTRIES_<NAME>_TOKEN or credentials.toml), cargo:macos-keychain, cargo:libsecret, cargo:token-from-stdout, and plugins.
[env] tables
Merged over the config chain (the closer file wins). force = false keeps a variable the environment already has; relative = true joins the value to the parent of the config's .cargo. Applied to compiler runs, build scripts and programs started by mitts run and mitts 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 under db/ and one checkout per locked commit. Authentication is git's own (SSH agent, credential helpers).
Compiler wrappers
See Compiler wrappers: any wrapper except sccache disables caching by default, unless MITTS_RUSTC_WRAPPER_CACHE=1 is 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

InputDefaultMeaning
versionlatest stableRelease to install, vX.Y.Z or X.Y.Z.
cachetrueRestore the cache. false only installs.
cache-keyemptyExtra text in the key, for example a job name, when jobs build different things.
cache-dirplatform defaultCache 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.