chore(cargo): declare MSRV via rust-version = "1.91"#2002
Conversation
rtk uses `str::floor_char_boundary()` (src/cmds/system/pipe_cmd.rs:140)
which was stabilized in Rust 1.91.0. Without `rust-version` in
Cargo.toml, packagers on older toolchains hit a confusing
`use of unstable library feature` error from rustc.
With this declaration, cargo gives the expected friendly diagnostic
up-front:
error: rustc 1.88.0 is not supported by the following packages:
rtk@0.34.3 requires rustc 1.91
Verified locally by switching toolchains:
- cargo +1.88 check → fails with the new clear MSRV error (intended)
- cargo +1.93 fmt/clippy/test → 1909 passed, zero warnings
Fixes rtk-ai#1402
|
Reviewer guide to reduce review time: Expert lens: Rust packaging / MSRV. Scope is intentionally one line: Suggested review checks:
|
|
@aeppling Could I ask for a focused maintainer pass on a small first batch? I have several PRs open, so to avoid overloading reviewers I would like to prioritize only the narrow, mergeable, CI-clean ones first:
The larger/security-sensitive PRs can wait. If this is not the preferred way to queue reviews, I am happy to follow whatever workflow maintainers prefer. |
pszymkowiak
left a comment
There was a problem hiding this comment.
Thanks @YOMXXX — clean one-line metadata fix. The crate already requires floor_char_boundary (1.91+) in pipe_cmd.rs:135 and json_cmd.rs:109, so declaring the MSRV explicitly is the right call — it turns the cryptic E0658 rustc error into a clean cargo-level diagnostic for distribution packagers. CI green across the three OSes. Approving.
Summary
`rtk` already uses `str::floor_char_boundary()` (`src/cmds/system/pipe_cmd.rs:140`), stabilized in Rust 1.91.0, but `Cargo.toml` doesn't declare the MSRV. Distribution packagers on older toolchains see a confusing `use of unstable library feature` rustc error instead of a clear cargo-level MSRV diagnostic.
Reproduction
```bash
Without this PR, on Rust 1.88.0:
$ cargo check
error[E0658]: use of unstable library feature `round_char_boundary`
--> src/cmds/system/pipe_cmd.rs:140:21
```
Fix
Add `rust-version = "1.91"` to the `[package]` table.
```toml
[package]
name = "rtk"
version = "0.34.3"
edition = "2021"
rust-version = "1.91" # ← added
```
After
```bash
$ cargo +1.88 check
error: rustc 1.88.0 is not supported by the following packages:
rtk@0.34.3 requires rustc 1.91
```
Cargo gives the right diagnostic at the `[package]`-validation step, before `rustc` ever runs.
Test plan
Notes
@DavidReque expressed interest a month ago but no PR materialized — happy to defer if they'd prefer to push their own; otherwise this lands the minimal one-line change so packagers stop hitting the unhelpful rustc message.
Fixes #1402