Skip to content

Commit eac8c06

Browse files
acozzettecopybara-github
authored andcommitted
Use Rust 1.79 for Bazel and nightly for Cargo
We need to use a recent nightly release to be able to use the `--workspace` flag to `cargo publish`. Our minimum supported Rust version is 1.79, so I think we should test that version with Bazel to make sure we stay compatible. Our Bazel build is currently using 1.86 since that is the default from rules_rust, but this change explicitly selects 1.79. I also tried having Bazel use a more recent version, but unfortunately rules_rust is broken for 1.87 and up, due to name mangling changes in rustc: bazelbuild/rules_rust#3459 As soon as Rust 1.90 is released, we can start using that with Cargo instead of nightly. PiperOrigin-RevId: 793660982
1 parent 652b9c7 commit eac8c06

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.github/workflows/test_rust.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030

3131
# Override cases with custom images
3232
- config: { name: Cargo }
33-
image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:8.0.1-1.79.0-d271543f317955b5732ce19b2be672a195e96508"
33+
# We currently need to be on nightly to have access to the
34+
# multi-package publishing feature. This will be stabilized in
35+
# 1.90, so we should switch to that as soon as it is released.
36+
image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:8.0.1-nightly-2025-08-07-f0d1e209ed9369f69d93ce418990ecff3aa08d6f"
3437
bazel_cmd: "run"
3538
targets: "//rust/release_crates:cargo_test"
3639

MODULE.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ register_toolchains(
180180
dev_dependency = True,
181181
)
182182

183+
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust", dev_dependency = True)
184+
rust.toolchain(
185+
edition = "2021",
186+
versions = [ "1.79.0" ],
187+
)
188+
183189
crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate", dev_dependency = True)
184190
crate.spec(
185191
package = "googletest",

0 commit comments

Comments
 (0)