diff --git a/bindgen/private/bindgen.bzl b/bindgen/private/bindgen.bzl index 6bfbc2283e..1660a6a8c8 100644 --- a/bindgen/private/bindgen.bzl +++ b/bindgen/private/bindgen.bzl @@ -385,15 +385,15 @@ rust_bindgen = rule( allow_single_file = True, mandatory = True, ), - "wrap_static_fns": attr.bool( - 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, - ), "merge_cc_lib_objects_into_rlib": attr.bool( doc = ("When True, objects from `cc_lib` will be copied into the `rlib` archive produced by " + "the rust_library that depends on this `rust_bindgen` rule (using `BuildInfo` provider)"), default = True, ), + "wrap_static_fns": attr.bool( + 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"), ), diff --git a/docs/src/flatten.md b/docs/src/flatten.md index e2bfa99598..27aceeb7c0 100644 --- a/docs/src/flatten.md +++ b/docs/src/flatten.md @@ -328,7 +328,8 @@ is available under the key `dsym_folder` in `OutputGroupInfo`. ## rust_bindgen
-rust_bindgen(name, bindgen_flags, cc_lib, clang_flags, header, wrap_static_fns)
+rust_bindgen(name, bindgen_flags, cc_lib, clang_flags, header, merge_cc_lib_objects_into_rlib,
+             wrap_static_fns)
 
Generates a rust source file from a cc_library and a header. @@ -343,6 +344,7 @@ Generates a rust source file from a cc_library and a header. | cc_lib | The cc_library that contains the `.h` file. This is used to find the transitive includes. | Label | required | | | clang_flags | Flags to pass directly to the clang executable. | List of strings | optional | `[]` | | header | The `.h` file to generate bindings for. | Label | required | | +| merge_cc_lib_objects_into_rlib | When True, objects from `cc_lib` will be copied into the `rlib` archive produced by the rust_library that depends on this `rust_bindgen` rule (using `BuildInfo` provider) | Boolean | optional | `True` | | wrap_static_fns | 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). | Boolean | optional | `False` | diff --git a/docs/src/rust_bindgen.md b/docs/src/rust_bindgen.md index 7489a7cbd3..2c139530cc 100644 --- a/docs/src/rust_bindgen.md +++ b/docs/src/rust_bindgen.md @@ -53,7 +53,8 @@ toolchains following the instructions for [rust_bindgen_toolchain](#rust_bindgen ## rust_bindgen
-rust_bindgen(name, bindgen_flags, cc_lib, clang_flags, header, wrap_static_fns)
+rust_bindgen(name, bindgen_flags, cc_lib, clang_flags, header, merge_cc_lib_objects_into_rlib,
+             wrap_static_fns)
 
Generates a rust source file from a cc_library and a header. @@ -68,6 +69,7 @@ Generates a rust source file from a cc_library and a header. | cc_lib | The cc_library that contains the `.h` file. This is used to find the transitive includes. | Label | required | | | clang_flags | Flags to pass directly to the clang executable. | List of strings | optional | `[]` | | header | The `.h` file to generate bindings for. | Label | required | | +| merge_cc_lib_objects_into_rlib | When True, objects from `cc_lib` will be copied into the `rlib` archive produced by the rust_library that depends on this `rust_bindgen` rule (using `BuildInfo` provider) | Boolean | optional | `True` | | wrap_static_fns | 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). | Boolean | optional | `False` | diff --git a/test/bindgen/bindgen_test.bzl b/test/bindgen/bindgen_test.bzl index e3877a7bf1..f006edf2bd 100644 --- a/test/bindgen/bindgen_test.bzl +++ b/test/bindgen/bindgen_test.bzl @@ -2,7 +2,7 @@ load("@rules_cc//cc:defs.bzl", "cc_library") load("@rules_rust//bindgen:defs.bzl", "rust_bindgen_library") -load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library") +load("@rules_rust//rust:defs.bzl", "rust_binary") load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite") def _test_cc_linkopt_impl(env, target):