Problem
Problem
Cargo.toml is static by design, which is great for reproducibility.
But it is significantly less expressive than scriptable build descriptors like Gradle's build.gradle.kts.
For advanced workflows, users often want to express build/dependency logic programmatically:
- conditional dependency declarations
- environment/profile-aware dependency sets
- reusable logic/functions for dependency groups
- computed manifest fragments
- richer multi-target orchestration in one place
Today, this usually gets pushed into wrappers (xtask, Makefiles, external scripts), while Cargo.toml remains static.
That splits build logic across tools and loses first-class Cargo UX.
Proposal
Consider introducing a first-class scriptable manifest format as an alternative to static Cargo.toml, conceptually similar to build.gradle.kts.
Examples (placeholder names):
Cargo.kts (Kotlin-like DSL)
Cargo.rs (Rust-based manifest DSL)
- another Cargo-defined programmable manifest language
The key idea:
- Manifest is authored in a programmable form.
- Cargo evaluates it in a constrained, deterministic phase.
- The result is a normalized static manifest model for normal dependency resolution / lockfile flow.
Scope and Intent
This is not about build.rs mutating dependencies at compile time.
This is about replacing or superseding static manifest authoring with a programmable manifest authoring experience, while preserving Cargo guarantees.
Design constraints (important)
If this is considered, these constraints seem necessary:
- Deterministic evaluation (same inputs => same output)
- Reproducible lockfile semantics
- Clear input boundary (env/config/profile/target/etc.)
- Strong caching story
- Explicit diagnostics showing generated/normalized manifest
- Security model for script execution (sandbox/capability restrictions)
Why this matters
- Reduces dependence on external wrappers for core build/dependency logic
- Improves ergonomics for large and polyglot repos
- Enables reusable and maintainable build logic at the manifest layer
- Brings Cargo closer to modern scriptable build systems without abandoning reproducibility
Related issues / context
I know there are related constraints discussed in:
This proposal is broader: a first-class programmable manifest model, not runtime mutation of the dependency graph from build.rs.
Proposed Solution
No response
Notes
No response
Problem
Problem
Cargo.tomlis static by design, which is great for reproducibility.But it is significantly less expressive than scriptable build descriptors like Gradle's
build.gradle.kts.For advanced workflows, users often want to express build/dependency logic programmatically:
Today, this usually gets pushed into wrappers (
xtask, Makefiles, external scripts), whileCargo.tomlremains static.That splits build logic across tools and loses first-class Cargo UX.
Proposal
Consider introducing a first-class scriptable manifest format as an alternative to static
Cargo.toml, conceptually similar tobuild.gradle.kts.Examples (placeholder names):
Cargo.kts(Kotlin-like DSL)Cargo.rs(Rust-based manifest DSL)The key idea:
Scope and Intent
This is not about
build.rsmutating dependencies at compile time.This is about replacing or superseding static manifest authoring with a programmable manifest authoring experience, while preserving Cargo guarantees.
Design constraints (important)
If this is considered, these constraints seem necessary:
Why this matters
Related issues / context
I know there are related constraints discussed in:
This proposal is broader: a first-class programmable manifest model, not runtime mutation of the dependency graph from
build.rs.Proposed Solution
No response
Notes
No response