Skip to content

Commit b401d8f

Browse files
committed
Use correct env for rust_test
This expands the `rust_test` environment make variables directly instead of using the "build script" helper. The build script helper is incorrect here and this leads issues in Bazel 8.
1 parent 3cbb3fc commit b401d8f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

rust/private/rust.bzl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -516,14 +516,15 @@ def _rust_test_impl(ctx):
516516
rust_flags = get_rust_test_flags(ctx.attr),
517517
skip_expanding_rustc_env = True,
518518
)
519-
data = getattr(ctx.attr, "data", [])
520519

521-
env = expand_dict_value_locations(
522-
ctx,
523-
getattr(ctx.attr, "env", {}),
524-
data,
525-
{},
526-
)
520+
env = {
521+
key: ctx.expand_make_variables(
522+
"env",
523+
ctx.expand_location(value, ctx.attr.data, short_paths = True),
524+
{},
525+
)
526+
for key, value in ctx.attr.env.items()
527+
}
527528
if toolchain.llvm_cov and ctx.configuration.coverage_enabled:
528529
if not toolchain.llvm_profdata:
529530
fail("toolchain.llvm_profdata is required if toolchain.llvm_cov is set.")

0 commit comments

Comments
 (0)