Implementation:MaterializeInc Materialize Cargo Workspace Config
| Knowledge Sources | |
|---|---|
| Domains | Build_System, Configuration |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
Root Cargo workspace configuration that defines all Rust crates, build profiles, dependency patches, and lint rules for the Materialize project.
Description
This Cargo.toml serves as the virtual workspace root for the entire Materialize Rust monorepo. It enumerates over 120 workspace member crates spanning the core database engine (adapter, compute, storage, SQL parsing), infrastructure services (environmentd, clusterd, balancerd, orchestratord), client libraries, and test utilities. The file also configures multiple build profiles (dev, release, optimized, CI), patches several upstream crate dependencies with Materialize-maintained forks, and establishes a unified set of Clippy and Rust lint rules that apply across all member crates.
Usage
Developers interact with this file when adding or removing crates from the workspace, adjusting build profiles for performance tuning, patching upstream dependencies with forked repositories, or updating the project-wide lint configuration. It is the entry point for all cargo build, cargo test, and cargo clippy invocations at the repository root.
Code Reference
Source Location
- Repository: MaterializeInc_Materialize
- File: Cargo.toml
Signature
[workspace]
members = [
"src/adapter",
"src/adapter-types",
"src/alloc",
"src/environmentd",
"src/clusterd",
"src/balancerd",
"src/orchestratord",
"src/sql",
"src/sql-parser",
"src/persist",
"src/compute",
"src/storage",
"src/repr",
# ... 120+ total workspace members
]
exclude = [
"misc/wasm/*",
"misc/python/venv/*",
]
resolver = "2"
[workspace.package]
edition = "2024"
rust-version = "1.89.0"
[profile.dev]
split-debuginfo = "unpacked"
[profile.release]
lto = "thin"
debug = 2
[profile.optimized]
inherits = "release"
lto = "off"
debug = 1
incremental = true
[profile.ci]
inherits = "optimized"
debug = "line-tables-only"
debug-assertions = true
[patch.crates-io]
# Materialize-maintained forks of upstream crates
postgres = { git = "https://github.com/MaterializeInc/rust-postgres" }
rdkafka = { git = "https://github.com/MaterializeInc/rust-rdkafka.git" }
# ... additional patches
[workspace.lints.clippy]
as_conversions = "warn"
dbg_macro = "warn"
todo = "warn"
wildcard_dependencies = "warn"
# ... additional lint rules
Import
# Build all default workspace members
cargo build
# Build a specific crate within the workspace
cargo build -p mz-environmentd
# Run all workspace tests
cargo test --workspace
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| workspace.members | Array of strings | Yes | Paths to all crates included in the workspace |
| workspace.package.edition | String | Yes | Rust edition used by all workspace members (currently "2024") |
| workspace.package.rust-version | String | Yes | Minimum supported Rust toolchain version ("1.89.0") |
| profile.dev | Table | No | Dev build profile overrides (e.g., split-debuginfo, per-package opt-level) |
| profile.release | Table | No | Release build profile settings (LTO, debug info level) |
| patch.crates-io | Table | No | Dependency overrides pointing to Materialize-maintained Git forks |
| workspace.lints | Table | No | Unified Clippy and Rust lint configuration for all workspace members |
Outputs
| Name | Type | Description |
|---|---|---|
| Workspace dependency graph | Cargo metadata | Resolved dependency tree used by cargo build, test, and clippy |
| Build artifacts | Binary/library files | Compiled crates placed in target/ directory per the active profile |
| Lint diagnostics | Compiler warnings | Warnings and errors produced by the configured lint rules |
Usage Examples
# Build all workspace members using the CI profile
cargo build --profile ci
# Run clippy with workspace-level lint configuration
cargo clippy --workspace --all-targets
# Check dependency graph resolution
cargo metadata --format-version 1
# Build with the optimized profile for local performance testing
cargo build --profile optimized
# Add a new crate to the workspace
# 1. Create the crate directory under src/
# 2. Add the path to both `members` and `default-members` arrays in Cargo.toml