Skip to content

Commit dc9ca99

Browse files
authored
Added version to rust_toolchain (#3952)
1 parent 90a19fa commit dc9ca99

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

rust/private/repository_utils.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ rust_toolchain(
368368
extra_exec_rustc_flags = {extra_exec_rustc_flags},
369369
opt_level = {opt_level},
370370
strip_level = {strip_level},
371+
version = "{version}",
371372
tags = ["rust_version={version}"],
372373
)
373374
"""

rust/toolchain.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ def _rust_toolchain_impl(ctx):
611611
target_os = target_os,
612612
target_abi = target_abi,
613613
target_triple = target_triple,
614+
version = ctx.attr.version,
614615
require_explicit_unstable_features = _require_explicit_unstable_features(ctx),
615616

616617
# Experimental and incompatible flags
@@ -842,6 +843,10 @@ rust_toolchain = rule(
842843
"For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations"
843844
),
844845
),
846+
"version": attr.string(
847+
doc = "The version of the Rust compiler. (E.g. `1.94.1`, nightly/2026-03-26`)",
848+
default = "",
849+
),
845850
"_codegen_units": attr.label(
846851
default = Label("//rust/settings:codegen_units"),
847852
),

0 commit comments

Comments
 (0)