Skip to content
Latchkey

cargo check: Usage, Options & Common CI Errors

Catch compile errors fast - without codegen.

cargo check compiles your code far enough to report errors and warnings but skips code generation and linking, so it is much faster than cargo build. It is the ideal first gate in a pipeline.

What it does

Runs the front end of the compiler (parsing, type checking, borrow checking) and stops before emitting machine code. It produces no runnable binary.

Common usage

Terminal
cargo check                       # check the current package
cargo check --workspace           # check all members
cargo check --all-targets         # include tests, examples, benches
cargo check --locked --all-features

Common CI error: passes check, fails build

cargo check is green but cargo build --release fails. That happens because check skips codegen and linking, so linker errors, const-eval that only runs in codegen, and some monomorphization errors only surface in a real build. Run cargo build (or cargo test) on the same matrix entry you ship, not just check.

Options

FlagEffect
--workspaceCheck all workspace members
--all-targetsCheck tests, examples, benches
--all-featuresEnable every feature
--message-format jsonMachine-readable diagnostics

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →