This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git


The following commit(s) were added to refs/heads/master by this push:
     new f9cb7f42 fix(rust): relax dependency upper-bound pins so downstream 
can use newer versions (#1468)
f9cb7f42 is described below

commit f9cb7f424bdb62b0d2b54d60864e46a08b613636
Author: Lei Zhiyuan <[email protected]>
AuthorDate: Tue Oct 27 14:02:35 2026 +0800

    fix(rust): relax dependency upper-bound pins so downstream can use newer 
versions (#1468)
    
    Exact and upper-bound pins in [dependencies] propagate to every downstream
    project and make rocketmq unusable alongside newer tokio, tokio-util, time,
    indexmap or hyper-util. Keep only lower bounds and enforce the MSRV through
    the MSRV-aware resolver (resolver.incompatible-rust-versions = fallback) 
when
    CI generates Cargo.lock, which does not affect downstream resolution.
---
 .github/workflows/rust_build.yml | 12 ++++++++++++
 rust/.cargo/config.toml          |  6 ++++++
 rust/Cargo.toml                  | 19 +++----------------
 3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/.github/workflows/rust_build.yml b/.github/workflows/rust_build.yml
index 5b833e5c..da6f6047 100644
--- a/.github/workflows/rust_build.yml
+++ b/.github/workflows/rust_build.yml
@@ -66,6 +66,12 @@ jobs:
       - uses: actions/checkout@v3
         with:
           submodules: true
+      # Cargo.lock is not committed. Resolve it with a recent Cargo, whose 
MSRV-aware
+      # resolver (enabled in .cargo/config.toml) picks versions compatible 
with rust-version.
+      - name: Generate Cargo.lock
+        run: |
+          rustup toolchain install stable --profile minimal
+          cargo +stable generate-lockfile
       - name: Install cargo-msrv
         run: |
           cargo install cargo-msrv
@@ -91,6 +97,12 @@ jobs:
           curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- 
-y --default-toolchain ${{ matrix.msrv }}
           echo "$HOME/.cargo/bin" >> $GITHUB_PATH
           rustup component add clippy
+      # Cargo.lock is not committed. Resolve it with a recent Cargo, whose 
MSRV-aware
+      # resolver (enabled in .cargo/config.toml) picks versions compatible 
with rust-version.
+      - name: Generate Cargo.lock
+        run: |
+          rustup toolchain install stable --profile minimal
+          cargo +stable generate-lockfile
       - name: Install protoc
         uses: arduino/setup-protoc@v3
         with:
diff --git a/rust/.cargo/config.toml b/rust/.cargo/config.toml
index 311a0281..42ac56eb 100644
--- a/rust/.cargo/config.toml
+++ b/rust/.cargo/config.toml
@@ -16,3 +16,9 @@
 #
 [registries.crates-io]
 protocol = "sparse"
+
+# Prefer dependency versions whose `rust-version` is compatible with this 
crate's MSRV
+# when Cargo (1.84+) resolves `Cargo.lock`. This only affects development of 
this crate;
+# downstream projects resolve dependencies with their own configuration.
+[resolver]
+incompatible-rust-versions = "fallback"
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 3f1e105d..970c75f8 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -32,8 +32,7 @@ description = "Rust client for Apache RocketMQ"
 keywords = ["rocketmq", "api", "client", "sdk", "grpc"]
 
 [dependencies]
-# Pin tokio to versions compatible with Rust 1.74; 1.47+ raised the MSRV 
beyond it.
-tokio = { version = ">=1.20, <1.47", features = ["full"] }
+tokio = { version = "1.20", features = ["full"] }
 tokio-rustls = { version = "0.24.0", features = ["default", 
"dangerous_configuration"] }
 tokio-stream = "0.1.12"
 async-trait = "0.1.68"
@@ -56,7 +55,7 @@ minitrace = "0.4"
 byteorder = "1"
 mac_address = "1.1.4"
 hex = "0.4.3"
-time = { version = ">=0.3.20, <0.3.37", features = ["formatting", 
"local-offset"] }
+time = { version = "0.3.20", features = ["formatting", "local-offset"] }
 once_cell = "1.18.0"
 
 mockall = "0.11.4"
@@ -67,25 +66,13 @@ flate2 = "1"
 crc32fast = "1"
 md-5 = "0.10"
 ring = "0.16.20"
-tokio-util = { version = "=0.7.10", features = ["rt"] }
-# Pin indexmap to avoid hashbrown 0.17+ which requires Rust 2024 edition
-indexmap = ">=2.0, <2.8"
-# Explicitly pin hashbrown to versions compatible with Rust 1.74
-hashbrown = ">=0.12, <0.16"
-# Pin hyper-util (pulled in via tonic -> hyper-timeout) to versions that still 
build with
-# Rust 1.74; 0.1.16+ switched to edition 2024 and broke the MSRV build.
-hyper-util = ">=0.1.2, <0.1.16"
-# Pin powerfmt (pulled in via time 0.3 -> deranged/time-macros) to versions 
compatible
-# with Rust 1.74; 0.2.1+ requires rustc 1.79.
-powerfmt = ">=0.2.0, <0.2.1"
+tokio-util = { version = "0.7.10", features = ["rt"] }
 
 [build-dependencies]
 tonic-build = "0.10.2"
 which = "7.0.3"
 version_check = "0.9.4"
 regex = "1.7.3"
-# Pin tempfile to avoid getrandom 0.4+ which requires Rust 2024 edition
-tempfile = ">=3.0, <3.15"
 
 [dev-dependencies]
 awaitility = "0.3.0"

Reply via email to