cargo-cgp v0.1.0
This page lists what the first release of cargo-cgp provides. The tool is the error toolchain of
Context-Generic Programming (CGP), a Rust library whose macros generate traits and their
wiring: it rewrites CGP's compile errors to name their cause and prints the code the macros
generate.
Released on 2026-11-18.
- Release post: CGP v0.8.0 - cargo-cgp, new documentation, and namespaces
- Crate:
cargo-cgp0.1.0 on crates.io - Tag: v0.1.0
Summary
cargo cgp check runs cargo check and rewrites the CGP errors it recognizes, tagging each with a
[CGP-Exxx] code for its class. cargo cgp check leads with the root cause for the classes it recognizes, and the tool does not yet reshape every class. cargo cgp expand prints a target's
macro expansion with CGP's type-level constructs written as macros again. cargo cgp setup and
cargo cgp update install and refresh the pinned nightly and the driver built against it.
Compatibility
- Minimum Rust version: 1.96, for the front end that
cargo installbuilds. The driver builds on the pinned nightly,nightly-2026-11-16, whichcargo cgp setupinstalls, and a project's own builds keep its toolchain. - CGP version: the tool recognizes the errors of
cgpv0.8.0, released beside it. Older CGP code compiles as it would undercargo check, but rewriting its errors is untested. - Platforms: tested on Linux; macOS and Windows are untested.
- Crates:
cargo-cgp,cargo-cgp-driver,cargo-cgp-error-processing, andcargo-cgp-expand, all at 0.1.0.
Upgrading
This is the tool's first release, so there is nothing to upgrade from. Install it with
cargo install --locked cargo-cgp followed by cargo cgp setup, or through the Nix flake at
github:contextgeneric/cargo-cgp/v0.1.0, as Installation
describes.
New features
Commands
cargo cgp checkforwards its arguments tocargo checkand rewrites each CGP error it recognizes: it checks the program with Rust's next-generation trait solver to find the cause, names it in the headline, draws the dependency chain, and keeps rustc's own code beside the CGP code. Errors it does not recognize pass through unchanged, and rewriting applies to the crates of the workspace. The errors come in the order of the code they point at, so the output is the same on every run, however many threads the compiler checks on. See Check.cargo cgp check --message-format=jsonprints the rewritten errors as JSON, the form an editor reads.cargo cgp expandprints the Rust one target's macros generate, writing a field tag asSymbol!("width"), a list asProduct![A, B], a field list asStruct! { width: f64 }, and a path asPath!(@app.Component).--item <PATH>narrows the output to one module, type, or trait, and the other arguments go tocargo rustc. See Expand.cargo cgp setupinstalls the pinned nightly withrustc-devandllvm-toolsthrough rustup and builds the matchingcargo-cgp-driverbeside the front end.cargo cgp updatereinstalls the tool when crates.io has a newer version in its release channel, then runs that version'ssetup.--versionand--helpprint the version and the list of commands. See Command reference.
Error codes
- Whole-error codes: 37
CGP-E0xxcodes head a rewritten error, one per class of mistake, grouped by kind: a trait a context cannot use, conflicting wiring, structural mistakes, wiring that does not resolve, mistakes in a macro's input, and extensible data. - Dependency-step codes: 24
CGP-E1xxcodes label the lines of the dependency tree, for the path through the requirements and the cause at its end. - A provider's missing component key:
CGP-E041reports a provider header whose component key is not in scope, with the key's public import path, and a header that names its trait through a module that re-exports the trait without its key;CGP-E070reports a header whose derived key is not the component's, with a fix that names the key in the attribute. - Rewrites without a code: an error the tool leaves unclassified still has its type-level names written as macros, shorter type names, and the generated traits' notes renamed to the consumer and provider traits.
See Error codes for each code.
Editor integration
rust-analyzer can run cargo cgp check on save through rust-analyzer.check.overrideCommand, so
the editor shows the rewritten errors. CGP-E041's import is a fix the editor applies on the
provider trait's name and on a wiring key, marked preferred when one path imports the key, and
CGP-E070's fix appears on the trait's name the same way. See
Editor integration.
Nix
The repository's flake builds both binaries against the pinned nightly without rustup, and
nix run github:contextgeneric/cargo-cgp/v0.1.0 -- check runs the tool without installing it.
An AI agent wrote this page from the release's source changes and the CGP knowledge base. Its content was verified against the tool's source at the release's tag. See How AI is used in this project.