aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Pudlik <tpudlik@gmail.com>2024-02-23 02:27:34 -0800
committerGitHub <noreply@github.com>2024-02-23 10:27:34 +0000
commit0e0241e9b0e4122f1e28a1ca0d358dd987f21971 (patch)
tree9b7ffe4b3f7ba70fe5e3cc4cdfa3c7a6a2c3c589
parentcf5f0bd888aaf576978ccc16a3fbf8cecaaf0d52 (diff)
downloadbazelbuild-rules_rust-0e0241e9b0e4122f1e28a1ca0d358dd987f21971.tar.gz
Introduce rules_rust_unsupported_feature (#2511)
Add a special sentinel feature name to the UNSUPPORTED_FEATURES list. This feature name can be used by authors of C++ toolchain configurations to house any configuration fragments (e.g., linker flags) that should NOT be applied when linking Rust targets. The specific motivation for this is that I'm working on a project that includes `-fsanitize=address` in its clang configuration. This needs to be disabled when linking Rust. I tried the more straightforward approach of adding the `features` attribute to `rust_binary` targets in my repo, but this is not sufficient: a `rust_binary` has implicit deps on targets like @rules_rust//util/process_wrapper:bootstrap_process_wrapper.
-rw-r--r--rust/private/utils.bzl4
1 files changed, 4 insertions, 0 deletions
diff --git a/rust/private/utils.bzl b/rust/private/utils.bzl
index 748370da..783aa222 100644
--- a/rust/private/utils.bzl
+++ b/rust/private/utils.bzl
@@ -24,6 +24,10 @@ UNSUPPORTED_FEATURES = [
"use_header_modules",
"fdo_instrument",
"fdo_optimize",
+ # This feature is unsupported by definition. The authors of C++ toolchain
+ # configuration can place any linker flags that should not be applied when
+ # linking Rust targets in a feature with this name.
+ "rules_rust_unsupported_feature",
]
def find_toolchain(ctx):