From b51ec2d541fec58ecad135ca83f0841be6191451 Mon Sep 17 00:00:00 2001 From: Nicolas Lopez Date: Mon, 16 Dec 2024 17:38:35 -0500 Subject: [PATCH] Add rustc env to rust toolchain --- prelude/rust/build.bzl | 2 +- prelude/rust/rust_toolchain.bzl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/prelude/rust/build.bzl b/prelude/rust/build.bzl index 9294a7a9f4d0c..646d22c81871b 100644 --- a/prelude/rust/build.bzl +++ b/prelude/rust/build.bzl @@ -1352,7 +1352,7 @@ def _rustc_invoke( toolchain_info = compile_ctx.toolchain_info - plain_env, path_env = process_env(compile_ctx, ctx.attrs.env, exec_is_windows) + plain_env, path_env = process_env(compile_ctx, toolchain_info.rustc_env |ctx.attrs.env, exec_is_windows) more_plain_env, more_path_env = process_env(compile_ctx, env, exec_is_windows) plain_env.update(more_plain_env) diff --git a/prelude/rust/rust_toolchain.bzl b/prelude/rust/rust_toolchain.bzl index a69e40d69ae4d..48d16d5f29d51 100644 --- a/prelude/rust/rust_toolchain.bzl +++ b/prelude/rust/rust_toolchain.bzl @@ -53,6 +53,8 @@ rust_toolchain_attrs = { # FIXME(JakobDegen): Can't use `list[str]` here, because then the default is wrong, but can't # use a non-empty list as the default because lists are mutable "rustc_coverage_flags": provider_field(typing.Any, default = ("-Cinstrument-coverage",)), + # Extra env variables that should be made available to the rustc executable. + "rustc_env": provider_field(dict[str, typing.Any], default = {}), # Extra env variables that should be made available to the rustdoc executable. "rustdoc_env": provider_field(dict[str, typing.Any], default = {}), # Extra flags for rustdoc invocations