Skip to content

Add rust-version to published sub-crates - #3476

Merged
BurntSushi merged 3 commits into
BurntSushi:masterfrom
albatrossflyon-coder:fix/msrv-metadata
Jul 20, 2026
Merged

BurntSushi merged 3 commits into
BurntSushi:masterfrom
albatrossflyon-coder:fix/msrv-metadata

Conversation

@albatrossflyon-coder

Copy link
Copy Markdown
Contributor

Fixes #3473

The workspace root Cargo.toml already declares rust-version = "1.85", and every sub-crate uses edition = "2024" (which mechanically requires rustc >= 1.85), but none of the 9 published sub-crates carried their own rust-version field — so it was missing from their individual Cargo.toml on crates.io even though the workspace itself documents the MSRV.

Added rust-version = "1.85" to:

  • crates/cli (grep-cli)
  • crates/globset (globset)
  • crates/grep (grep)
  • crates/ignore (ignore)
  • crates/matcher (grep-matcher)
  • crates/pcre2 (grep-pcre2)
  • crates/printer (grep-printer)
  • crates/regex (grep-regex)
  • crates/searcher (grep-searcher)

Verified cargo metadata --no-deps and cargo check --workspace both succeed with no changes needed elsewhere.

@BurntSushi

Copy link
Copy Markdown
Owner

Can this use rust-version.workspace = true? That way we don't have to repeat all of the version numbers.

@xtqqczze

Copy link
Copy Markdown
Contributor

We don’t currently define [workspace.package] in the root Cargo.toml. We could introduce it just for edition and rust-version, but it would be better to do so as part of a broader refactoring.

@albatrossflyon-coder

Copy link
Copy Markdown
Contributor Author

Good call — pushed a follow-up commit that centralizes edition/rust-version in a new [workspace.package] table in the root Cargo.toml, with each of the 9 sub-crates now using edition.workspace = true / rust-version.workspace = true instead of hardcoding the values. Values are unchanged (2024 / 1.85), just no longer duplicated 10 times. cargo check -p ripgrep and cargo metadata both pass clean.

@xtqqczze

Copy link
Copy Markdown
Contributor

Conflicts with c035d23.

The workspace root already declares rust-version = "1.85", and every
sub-crate uses edition = "2024" (which requires rustc >= 1.85 anyway),
but none of the 9 published sub-crates carried their own rust-version
field, so it was missing from their individual Cargo.toml on crates.io.

Fixes BurntSushi#3473
Per maintainer feedback on the rust-version PR: rather than hardcoding
edition/rust-version in every sub-crate manifest, define them once in
the root [workspace.package] and have each crate inherit via
edition.workspace = true / rust-version.workspace = true.
@albatrossflyon-coder

Copy link
Copy Markdown
Contributor Author

Rebased onto master to resolve the conflict with c035d23 (MSRV bump to 1.96). [workspace.package].rust-version now reads 1.96 to match; cargo check and cargo metadata both pass clean on 1.97.1.

Comment thread Cargo.toml
"crates/ignore",
]

[workspace.package]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could we move [workspace.package] to the top of the file?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it above [[bin]] but below the [package] section.

@BurntSushi

Copy link
Copy Markdown
Owner

I think the main problem preventing me from merging this PR is that Rust 1.96 is fine for ripgrep, but it might be too new for some of the library crates like ignore.

So I guess for globset and ignore (the only two non-grep crates), could you set their rust-version to something lower? Let's go with Rust 1.88 for now, since I think ignore will build for that.

…ce default

The workspace rust-version (1.96) is fine for ripgrep itself, but too new
for globset and ignore, which don't need it. Rust 1.88 is the actual
requirement (that's where let-chains stabilized, which a downstream ignore
release already depends on), and both crates build clean under it.
@albatrossflyon-coder

Copy link
Copy Markdown
Contributor Author

Done — globset and ignore now pin rust-version = \"1.88\" directly instead of inheriting the workspace's 1.96. Verified both build clean under an actual Rust 1.88.0 toolchain (not just an assumption), so 1.88 is a real, confirmed floor for these two, not a guess.

@BurntSushi

Copy link
Copy Markdown
Owner

I don't think it's necessarily a floor. But I think this is fine for now.

@BurntSushi
BurntSushi merged commit a9dc222 into BurntSushi:master Jul 20, 2026
22 checks passed
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.

Specify rust-version in Cargo.toml

3 participants