Skip to content

chore(cargo): declare MSRV via rust-version = "1.91"#2002

Merged
pszymkowiak merged 1 commit into
rtk-ai:developfrom
YOMXXX:feat/msrv-1.91
Jun 1, 2026
Merged

chore(cargo): declare MSRV via rust-version = "1.91"#2002
pszymkowiak merged 1 commit into
rtk-ai:developfrom
YOMXXX:feat/msrv-1.91

Conversation

@YOMXXX
Copy link
Copy Markdown
Contributor

@YOMXXX YOMXXX commented May 21, 2026

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

  • `cargo +1.93 fmt --all -- --check` clean.
  • `cargo +1.93 clippy --all-targets` zero warnings.
  • `cargo +1.93 test --bin rtk -- --test-threads=8` → 1909 passed.
  • `cargo +1.88 check` reproduces the friendly MSRV error (intended behaviour).

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

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
@YOMXXX
Copy link
Copy Markdown
Contributor Author

YOMXXX commented May 25, 2026

Reviewer guide to reduce review time:

Expert lens: Rust packaging / MSRV.

Scope is intentionally one line: Cargo.toml now declares rust-version = "1.91" because the code already uses str::floor_char_boundary(), which requires Rust 1.91. This does not change runtime behavior or dependency resolution on supported toolchains; it only makes older toolchains fail early with Cargo's clear MSRV diagnostic instead of a confusing rustc unstable-feature error.

Suggested review checks:

  • Confirm Rust 1.91 is the actual minimum implied by current source usage.
  • Confirm packagers are expected to see Cargo's MSRV error rather than compile into pipe_cmd.rs and fail later.
  • No code-path review needed beyond the package metadata change.

@YOMXXX
Copy link
Copy Markdown
Contributor Author

YOMXXX commented May 27, 2026

@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.

Copy link
Copy Markdown
Collaborator

@pszymkowiak pszymkowiak left a comment

Choose a reason for hiding this comment

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

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.

@pszymkowiak pszymkowiak merged commit 4c278d1 into rtk-ai:develop Jun 1, 2026
12 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.

Add rust-version to Cargo.toml (MSRV = 1.91)

2 participants