Skip to content

Commit

Permalink
Remove the unused implicit attribute _cc_toolchains.
Browse files Browse the repository at this point in the history
CC toolchains are gathered from the line:
```
toolchains = use_cc_toolchains(),
```

Keep toolchain usage of _cc_toolchain with a TODO to remove it.

See #3115 for details.
  • Loading branch information
katre committed Dec 17, 2024
1 parent 7a1f037 commit b4d640d
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 45 deletions.
3 changes: 0 additions & 3 deletions cargo/private/cargo_build_script.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,6 @@ cargo_build_script = rule(
"_cargo_manifest_dir_filename_suffixes_to_retain": attr.label(
default = Label("//cargo/settings:cargo_manifest_dir_filename_suffixes_to_retain"),
),
"_cc_toolchain": attr.label(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_debug_std_streams_output_group": attr.label(
default = Label("//cargo/settings:debug_std_streams_output_group"),
),
Expand Down
3 changes: 0 additions & 3 deletions extensions/bindgen/private/bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,6 @@ rust_bindgen = rule(
doc = "Whether to create a separate .c file for static fns. Requires nightly toolchain, and a header that actually needs this feature (otherwise bindgen won't generate the file and Bazel complains).",
default = False,
),
"_cc_toolchain": attr.label(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_process_wrapper": attr.label(
default = Label("@rules_rust//util/process_wrapper"),
executable = True,
Expand Down
3 changes: 0 additions & 3 deletions extensions/protobuf/proto.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,6 @@ rust_proto_library = rule(
file of arguments to rustc: `@$(location //package:target)`.
""",
),
"_cc_toolchain": attr.label(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_optional_output_wrapper": attr.label(
executable = True,
cfg = "exec",
Expand Down
7 changes: 0 additions & 7 deletions rust/private/clippy.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,6 @@ rust_clippy_aspect = aspect(
doc = "Value of the `capture_clippy_output` build setting",
default = Label("//rust/settings:capture_clippy_output"),
),
"_cc_toolchain": attr.label(
doc = (
"Required attribute to access the cc_toolchain. See [Accessing the C++ toolchain]" +
"(https://docs.bazel.build/versions/master/integrating-with-rules-cc.html#accessing-the-c-toolchain)"
),
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_clippy_flag": attr.label(
doc = "Arguments to pass to clippy." +
"Multiple uses are accumulated and appended after the extra_rustc_flags.",
Expand Down
8 changes: 0 additions & 8 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,6 @@ def _stamp_attribute(default_value):

# Internal attributes core to Rustc actions.
RUSTC_ATTRS = {
"_cc_toolchain": attr.label(
doc = (
"In order to use find_cc_toolchain, your rule has to depend " +
"on C++ toolchain. See `@rules_cc//cc:find_cc_toolchain.bzl` " +
"docs for details."
),
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_error_format": attr.label(
default = Label("//rust/settings:error_format"),
),
Expand Down
4 changes: 0 additions & 4 deletions rust/private/rustdoc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,6 @@ rust_doc = rule(
file of arguments to rustc: `@$(location //package:target)`.
"""),
),
"_cc_toolchain": attr.label(
doc = "In order to use find_cpp_toolchain, you must define the '_cc_toolchain' attribute on your rule or aspect.",
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_dir_zipper": attr.label(
doc = "A tool that orchestrates the creation of zip archives for rustdoc outputs.",
default = Label("//util/dir_zipper"),
Expand Down
8 changes: 0 additions & 8 deletions rust/private/rustdoc_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,6 @@ rust_doc_test = rule(
cfg = "exec",
providers = [rust_common.crate_info],
),
"_cc_toolchain": attr.label(
doc = (
"In order to use find_cc_toolchain, your rule has to depend " +
"on C++ toolchain. See @rules_cc//cc:find_cc_toolchain.bzl " +
"docs for details."
),
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_process_wrapper": attr.label(
doc = "A process wrapper for running rustdoc on all platforms",
cfg = "exec",
Expand Down
1 change: 1 addition & 0 deletions rust/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ rust_toolchain = rule(
"For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations"
),
),
# TODO: #3115 - Remove this attribute.
"_cc_toolchain": attr.label(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
Expand Down
3 changes: 0 additions & 3 deletions test/unit/consistent_crate_name/with_modified_crate_name.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ with_modified_crate_name = rule(
"src": attr.label(
allow_single_file = [".rs"],
),
"_cc_toolchain": attr.label(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_error_format": attr.label(
default = Label("//rust/settings:error_format"),
),
Expand Down
3 changes: 0 additions & 3 deletions test/unit/force_all_deps_direct/generator.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ generator = rule(
doc = "List of other libraries to be linked to this library target.",
providers = [CrateInfo],
),
"_cc_toolchain": attr.label(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_error_format": attr.label(
default = Label("//rust/settings:error_format"),
),
Expand Down
3 changes: 0 additions & 3 deletions test/unit/pipelined_compilation/wrap.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ wrap = rule(
"crate_name": attr.string(),
"generate_metadata": attr.bool(default = False),
"target": attr.label(),
"_cc_toolchain": attr.label(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_error_format": attr.label(
default = Label("//rust/settings:error_format"),
),
Expand Down

0 comments on commit b4d640d

Please sign in to comment.