Remove _rustc_env_attr from CrateInfo (#2189)
#2188's follow-up PR to remove unused `_rustc_env_attr` field in
`CrateInfo` provider. We can rely on `skip_expanding_rustc_env` to
determine whether `rustc_env` is already expanded or not.
diff --git a/docs/flatten.md b/docs/flatten.md
index 49ed515..03a23a9 100644
--- a/docs/flatten.md
+++ b/docs/flatten.md
@@ -1450,7 +1450,7 @@
<pre>
CrateInfo(<a href="#CrateInfo-aliases">aliases</a>, <a href="#CrateInfo-compile_data">compile_data</a>, <a href="#CrateInfo-compile_data_targets">compile_data_targets</a>, <a href="#CrateInfo-data">data</a>, <a href="#CrateInfo-deps">deps</a>, <a href="#CrateInfo-edition">edition</a>, <a href="#CrateInfo-is_test">is_test</a>, <a href="#CrateInfo-metadata">metadata</a>, <a href="#CrateInfo-name">name</a>,
<a href="#CrateInfo-output">output</a>, <a href="#CrateInfo-owner">owner</a>, <a href="#CrateInfo-proc_macro_deps">proc_macro_deps</a>, <a href="#CrateInfo-root">root</a>, <a href="#CrateInfo-rustc_env">rustc_env</a>, <a href="#CrateInfo-rustc_env_files">rustc_env_files</a>, <a href="#CrateInfo-srcs">srcs</a>, <a href="#CrateInfo-type">type</a>,
- <a href="#CrateInfo-wrapped_crate_type">wrapped_crate_type</a>, <a href="#CrateInfo-_rustc_env_attr">_rustc_env_attr</a>)
+ <a href="#CrateInfo-wrapped_crate_type">wrapped_crate_type</a>)
</pre>
A provider containing general Crate information.
@@ -1478,7 +1478,6 @@
| <a id="CrateInfo-srcs"></a>srcs | depset[File]: All source Files that are part of the crate. |
| <a id="CrateInfo-type"></a>type | str: The type of this crate (see [rustc --crate-type](https://doc.rust-lang.org/rustc/command-line-arguments.html#--crate-type-a-list-of-types-of-crates-for-the-compiler-to-emit)). |
| <a id="CrateInfo-wrapped_crate_type"></a>wrapped_crate_type | str, optional: The original crate type for targets generated using a previously defined crate (typically tests using the <code>rust_test::crate</code> attribute) |
-| <a id="CrateInfo-_rustc_env_attr"></a>_rustc_env_attr | Dict[String, String]: Additional <code>"key": "value"</code> environment variables to set for rustc. |
<a id="DepInfo"></a>
diff --git a/docs/providers.md b/docs/providers.md
index e553ffb..c97ad9b 100644
--- a/docs/providers.md
+++ b/docs/providers.md
@@ -12,7 +12,7 @@
<pre>
CrateInfo(<a href="#CrateInfo-aliases">aliases</a>, <a href="#CrateInfo-compile_data">compile_data</a>, <a href="#CrateInfo-compile_data_targets">compile_data_targets</a>, <a href="#CrateInfo-data">data</a>, <a href="#CrateInfo-deps">deps</a>, <a href="#CrateInfo-edition">edition</a>, <a href="#CrateInfo-is_test">is_test</a>, <a href="#CrateInfo-metadata">metadata</a>, <a href="#CrateInfo-name">name</a>,
<a href="#CrateInfo-output">output</a>, <a href="#CrateInfo-owner">owner</a>, <a href="#CrateInfo-proc_macro_deps">proc_macro_deps</a>, <a href="#CrateInfo-root">root</a>, <a href="#CrateInfo-rustc_env">rustc_env</a>, <a href="#CrateInfo-rustc_env_files">rustc_env_files</a>, <a href="#CrateInfo-srcs">srcs</a>, <a href="#CrateInfo-type">type</a>,
- <a href="#CrateInfo-wrapped_crate_type">wrapped_crate_type</a>, <a href="#CrateInfo-_rustc_env_attr">_rustc_env_attr</a>)
+ <a href="#CrateInfo-wrapped_crate_type">wrapped_crate_type</a>)
</pre>
A provider containing general Crate information.
@@ -40,7 +40,6 @@
| <a id="CrateInfo-srcs"></a>srcs | depset[File]: All source Files that are part of the crate. |
| <a id="CrateInfo-type"></a>type | str: The type of this crate (see [rustc --crate-type](https://doc.rust-lang.org/rustc/command-line-arguments.html#--crate-type-a-list-of-types-of-crates-for-the-compiler-to-emit)). |
| <a id="CrateInfo-wrapped_crate_type"></a>wrapped_crate_type | str, optional: The original crate type for targets generated using a previously defined crate (typically tests using the <code>rust_test::crate</code> attribute) |
-| <a id="CrateInfo-_rustc_env_attr"></a>_rustc_env_attr | Dict[String, String]: Additional <code>"key": "value"</code> environment variables to set for rustc. |
<a id="DepInfo"></a>
diff --git a/proto/prost/private/prost.bzl b/proto/prost/private/prost.bzl
index 1db2002..b070227 100644
--- a/proto/prost/private/prost.bzl
+++ b/proto/prost/private/prost.bzl
@@ -173,7 +173,6 @@
edition = edition,
is_test = False,
rustc_env = {},
- _rustc_env_attr = {},
compile_data = depset([]),
compile_data_targets = depset([]),
owner = ctx.label,
diff --git a/proto/protobuf/proto.bzl b/proto/protobuf/proto.bzl
index 6ff45cc..a45b3f2 100644
--- a/proto/protobuf/proto.bzl
+++ b/proto/protobuf/proto.bzl
@@ -225,7 +225,6 @@
metadata = rust_metadata,
edition = proto_toolchain.edition,
rustc_env = {},
- _rustc_env_attr = {},
is_test = False,
compile_data = depset([target.files for target in getattr(ctx.attr, "compile_data", [])]),
compile_data_targets = depset(getattr(ctx.attr, "compile_data", [])),
diff --git a/rust/private/providers.bzl b/rust/private/providers.bzl
index b2fced7..e4db9c9 100644
--- a/rust/private/providers.bzl
+++ b/rust/private/providers.bzl
@@ -41,8 +41,6 @@
"str, optional: The original crate type for targets generated using a previously defined " +
"crate (typically tests using the `rust_test::crate` attribute)"
),
- # TODO: Remove `_rustc_env_attr` after refactoring rust_test to only rely on rustc_env
- "_rustc_env_attr": "Dict[String, String]: Additional `\"key\": \"value\"` environment variables to set for rustc.",
},
)
diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl
index 2914f4c..6f375de 100644
--- a/rust/private/rust.bzl
+++ b/rust/private/rust.bzl
@@ -200,7 +200,6 @@
compile_data = depset(ctx.files.compile_data),
compile_data_targets = depset(ctx.attr.compile_data),
owner = ctx.label,
- _rustc_env_attr = ctx.attr.rustc_env,
),
)
@@ -241,7 +240,6 @@
aliases = ctx.attr.aliases,
output = output,
edition = get_edition(ctx.attr, toolchain, ctx.label),
- _rustc_env_attr = ctx.attr.rustc_env,
rustc_env = ctx.attr.rustc_env,
rustc_env_files = ctx.files.rustc_env_files,
is_test = False,
@@ -295,9 +293,8 @@
compile_data_targets = depset(ctx.attr.compile_data)
rustc_env_files = ctx.files.rustc_env_files + crate.rustc_env_files
- rustc_env = dict(crate._rustc_env_attr)
-
# crate.rustc_env is already expanded upstream in rust_library rule implementation
+ rustc_env = dict(crate.rustc_env)
data_paths = depset(direct = getattr(ctx.attr, "data", [])).to_list()
rustc_env.update(expand_dict_value_locations(
ctx,
@@ -317,7 +314,6 @@
output = output,
edition = crate.edition,
rustc_env = rustc_env,
- _rustc_env_attr = ctx.attr.rustc_env,
rustc_env_files = rustc_env_files,
is_test = True,
compile_data = compile_data,
@@ -361,7 +357,6 @@
output = output,
edition = get_edition(ctx.attr, toolchain, ctx.label),
rustc_env = rustc_env,
- _rustc_env_attr = ctx.attr.rustc_env,
rustc_env_files = ctx.files.rustc_env_files,
is_test = True,
compile_data = depset(ctx.files.compile_data),
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl
index c972e47..9ba3115 100644
--- a/rust/private/rustc.bzl
+++ b/rust/private/rustc.bzl
@@ -1034,7 +1034,7 @@
else:
env.update(expand_dict_value_locations(
ctx,
- crate_info._rustc_env_attr,
+ crate_info.rustc_env,
data_paths,
))
diff --git a/rust/private/rustdoc.bzl b/rust/private/rustdoc.bzl
index dac24b3..1859c4a 100644
--- a/rust/private/rustdoc.bzl
+++ b/rust/private/rustdoc.bzl
@@ -39,7 +39,6 @@
output = None,
metadata = None,
edition = crate_info.edition,
- _rustc_env_attr = crate_info._rustc_env_attr,
rustc_env = crate_info.rustc_env,
rustc_env_files = crate_info.rustc_env_files,
is_test = crate_info.is_test,
diff --git a/rust/private/rustdoc_test.bzl b/rust/private/rustdoc_test.bzl
index f580c27..79b0f4d 100644
--- a/rust/private/rustdoc_test.bzl
+++ b/rust/private/rustdoc_test.bzl
@@ -122,7 +122,6 @@
output = crate.output,
edition = crate.edition,
rustc_env = crate.rustc_env,
- _rustc_env_attr = crate._rustc_env_attr,
rustc_env_files = crate.rustc_env_files,
is_test = True,
compile_data = crate.compile_data,
diff --git a/test/unit/consistent_crate_name/with_modified_crate_name.bzl b/test/unit/consistent_crate_name/with_modified_crate_name.bzl
index 7a3bca6..cd02617 100644
--- a/test/unit/consistent_crate_name/with_modified_crate_name.bzl
+++ b/test/unit/consistent_crate_name/with_modified_crate_name.bzl
@@ -47,7 +47,6 @@
compile_data = depset([]),
compile_data_targets = depset([]),
rustc_env = {},
- _rustc_env_attr = {},
is_test = False,
),
output_hash = output_hash,
diff --git a/test/unit/force_all_deps_direct/generator.bzl b/test/unit/force_all_deps_direct/generator.bzl
index 959687c..6501b36 100644
--- a/test/unit/force_all_deps_direct/generator.bzl
+++ b/test/unit/force_all_deps_direct/generator.bzl
@@ -63,7 +63,6 @@
compile_data = depset([]),
compile_data_targets = depset([]),
rustc_env = {},
- _rustc_env_attr = {},
is_test = False,
),
output_hash = output_hash,
diff --git a/test/unit/pipelined_compilation/wrap.bzl b/test/unit/pipelined_compilation/wrap.bzl
index 7ceef1c..9a7a2d2 100644
--- a/test/unit/pipelined_compilation/wrap.bzl
+++ b/test/unit/pipelined_compilation/wrap.bzl
@@ -73,7 +73,6 @@
compile_data = depset([]),
compile_data_targets = depset([]),
rustc_env = {},
- _rustc_env_attr = {},
is_test = False,
),
output_hash = output_hash,