Remove unused rust.bzl file (#1002)
* Remove unused rust.bzl file
* Regenerate documentation
diff --git a/docs/flatten.md b/docs/flatten.md
index d06a070..78ce794 100644
--- a/docs/flatten.md
+++ b/docs/flatten.md
@@ -178,25 +178,6 @@
| <a id="extra_rustc_flags-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-<a id="#fail_when_enabled"></a>
-
-## fail_when_enabled
-
-<pre>
-fail_when_enabled(<a href="#fail_when_enabled-name">name</a>, <a href="#fail_when_enabled-flag">flag</a>)
-</pre>
-
-A rule that will fail analysis when a flag is enabled.
-
-**ATTRIBUTES**
-
-
-| Name | Description | Type | Mandatory | Default |
-| :------------- | :------------- | :------------- | :------------- | :------------- |
-| <a id="fail_when_enabled-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| <a id="fail_when_enabled-flag"></a>flag | The incompatible flag to check | String | required | |
-
-
<a id="#incompatible_flag"></a>
## incompatible_flag
diff --git a/docs/settings.md b/docs/settings.md
index 36a4805..4605272 100644
--- a/docs/settings.md
+++ b/docs/settings.md
@@ -4,25 +4,6 @@
* [incompatible_flag](#incompatible_flag)
* [fail_when_enabled](#fail_when_enabled)
-<a id="#fail_when_enabled"></a>
-
-## fail_when_enabled
-
-<pre>
-fail_when_enabled(<a href="#fail_when_enabled-name">name</a>, <a href="#fail_when_enabled-flag">flag</a>)
-</pre>
-
-A rule that will fail analysis when a flag is enabled.
-
-**ATTRIBUTES**
-
-
-| Name | Description | Type | Mandatory | Default |
-| :------------- | :------------- | :------------- | :------------- | :------------- |
-| <a id="fail_when_enabled-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| <a id="fail_when_enabled-flag"></a>flag | The incompatible flag to check | String | required | |
-
-
<a id="#incompatible_flag"></a>
## incompatible_flag
diff --git a/docs/symbols.bzl b/docs/symbols.bzl
index 01c5596..0d22dac 100644
--- a/docs/symbols.bzl
+++ b/docs/symbols.bzl
@@ -83,7 +83,6 @@
)
load(
"@rules_rust//rust/settings:incompatible.bzl",
- _fail_when_enabled = "fail_when_enabled",
_incompatible_flag = "incompatible_flag",
)
load(
@@ -147,7 +146,6 @@
error_format = _error_format
extra_rustc_flags = _extra_rustc_flags
incompatible_flag = _incompatible_flag
-fail_when_enabled = _fail_when_enabled
capture_clippy_output = _capture_clippy_output
CrateInfo = _CrateInfo
diff --git a/rust/BUILD.bazel b/rust/BUILD.bazel
index 2111b20..acf478e 100644
--- a/rust/BUILD.bazel
+++ b/rust/BUILD.bazel
@@ -5,7 +5,6 @@
exports_files([
"known_shas.bzl",
"repositories.bzl",
- "rust.bzl",
"defs.bzl",
"toolchain.bzl",
])
diff --git a/rust/private/common.bzl b/rust/private/common.bzl
index 16af470..7e1f189 100644
--- a/rust/private/common.bzl
+++ b/rust/private/common.bzl
@@ -17,7 +17,7 @@
This module is meant to be used by custom rules that need to compile Rust code
and cannot simply rely on writing a macro that wraps `rust_library`. This module
provides the lower-level interface to Rust providers, actions, and functions.
-Do not load this file directly; instead, load the top-level `rust.bzl` file,
+Do not load this file directly; instead, load the top-level `defs.bzl` file,
which exports the `rust_common` struct.
In the Bazel lingo, `rust_common` gives the access to the Rust Sandwich API.
diff --git a/rust/rust.bzl b/rust/rust.bzl
deleted file mode 100644
index 931015f..0000000
--- a/rust/rust.bzl
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright 2015 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Deprecated, please use //rust:defs.bzl."""
-
-load(
- "//rust:defs.bzl",
- _capture_clippy_output = "capture_clippy_output",
- _error_format = "error_format",
- _extra_rustc_flags = "extra_rustc_flags",
- _rust_analyzer = "rust_analyzer",
- _rust_analyzer_aspect = "rust_analyzer_aspect",
- _rust_binary = "rust_binary",
- _rust_clippy = "rust_clippy",
- _rust_clippy_aspect = "rust_clippy_aspect",
- _rust_common = "rust_common",
- _rust_doc = "rust_doc",
- _rust_doc_test = "rust_doc_test",
- _rust_library = "rust_library",
- _rust_proc_macro = "rust_proc_macro",
- _rust_shared_library = "rust_shared_library",
- _rust_static_library = "rust_static_library",
- _rust_test = "rust_test",
-)
-load("//rust/settings:incompatible.bzl", "fail_when_enabled")
-
-def rust_library(**args):
- """Deprecated. Use the version from "@rules_rust//rust:defs.bzl" instead.
-
- Args:
- **args: args to pass to the relevant rule.
-
- Returns:
- a target.
- """
- fail_when_enabled(
- name = "fail_" + args["name"],
- flag = "split_rust_library",
- )
-
- if "crate_type" in args:
- crate_type = args.pop("crate_type")
- if crate_type in ["lib", "rlib", "dylib"]:
- return _rust_library(**args)
- elif crate_type == "cdylib":
- return _rust_shared_library(**args)
- elif crate_type == "staticlib":
- return _rust_static_library(**args)
- elif crate_type == "proc-macro":
- return _rust_proc_macro(**args)
- else:
- fail("Unexpected crate_type: " + crate_type)
- else:
- return _rust_library(**args)
-
-rust_binary = _rust_binary
-# See @rules_rust//rust/private:rust.bzl for a complete description.
-
-rust_test = _rust_test
-# See @rules_rust//rust/private:rust.bzl for a complete description.
-
-rust_doc = _rust_doc
-# See @rules_rust//rust/private:rustdoc.bzl for a complete description.
-
-rust_doc_test = _rust_doc_test
-# See @rules_rust//rust/private:rustdoc_test.bzl for a complete description.
-
-rust_clippy_aspect = _rust_clippy_aspect
-# See @rules_rust//rust/private:clippy.bzl for a complete description.
-
-rust_clippy = _rust_clippy
-# See @rules_rust//rust:private/clippy.bzl for a complete description.
-
-capture_clippy_output = _capture_clippy_output
-# See @rules_rust//rust:private/clippy.bzl for a complete description.
-
-rust_analyzer_aspect = _rust_analyzer_aspect
-# See @rules_rust//rust:private/rust_analyzer.bzl for a complete description.
-
-rust_analyzer = _rust_analyzer
-# See @rules_rust//rust:private/rust_analyzer.bzl for a complete description.
-
-error_format = _error_format
-# See @rules_rust//rust/private:rustc.bzl for a complete description.
-
-extra_rustc_flags = _extra_rustc_flags
-# See @rules_rust//rust/private:rustc.bzl for a complete description.
-
-rust_common = _rust_common
-# See @rules_rust//rust/private:common.bzl for a complete description.
diff --git a/rust/settings/BUILD.bazel b/rust/settings/BUILD.bazel
index 091f79b..0def885 100644
--- a/rust/settings/BUILD.bazel
+++ b/rust/settings/BUILD.bazel
@@ -4,12 +4,6 @@
package(default_visibility = ["//visibility:public"])
incompatible_flag(
- name = "split_rust_library",
- build_setting_default = True,
- issue = "https://github.com/bazelbuild/rules_rust/issues/591",
-)
-
-incompatible_flag(
name = "incompatible_make_rust_providers_target_independent",
build_setting_default = True,
issue = "https://github.com/bazelbuild/rules_rust/issues/966",
diff --git a/rust/settings/incompatible.bzl b/rust/settings/incompatible.bzl
index e00ad0a..d1d3f16 100644
--- a/rust/settings/incompatible.bzl
+++ b/rust/settings/incompatible.bzl
@@ -25,21 +25,3 @@
),
},
)
-
-def _fail_when_enabled_impl(ctx):
- flag = ctx.attr.flag
- flag_info = getattr(ctx.attr, "_" + flag)[IncompatibleFlagInfo]
- if flag_info.enabled:
- fail("Incompatible flag {} has been flipped, see {} for details.".format(flag, flag_info.issue))
-
-fail_when_enabled = rule(
- doc = "A rule that will fail analysis when a flag is enabled.",
- implementation = _fail_when_enabled_impl,
- attrs = {
- "flag": attr.string(
- doc = "The incompatible flag to check",
- mandatory = True,
- ),
- "_split_rust_library": attr.label(default = "//rust/settings:split_rust_library"),
- },
-)