This directory contains Fuchsia-specific Rust wrapper macros, rules, and helpers for platform builds.
See Use Fuchsia-specific wrappers for general usage guidance. Load symbols directly from their individual .bzl files rather than the deprecated defs.bzl.
These wrappers apply Fuchsia-specific compiler flags, lint configurations, RBE properties, and standard library link dependencies, and are enforced by the bazel_fuchsia_wrappers SHAC check:
rustc_binary.bzl: Defines rustc_binary(), Fuchsia's wrapper macro for @rules_rust's rust_binary().rustc_dylib.bzl: Defines rustc_dylib(), Fuchsia's wrapper macro for @rules_rust's rust_dylib_library().rustc_library.bzl: Defines rustc_library(), Fuchsia's wrapper macro for @rules_rust's rust_library().rustc_library_group.bzl: Defines rustc_library_group(), Fuchsia's rule equivalent to @rules_rust's rust_library_group() with support for native link_deps.rustc_proc_macro.bzl: Defines rustc_proc_macro(), Fuchsia's wrapper macro for @rules_rust's rust_proc_macro().rustc_test.bzl: Defines rustc_test(), Fuchsia's wrapper macro for @rules_rust's rust_test().common.bzl: Shared helper functions used by the rustc_*() wrapper macros (e.g., with_fuchsia_rustc_flags(), with_fuchsia_rust_stdlib_link_deps()).defs.bzl: Deprecated re-export file. Do not load from or add to this file; load from the individual .bzl files instead.generate_unit_tests.bzl: Generates implicit unit test targets for legacy with_unit_tests and with_host_unit_tests attributes.rustc_bindgen.bzl: Defines rustc_bindgen_golden() and related rules/macros for running bindgen on C headers and verifying golden Rust bindings.rustc_check_cfg_build_flags.bzl: Defines rustc_check_cfg_build_flags(), a macro generating a build_flags() target with --check-cfg flags.rustc_embed_files.bzl: Defines rustc_embed_files(), a macro for embedding files as byte array constants in a Rust library.When adding a new Fuchsia wrapper macro or rule equivalent for an upstream @rules_rust symbol (for example, rustc_library_group() for rust_library_group()):
rustc_ (never fuchsia_) and define it in //build/bazel/rules/rust/<wrapper_name>.bzl. Do not add it to defs.bzl.bazel_fuchsia_wrappers SHAC check:_WRAPPED_RULES in //scripts/shac/bazel_lint/checks/fuchsia_wrappers.py mapping the upstream @rules_rust// symbol to the new wrapper symbol and module label.//scripts/shac/bazel_lint/checks/tests/fuchsia_wrappers_test.star to verify that loading or calling the upstream symbol (including aliased loads) is flagged as an error, and that loading and calling the new wrapper is allowed.fx host-tool shac check --only bazel_fuchsia_wrappers --all across the repository.//scripts/shac/bazel_lint/allowlists/bazel_fuchsia_wrappers.json under https://fxbug.dev/570203009, following the sorting and formatting rules in //scripts/shac/bazel_lint/allowlists/README.md.//docs/development/languages/bazel/style/common.md if the new wrapper introduces a new naming pattern or module path.//docs/development/languages/bazel/style/rules_macros.md if the new wrapper introduces a new naming convention or exception..bzl file and symbol in the Wrapper Macros and Rules section above.fx test --host @//scripts/shac/tests:bazel_test.fx host-tool shac check --only bazel_fuchsia_wrappers --all.fx doc-checker --local-links-only.