From 7ee00f614520a8e10b9beb4968564eae5d226196 Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Wed, 23 Sep 2026 11:46:54 +0800 Subject: [PATCH 1/5] build: support Rust 1.80 Lower the declared MSRV for the runtime, generators, and examples. Resolve compatible dependencies with a newer Cargo before running the Rust 1.80 CI checks. Signed-off-by: Tim Zhang --- .github/workflows/bvt.yml | 14 +++++++++++--- Cargo.toml | 2 +- README.md | 2 +- example-prost/Cargo.toml | 1 + example/Cargo.toml | 1 + ttrpc-codegen-prost/Cargo.toml | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bvt.yml b/.github/workflows/bvt.yml index 946df530..a51ba07a 100644 --- a/.github/workflows/bvt.yml +++ b/.github/workflows/bvt.yml @@ -9,13 +9,20 @@ jobs: name: Minimum Supported Rust Version runs-on: ubuntu-latest env: - RUSTUP_TOOLCHAIN: "1.85.0" - CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback + RUSTUP_TOOLCHAIN: "1.80.0" steps: - name: Checkout uses: actions/checkout@v3 - name: Install Rust - run: rustup toolchain install 1.85.0 --profile minimal + run: | + rustup toolchain install 1.80.0 --profile minimal + rustup toolchain install 1.85.0 --profile minimal + - name: Resolve Rust 1.80 compatible dependencies + run: | + # Cargo 1.80 cannot use the MSRV-aware fallback resolver. + RUSTUP_TOOLCHAIN=1.85.0 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo generate-lockfile + RUSTUP_TOOLCHAIN=1.85.0 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo generate-lockfile --manifest-path ttrpc-codegen-prost/Cargo.toml + RUSTUP_TOOLCHAIN=1.85.0 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo generate-lockfile --manifest-path example-prost/Cargo.toml - name: Install Protoc run: ./install_protoc.sh shell: bash @@ -24,6 +31,7 @@ jobs: cargo test --workspace --features async,sync,security_extension cargo test -p ttrpc --no-default-features --features sync,async,prost cargo test --manifest-path ttrpc-codegen-prost/Cargo.toml + cargo check --manifest-path example-prost/Cargo.toml --examples check: name: Check diff --git a/Cargo.toml b/Cargo.toml index 7796afd4..ab78f6c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ resolver = "2" [workspace.package] edition = "2018" -rust-version = "1.85" +rust-version = "1.80" license = "Apache-2.0" readme = "README.md" repository = "https://github.com/containerd/ttrpc-rust" diff --git a/README.md b/README.md index 8e208d6a..e2c34e08 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ ttrpc does not provide TLS. If you expose TCP beyond a trusted boundary, secure ## Compatibility -- Runtime and code generators minimum supported Rust version: **1.85** +- Runtime and code generators minimum supported Rust version: **1.80** - Repository development toolchain: see [`rust-toolchain.toml`](https://github.com/containerd/ttrpc-rust/blob/master/rust-toolchain.toml) - Default features: `sync`, `rustprotobuf` - Optional features: `async`, `prost`, `security_extension` (Unix only) diff --git a/example-prost/Cargo.toml b/example-prost/Cargo.toml index 29a05d97..e4247f8d 100644 --- a/example-prost/Cargo.toml +++ b/example-prost/Cargo.toml @@ -3,6 +3,7 @@ name = "ttrpc-example-prost" version = "0.2.0" authors = ["The AntFin Kata Team "] edition = "2018" +rust-version = "1.80" license = "Apache-2.0" keywords = ["ttrpc", "protobuf", "rpc", "prost"] description = "An example of ttrpc using the Prost backend." diff --git a/example/Cargo.toml b/example/Cargo.toml index 2b851c36..8c89f439 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -3,6 +3,7 @@ name = "ttrpc-example" version = "0.2.0" authors = ["The AntFin Kata Team "] edition = "2018" +rust-version = "1.80" license = "Apache-2.0" keywords = ["ttrpc", "protobuf", "rpc"] readme = "README.md" diff --git a/ttrpc-codegen-prost/Cargo.toml b/ttrpc-codegen-prost/Cargo.toml index 9d7825b0..97b41c9d 100644 --- a/ttrpc-codegen-prost/Cargo.toml +++ b/ttrpc-codegen-prost/Cargo.toml @@ -2,7 +2,7 @@ name = "ttrpc-codegen-prost" version = "0.1.0" edition = "2021" -rust-version = "1.85" +rust-version = "1.80" authors = ["The Ant Group Kata Team "] license = "Apache-2.0" keywords = ["codegen", "ttrpc", "protobuf"] From 8f3ffcc06a7be7d72d01fc8df46a6d1487f687ab Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Wed, 23 Sep 2026 19:12:29 +0800 Subject: [PATCH 2/5] build: resolve dependencies with Cargo 1.80 Constrain transitive dependencies that otherwise select releases requiring newer Cargo. Resolve and test from a clean checkout with only the Rust 1.80 toolchain. Signed-off-by: Tim Zhang --- .github/workflows/bvt.yml | 7 ------- Cargo.toml | 8 ++++++-- compiler/Cargo.toml | 5 ++--- example/Cargo.toml | 4 +++- ttrpc-codegen-prost/Cargo.toml | 3 +++ ttrpc-codegen/Cargo.toml | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/bvt.yml b/.github/workflows/bvt.yml index a51ba07a..bb2d7259 100644 --- a/.github/workflows/bvt.yml +++ b/.github/workflows/bvt.yml @@ -16,13 +16,6 @@ jobs: - name: Install Rust run: | rustup toolchain install 1.80.0 --profile minimal - rustup toolchain install 1.85.0 --profile minimal - - name: Resolve Rust 1.80 compatible dependencies - run: | - # Cargo 1.80 cannot use the MSRV-aware fallback resolver. - RUSTUP_TOOLCHAIN=1.85.0 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo generate-lockfile - RUSTUP_TOOLCHAIN=1.85.0 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo generate-lockfile --manifest-path ttrpc-codegen-prost/Cargo.toml - RUSTUP_TOOLCHAIN=1.85.0 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo generate-lockfile --manifest-path example-prost/Cargo.toml - name: Install Protoc run: ./install_protoc.sh shell: bash diff --git a/Cargo.toml b/Cargo.toml index ab78f6c9..81311088 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,6 +73,10 @@ tokio-vsock = { version = "0.7.0", optional = true } home = "=0.5.9" protobuf-codegen = { workspace = true, optional = true } prost-build = { version = "0.13", optional = true } +# Newer tempfile selects getrandom 0.4, which Cargo 1.80 cannot parse. +tempfile = { version = ">=3.0, <3.25", optional = true } +# Newer indexmap releases require a newer Rust/Cargo toolchain. +indexmap = { version = ">=2.0, <2.12", optional = true } [dev-dependencies] ttrpc-codegen = { workspace = true } @@ -81,8 +85,8 @@ ttrpc-codegen = { workspace = true } default = ["sync","rustprotobuf"] async = ["async-trait", "async-stream", "tokio", "futures", "tokio-vsock"] sync = [] -rustprotobuf = ["dep:protobuf", "dep:protobuf-codegen"] -prost = ["dep:prost", "dep:prost-build"] +rustprotobuf = ["dep:protobuf", "dep:protobuf-codegen", "dep:tempfile"] +prost = ["dep:prost", "dep:prost-build", "dep:tempfile", "dep:indexmap"] security_extension = [] [package.metadata.docs.rs] diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 4d4867f0..c3fb2438 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -15,9 +15,8 @@ homepage = "https://github.com/containerd/ttrpc-rust/tree/master/compiler" [dependencies] protobuf = { workspace = true } protobuf-codegen = { workspace = true } - -[dev-dependencies] -tempfile = "3.0" +# Constrain protobuf-codegen's tempfile for downstream Cargo 1.80 users. +tempfile = ">=3.0, <3.25" [[bin]] name = "ttrpc_rust_plugin" diff --git a/example/Cargo.toml b/example/Cargo.toml index 8c89f439..b95349a9 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -21,7 +21,9 @@ ctrlc = { version = "3.0", features = ["termination"] } tokio = { version = "1.0.1", features = ["signal", "time", "rt-multi-thread", "macros"] } async-trait = "0.1.42" rand = "0.8.5" -clap = { version = "4.5.40", features = ["derive"] } +clap = { version = ">=4.5.40, <4.6", features = ["derive"] } +# clap 4.5 accepts clap_lex 1.1, whose 2024 edition needs newer Cargo. +clap_lex = ">=1.0, <1.1" [[example]] name = "client" diff --git a/ttrpc-codegen-prost/Cargo.toml b/ttrpc-codegen-prost/Cargo.toml index 97b41c9d..7eab639b 100644 --- a/ttrpc-codegen-prost/Cargo.toml +++ b/ttrpc-codegen-prost/Cargo.toml @@ -24,3 +24,6 @@ prost-types = "0.13" prost-build = "0.13" proc-macro2 = "1.0" quote = "1.0" +# Keep transitive prost-build dependencies compatible with Cargo 1.80. +tempfile = ">=3.0, <3.25" +indexmap = ">=2.0, <2.12" diff --git a/ttrpc-codegen/Cargo.toml b/ttrpc-codegen/Cargo.toml index 3b69a057..ce1cd48a 100644 --- a/ttrpc-codegen/Cargo.toml +++ b/ttrpc-codegen/Cargo.toml @@ -20,4 +20,4 @@ protobuf-parse = { workspace = true } ttrpc-compiler = { workspace = true } [dev-dependencies] -tempfile = "3" +tempfile = ">=3.0, <3.25" From 38a97236c06a775713592a8f4097223d6fcc6f85 Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Wed, 23 Sep 2026 21:32:41 +0800 Subject: [PATCH 3/5] build: scope Rust 1.80 dependency bounds to tests Keep Rust 1.80 CI on compatible tempfile and indexmap releases without imposing those upper bounds on downstream users. Document consumer-side constraints and check fresh consumers. Signed-off-by: Tim Zhang --- .github/workflows/bvt.yml | 28 ++++++++++++++++++++++++++++ Cargo.toml | 12 ++++++------ README.md | 3 +++ compiler/Cargo.toml | 4 +++- example-prost/Cargo.toml | 6 ++++++ ttrpc-codegen-prost/Cargo.toml | 5 ++++- ttrpc-codegen-prost/README.md | 3 +++ ttrpc-codegen/Cargo.toml | 1 + 8 files changed, 54 insertions(+), 8 deletions(-) diff --git a/.github/workflows/bvt.yml b/.github/workflows/bvt.yml index bb2d7259..593aa756 100644 --- a/.github/workflows/bvt.yml +++ b/.github/workflows/bvt.yml @@ -23,8 +23,36 @@ jobs: run: | cargo test --workspace --features async,sync,security_extension cargo test -p ttrpc --no-default-features --features sync,async,prost + cargo check -p ttrpc-example --examples cargo test --manifest-path ttrpc-codegen-prost/Cargo.toml cargo check --manifest-path example-prost/Cargo.toml --examples + - name: Check fresh downstream resolution + run: | + for backend in rustprotobuf prost; do + consumer_dir=$(mktemp -d) + mkdir "$consumer_dir/src" + if [ "$backend" = rustprotobuf ]; then + dependency="ttrpc = { path = \"$GITHUB_WORKSPACE\" }" + else + dependency="ttrpc = { path = \"$GITHUB_WORKSPACE\", default-features = false, features = [\"sync\", \"async\", \"prost\"] }" + fi + cat > "$consumer_dir/Cargo.toml" < "$consumer_dir/src/main.rs" + cargo check --manifest-path "$consumer_dir/Cargo.toml" + done check: name: Check diff --git a/Cargo.toml b/Cargo.toml index 81311088..37a0dc61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,20 +73,20 @@ tokio-vsock = { version = "0.7.0", optional = true } home = "=0.5.9" protobuf-codegen = { workspace = true, optional = true } prost-build = { version = "0.13", optional = true } -# Newer tempfile selects getrandom 0.4, which Cargo 1.80 cannot parse. -tempfile = { version = ">=3.0, <3.25", optional = true } -# Newer indexmap releases require a newer Rust/Cargo toolchain. -indexmap = { version = ">=2.0, <2.12", optional = true } [dev-dependencies] ttrpc-codegen = { workspace = true } +# Newer tempfile selects getrandom 0.4, which Cargo 1.80 cannot parse. +tempfile = ">=3.0, <3.25" +# Newer indexmap releases require a newer Rust/Cargo toolchain. +indexmap = ">=2.0, <2.12" [features] default = ["sync","rustprotobuf"] async = ["async-trait", "async-stream", "tokio", "futures", "tokio-vsock"] sync = [] -rustprotobuf = ["dep:protobuf", "dep:protobuf-codegen", "dep:tempfile"] -prost = ["dep:prost", "dep:prost-build", "dep:tempfile", "dep:indexmap"] +rustprotobuf = ["dep:protobuf", "dep:protobuf-codegen"] +prost = ["dep:prost", "dep:prost-build"] security_extension = [] [package.metadata.docs.rs] diff --git a/README.md b/README.md index e2c34e08..6380f404 100644 --- a/README.md +++ b/README.md @@ -259,6 +259,9 @@ ttrpc does not provide TLS. If you expose TCP beyond a trusted boundary, secure ## Compatibility - Runtime and code generators minimum supported Rust version: **1.80** +- With Rust 1.80, a fresh dependency resolution may select transitive crates + requiring a newer toolchain. If needed, constrain `tempfile` to `<3.25` and + `indexmap` to `<2.12` in your application's `Cargo.toml`. - Repository development toolchain: see [`rust-toolchain.toml`](https://github.com/containerd/ttrpc-rust/blob/master/rust-toolchain.toml) - Default features: `sync`, `rustprotobuf` - Optional features: `async`, `prost`, `security_extension` (Unix only) diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index c3fb2438..64de359f 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -15,7 +15,9 @@ homepage = "https://github.com/containerd/ttrpc-rust/tree/master/compiler" [dependencies] protobuf = { workspace = true } protobuf-codegen = { workspace = true } -# Constrain protobuf-codegen's tempfile for downstream Cargo 1.80 users. + +[dev-dependencies] +# Newer tempfile selects getrandom 0.4, which Cargo 1.80 cannot parse. tempfile = ">=3.0, <3.25" [[bin]] diff --git a/example-prost/Cargo.toml b/example-prost/Cargo.toml index e4247f8d..af80b57f 100644 --- a/example-prost/Cargo.toml +++ b/example-prost/Cargo.toml @@ -26,6 +26,12 @@ rand = "0.8.5" [build-dependencies] ttrpc-codegen-prost = { version = "0.1.0", path = "../ttrpc-codegen-prost" } +[dev-dependencies] +# Newer tempfile selects getrandom 0.4, which Cargo 1.80 cannot parse. +tempfile = ">=3.0, <3.25" +# Newer indexmap releases require a newer Rust/Cargo toolchain. +indexmap = ">=2.0, <2.12" + [[example]] name = "client" path = "./client.rs" diff --git a/ttrpc-codegen-prost/Cargo.toml b/ttrpc-codegen-prost/Cargo.toml index 7eab639b..f30be6e4 100644 --- a/ttrpc-codegen-prost/Cargo.toml +++ b/ttrpc-codegen-prost/Cargo.toml @@ -24,6 +24,9 @@ prost-types = "0.13" prost-build = "0.13" proc-macro2 = "1.0" quote = "1.0" -# Keep transitive prost-build dependencies compatible with Cargo 1.80. + +[dev-dependencies] +# Newer tempfile selects getrandom 0.4, which Cargo 1.80 cannot parse. tempfile = ">=3.0, <3.25" +# Newer indexmap releases require a newer Rust/Cargo toolchain. indexmap = ">=2.0, <2.12" diff --git a/ttrpc-codegen-prost/README.md b/ttrpc-codegen-prost/README.md index 063239a8..2a099f6f 100644 --- a/ttrpc-codegen-prost/README.md +++ b/ttrpc-codegen-prost/README.md @@ -3,6 +3,9 @@ This standalone crate generates Prost messages and ttrpc clients, server traits, and service registration helpers from `.proto` files. It requires `protoc` on `PATH` and uses Prost 0.13. The runtime must also use the `prost` backend. +Rust 1.80 users may need to constrain `tempfile` to `<3.25` and `indexmap` to +`<2.12` in their application's `Cargo.toml` when resolving dependencies afresh. + The separate `ttrpc-codegen` package continues to use rust-protobuf. This generator was previously an unpublished package with the same name; its first release is planned as `ttrpc-codegen-prost` 0.1.0. diff --git a/ttrpc-codegen/Cargo.toml b/ttrpc-codegen/Cargo.toml index ce1cd48a..ceb1a31c 100644 --- a/ttrpc-codegen/Cargo.toml +++ b/ttrpc-codegen/Cargo.toml @@ -20,4 +20,5 @@ protobuf-parse = { workspace = true } ttrpc-compiler = { workspace = true } [dev-dependencies] +# Newer tempfile selects getrandom 0.4, which Cargo 1.80 cannot parse. tempfile = ">=3.0, <3.25" From 23c78f7c82a9f795b6cf3c7ded6e7734a608836f Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Wed, 23 Sep 2026 21:41:30 +0800 Subject: [PATCH 4/5] ci: simplify Rust 1.80 validation Drop the separate consumer fixture from the MSRV job. The crate checks cover our supported code; downstream users control transitive dependency resolution in their own projects. Signed-off-by: Tim Zhang --- .github/workflows/bvt.yml | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/.github/workflows/bvt.yml b/.github/workflows/bvt.yml index 593aa756..0b5ab3b5 100644 --- a/.github/workflows/bvt.yml +++ b/.github/workflows/bvt.yml @@ -26,33 +26,6 @@ jobs: cargo check -p ttrpc-example --examples cargo test --manifest-path ttrpc-codegen-prost/Cargo.toml cargo check --manifest-path example-prost/Cargo.toml --examples - - name: Check fresh downstream resolution - run: | - for backend in rustprotobuf prost; do - consumer_dir=$(mktemp -d) - mkdir "$consumer_dir/src" - if [ "$backend" = rustprotobuf ]; then - dependency="ttrpc = { path = \"$GITHUB_WORKSPACE\" }" - else - dependency="ttrpc = { path = \"$GITHUB_WORKSPACE\", default-features = false, features = [\"sync\", \"async\", \"prost\"] }" - fi - cat > "$consumer_dir/Cargo.toml" < "$consumer_dir/src/main.rs" - cargo check --manifest-path "$consumer_dir/Cargo.toml" - done check: name: Check From d67693aa9309e27647e71075980e93d4f20e4d22 Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Wed, 23 Sep 2026 21:52:50 +0800 Subject: [PATCH 5/5] docs: clarify dependency bounds for older Rust MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Describe the different indexmap limits for Rust 1.80–1.81 and 1.82–1.84. Keep the guidance in the root README only. Signed-off-by: Tim Zhang --- README.md | 7 ++++--- ttrpc-codegen-prost/README.md | 3 --- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6380f404..2169e3fe 100644 --- a/README.md +++ b/README.md @@ -259,9 +259,10 @@ ttrpc does not provide TLS. If you expose TCP beyond a trusted boundary, secure ## Compatibility - Runtime and code generators minimum supported Rust version: **1.80** -- With Rust 1.80, a fresh dependency resolution may select transitive crates - requiring a newer toolchain. If needed, constrain `tempfile` to `<3.25` and - `indexmap` to `<2.12` in your application's `Cargo.toml`. +- With Rust 1.80–1.84, a fresh dependency resolution may select transitive + crates requiring a newer toolchain. If needed, constrain `tempfile` to + `<3.25` in your application's `Cargo.toml`. For `indexmap`, use `<2.12` on + Rust 1.80–1.81 or `<2.14` on Rust 1.82–1.84. - Repository development toolchain: see [`rust-toolchain.toml`](https://github.com/containerd/ttrpc-rust/blob/master/rust-toolchain.toml) - Default features: `sync`, `rustprotobuf` - Optional features: `async`, `prost`, `security_extension` (Unix only) diff --git a/ttrpc-codegen-prost/README.md b/ttrpc-codegen-prost/README.md index 2a099f6f..063239a8 100644 --- a/ttrpc-codegen-prost/README.md +++ b/ttrpc-codegen-prost/README.md @@ -3,9 +3,6 @@ This standalone crate generates Prost messages and ttrpc clients, server traits, and service registration helpers from `.proto` files. It requires `protoc` on `PATH` and uses Prost 0.13. The runtime must also use the `prost` backend. -Rust 1.80 users may need to constrain `tempfile` to `<3.25` and `indexmap` to -`<2.12` in their application's `Cargo.toml` when resolving dependencies afresh. - The separate `ttrpc-codegen` package continues to use rust-protobuf. This generator was previously an unpublished package with the same name; its first release is planned as `ttrpc-codegen-prost` 0.1.0.