A compiler for a subset of Rust
Edit one function, rebuild in milliseconds.
zustc has its own lexer, parser and type inference, generates code with Cranelift or its own small x86-64 backend, and is tuned for the edit-and-rebuild loop: rebuild time, peak memory, cache size and binary size. It compiles itself.
Measured on every push
Latest CI run (—) on generated programs of 5000 functions, shared GitHub Actions runners.
zustc check—gen5000Three tools
zustc
The compiler. Only the functions that changed are recompiled; if nothing changed it does not even link.
- Cranelift (default) or minclif backend
- multi-crate workspaces, relinks without recompiling dependents
--target wasm32-unknown-unknown(experimental)
zust-analyzer
A lightweight LSP server for ordinary Rust workspaces, indexing std and dependency crates.
- definition, references, hover, completion
- rename, signatureHelp, documentHighlight
- diagnostics from
zustc check
zurgo
A Cargo-compatible driver: reads Cargo.toml and Cargo.lock and builds the package with zustc.
build,run,metadata,clean- build scripts run as under cargo
- crates.io sources from
cargo fetch
Try it
# Linux x86-64, Rust (edition 2024), cc, and a linker (wild, mold, lld or ld) $ git clone https://github.com/mizchi/zust.git && cd zust $ cargo install --path . && cargo install --path crates/analyzer && cargo install --path crates/zurgo $ zustc hello.rs -o hello && ./hello $ zustc check hello.rs # types only, all diagnostics $ zurgo run # a Cargo package
How much of Rust
rustc's own UI tests (rust-lang/rust 1.100.0 tests/ui), counting only tests zustc can be asked to
handle. Latest CI run: —.
Status
Experimental. zustc targets Linux x86-64 and does not support all of Rust. Its checks (types, borrows, regions) are partial, so it does not replace rustc for checking correctness. zust-analyzer implements part of what rust-analyzer does.
This repository's history spans about eight days, and almost all of its commits were made by coding agents, with rustc's test suite as the spec and the KPIs checked on every change. See the retrospective.