Skip to content

fix(cli): add edition and rust-version to workspace manifest template#4260

Closed
kukaklaudio wants to merge 1 commit intosolana-foundation:masterfrom
kukaklaudio:fix/workspace-edition-rust-version
Closed

fix(cli): add edition and rust-version to workspace manifest template#4260
kukaklaudio wants to merge 1 commit intosolana-foundation:masterfrom
kukaklaudio:fix/workspace-edition-rust-version

Conversation

@kukaklaudio
Copy link
Copy Markdown

Summary

Fixes #4047anchor init generates a workspace Cargo.toml missing edition and rust-version, which can cause build failures when Cargo resolves edition2024-only dependency versions.

Problem

The workspace Cargo.toml template had no edition or rust-version keys. While individual program crates set edition = "2021", Cargo's MSRV-aware dependency resolver uses workspace-level settings. Without them, crates requiring Rust edition 2024 (e.g. base64ct@1.8.0) could be resolved, breaking builds with:

error: package `base64ct v1.8.0` cannot be built because it requires rustc 1.85 or newer

Fix

  • Add [workspace.package] section with edition = "2021" and rust-version set to ANCHOR_MSRV (currently 1.89.0)
  • Update program Cargo.toml template to inherit these via edition.workspace = true and rust-version.workspace = true

This ensures Cargo's resolver respects the MSRV constraint at the workspace level, preventing incompatible crate versions from being resolved.

The workspace Cargo.toml generated by `anchor init` was missing
`edition` and `rust-version` keys. While these were set in individual
program Cargo.toml files, Cargo's dependency resolver uses the
workspace-level settings for MSRV-aware resolution. Without them,
edition2024-only crate versions (e.g. base64ct@1.8.0) could be
resolved, causing build failures.

Add `[workspace.package]` with `edition = "2021"` and
`rust-version` set to ANCHOR_MSRV, and update the program template
to inherit these via `.workspace = true`.

Fixes solana-foundation#4047
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 20, 2026

Someone is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@jamie-osec
Copy link
Copy Markdown
Collaborator

Duplicate of #4048

@jamie-osec jamie-osec marked this as a duplicate of #4048 Feb 27, 2026
@jamie-osec jamie-osec closed this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add edition/rust-version to Rust template workspace root

2 participants