diff --git a/docs/defs.md b/docs/defs.md index 1b574208b8..2e9bc76d09 100644 --- a/docs/defs.md +++ b/docs/defs.md @@ -72,8 +72,8 @@ Add additional rustc_flags from the command line with `--@rules_rust//:extra_rus
 rust_binary(name, aliases, compile_data, crate_features, crate_name, crate_root, crate_type, data,
-            deps, edition, experimental_use_whole_archive_for_native_deps, linker_script, out_binary,
-            proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp, version)
+            deps, edition, linker_script, out_binary, proc_macro_deps, rustc_env, rustc_env_files,
+            rustc_flags, srcs, stamp, version)
 
Builds a Rust binary crate. @@ -178,7 +178,6 @@ is available under the key `dsym_folder` in `OutputGroupInfo`. | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | linker_script | Link script to forward into linker via rustc options. | Label | optional | None | | out_binary | Force a target, regardless of it's crate_type, to always mark the file as executable. This attribute is only used to support wasm targets but is expected to be removed following a resolution to https://github.com/bazelbuild/rules_rust/issues/771. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | @@ -196,8 +195,7 @@ is available under the key `dsym_folder` in `OutputGroupInfo`.
 rust_library(name, aliases, compile_data, crate_features, crate_name, crate_root, data, deps,
-             edition, experimental_use_whole_archive_for_native_deps, proc_macro_deps, rustc_env,
-             rustc_env_files, rustc_flags, srcs, stamp, version)
+             edition, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp, version)
 
Builds a Rust library crate. @@ -278,7 +276,6 @@ INFO: Elapsed time: 1.245s, Critical Path: 1.01s | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | @@ -294,8 +291,8 @@ INFO: Elapsed time: 1.245s, Critical Path: 1.01s
 rust_proc_macro(name, aliases, compile_data, crate_features, crate_name, crate_root, data, deps,
-                edition, experimental_use_whole_archive_for_native_deps, proc_macro_deps, rustc_env,
-                rustc_env_files, rustc_flags, srcs, stamp, version)
+                edition, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp,
+                version)
 
Builds a Rust proc-macro crate. @@ -315,7 +312,6 @@ Builds a Rust proc-macro crate. | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | @@ -331,8 +327,8 @@ Builds a Rust proc-macro crate.
 rust_shared_library(name, aliases, compile_data, crate_features, crate_name, crate_root, data, deps,
-                    edition, experimental_use_whole_archive_for_native_deps, proc_macro_deps,
-                    rustc_env, rustc_env_files, rustc_flags, srcs, stamp, version)
+                    edition, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp,
+                    version)
 
Builds a Rust shared library. @@ -360,7 +356,6 @@ When building the whole binary in Bazel, use `rust_library` instead. | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | @@ -376,8 +371,8 @@ When building the whole binary in Bazel, use `rust_library` instead.
 rust_static_library(name, aliases, compile_data, crate_features, crate_name, crate_root, data, deps,
-                    edition, experimental_use_whole_archive_for_native_deps, proc_macro_deps,
-                    rustc_env, rustc_env_files, rustc_flags, srcs, stamp, version)
+                    edition, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp,
+                    version)
 
Builds a Rust static library. @@ -405,7 +400,6 @@ When building the whole binary in Bazel, use `rust_library` instead. | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | @@ -421,8 +415,8 @@ When building the whole binary in Bazel, use `rust_library` instead.
 rust_test(name, aliases, compile_data, crate, crate_features, crate_name, crate_root, data, deps,
-          edition, env, experimental_use_whole_archive_for_native_deps, proc_macro_deps, rustc_env,
-          rustc_env_files, rustc_flags, srcs, stamp, use_libtest_harness, version)
+          edition, env, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp,
+          use_libtest_harness, version)
 
Builds a Rust test crate. @@ -557,7 +551,6 @@ Run the test with `bazel build //hello_lib:greeting_test`. | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | | env | Specifies additional environment variables to set when the test is executed by bazel test. Values are subject to $(rootpath), $(execpath), location, and ["Make variable"](https://docs.bazel.build/versions/master/be/make-variables.html) substitution.

Execpath returns absolute path, and in order to be able to construct the absolute path we need to wrap the test binary in a launcher. Using a launcher comes with complications, such as more complicated debugger attachment. | Dictionary: String -> String | optional | {} | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | diff --git a/docs/flatten.md b/docs/flatten.md index ddff575214..c443f88bd1 100644 --- a/docs/flatten.md +++ b/docs/flatten.md @@ -183,8 +183,8 @@ Deprecated: gen_rust_project can now create a rust-project.json without a rust_a
 rust_binary(name, aliases, compile_data, crate_features, crate_name, crate_root, crate_type, data,
-            deps, edition, experimental_use_whole_archive_for_native_deps, linker_script, out_binary,
-            proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp, version)
+            deps, edition, linker_script, out_binary, proc_macro_deps, rustc_env, rustc_env_files,
+            rustc_flags, srcs, stamp, version)
 
Builds a Rust binary crate. @@ -289,7 +289,6 @@ is available under the key `dsym_folder` in `OutputGroupInfo`. | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | linker_script | Link script to forward into linker via rustc options. | Label | optional | None | | out_binary | Force a target, regardless of it's crate_type, to always mark the file as executable. This attribute is only used to support wasm targets but is expected to be removed following a resolution to https://github.com/bazelbuild/rules_rust/issues/771. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | @@ -406,8 +405,7 @@ rust_clippy( ## rust_doc
-rust_doc(name, crate, experimental_use_whole_archive_for_native_deps, html_after_content,
-         html_before_content, html_in_header, markdown_css)
+rust_doc(name, crate, html_after_content, html_before_content, html_in_header, markdown_css)
 
Generates code documentation. @@ -454,7 +452,6 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing | :------------- | :------------- | :------------- | :------------- | :------------- | | name | A unique name for this target. | Name | required | | | crate | The label of the target to generate code documentation for.

rust_doc can generate HTML code documentation for the source files of rust_library or rust_binary targets. | Label | required | | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | html_after_content | File to add in <body>, after content. | Label | optional | None | | html_before_content | File to add in <body>, before content. | Label | optional | None | | html_in_header | File to add to <head>. | Label | optional | None | @@ -466,7 +463,7 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing ## rust_doc_test
-rust_doc_test(name, crate, deps, experimental_use_whole_archive_for_native_deps)
+rust_doc_test(name, crate, deps)
 
Runs Rust documentation tests. @@ -515,7 +512,6 @@ Running `bazel test //hello_lib:hello_lib_doc_test` will run all documentation t | name | A unique name for this target. | Name | required | | | crate | The label of the target to generate code documentation for. rust_doc_test can generate HTML code documentation for the source files of rust_library or rust_binary targets. | Label | required | | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | @@ -567,8 +563,7 @@ rust_binary(
 rust_library(name, aliases, compile_data, crate_features, crate_name, crate_root, data, deps,
-             edition, experimental_use_whole_archive_for_native_deps, proc_macro_deps, rustc_env,
-             rustc_env_files, rustc_flags, srcs, stamp, version)
+             edition, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp, version)
 
Builds a Rust library crate. @@ -649,7 +644,6 @@ INFO: Elapsed time: 1.245s, Critical Path: 1.01s | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | @@ -665,8 +659,8 @@ INFO: Elapsed time: 1.245s, Critical Path: 1.01s
 rust_proc_macro(name, aliases, compile_data, crate_features, crate_name, crate_root, data, deps,
-                edition, experimental_use_whole_archive_for_native_deps, proc_macro_deps, rustc_env,
-                rustc_env_files, rustc_flags, srcs, stamp, version)
+                edition, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp,
+                version)
 
Builds a Rust proc-macro crate. @@ -686,7 +680,6 @@ Builds a Rust proc-macro crate. | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | @@ -802,8 +795,8 @@ See @rules_rust//proto:BUILD for examples of defining the toolchain.
 rust_shared_library(name, aliases, compile_data, crate_features, crate_name, crate_root, data, deps,
-                    edition, experimental_use_whole_archive_for_native_deps, proc_macro_deps,
-                    rustc_env, rustc_env_files, rustc_flags, srcs, stamp, version)
+                    edition, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp,
+                    version)
 
Builds a Rust shared library. @@ -831,7 +824,6 @@ When building the whole binary in Bazel, use `rust_library` instead. | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | @@ -847,8 +839,8 @@ When building the whole binary in Bazel, use `rust_library` instead.
 rust_static_library(name, aliases, compile_data, crate_features, crate_name, crate_root, data, deps,
-                    edition, experimental_use_whole_archive_for_native_deps, proc_macro_deps,
-                    rustc_env, rustc_env_files, rustc_flags, srcs, stamp, version)
+                    edition, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp,
+                    version)
 
Builds a Rust static library. @@ -876,7 +868,6 @@ When building the whole binary in Bazel, use `rust_library` instead. | data | List of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. | List of labels | optional | [] | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | @@ -911,8 +902,8 @@ A dedicated filegroup-like rule for Rust stdlib artifacts.
 rust_test(name, aliases, compile_data, crate, crate_features, crate_name, crate_root, data, deps,
-          edition, env, experimental_use_whole_archive_for_native_deps, proc_macro_deps, rustc_env,
-          rustc_env_files, rustc_flags, srcs, stamp, use_libtest_harness, version)
+          edition, env, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, srcs, stamp,
+          use_libtest_harness, version)
 
Builds a Rust test crate. @@ -1047,7 +1038,6 @@ Run the test with `bazel build //hello_lib:greeting_test`. | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | | edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | | env | Specifies additional environment variables to set when the test is executed by bazel test. Values are subject to $(rootpath), $(execpath), location, and ["Make variable"](https://docs.bazel.build/versions/master/be/make-variables.html) substitution.

Execpath returns absolute path, and in order to be able to construct the absolute path we need to wrap the test binary in a launcher. Using a launcher comes with complications, such as more complicated debugger attachment. | Dictionary: String -> String | optional | {} | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | proc_macro_deps | List of rust_library targets with kind proc-macro used to help build this library target. | List of labels | optional | [] | | rustc_env | Dictionary of additional "key": "value" environment variables to set for rustc.

rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. | Dictionary: String -> String | optional | {} | | rustc_env_files | Files containing additional environment variables to set for rustc.

These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\).

The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.

Note that the variables here are subject to [workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status) stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. | List of labels | optional | [] | diff --git a/docs/rust_doc.md b/docs/rust_doc.md index c43d6b69ae..e6502c36a9 100644 --- a/docs/rust_doc.md +++ b/docs/rust_doc.md @@ -9,8 +9,7 @@ ## rust_doc
-rust_doc(name, crate, experimental_use_whole_archive_for_native_deps, html_after_content,
-         html_before_content, html_in_header, markdown_css)
+rust_doc(name, crate, html_after_content, html_before_content, html_in_header, markdown_css)
 
Generates code documentation. @@ -57,7 +56,6 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing | :------------- | :------------- | :------------- | :------------- | :------------- | | name | A unique name for this target. | Name | required | | | crate | The label of the target to generate code documentation for.

rust_doc can generate HTML code documentation for the source files of rust_library or rust_binary targets. | Label | required | | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | | html_after_content | File to add in <body>, after content. | Label | optional | None | | html_before_content | File to add in <body>, before content. | Label | optional | None | | html_in_header | File to add to <head>. | Label | optional | None | @@ -69,7 +67,7 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing ## rust_doc_test
-rust_doc_test(name, crate, deps, experimental_use_whole_archive_for_native_deps)
+rust_doc_test(name, crate, deps)
 
Runs Rust documentation tests. @@ -118,6 +116,5 @@ Running `bazel test //hello_lib:hello_lib_doc_test` will run all documentation t | name | A unique name for this target. | Name | required | | | crate | The label of the target to generate code documentation for. rust_doc_test can generate HTML code documentation for the source files of rust_library or rust_binary targets. | Label | required | | | deps | List of other libraries to be linked to this library target.

These can be either other rust_library targets or cc_library targets if linking a native library. | List of labels | optional | [] | -| experimental_use_whole_archive_for_native_deps | Whether to use +whole-archive linking modifier for native dependencies.

TODO: This is a stopgap feature and will be removed, see https://github.com/bazelbuild/rules_rust/issues/1268. | Boolean | optional | False | diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl index f3a874aec8..532fe481e1 100644 --- a/rust/private/rust.bzl +++ b/rust/private/rust.bzl @@ -497,15 +497,6 @@ _common_attrs = { "edition": attr.string( doc = "The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain.", ), - "experimental_use_whole_archive_for_native_deps": attr.bool( - doc = dedent("""\ - Whether to use +whole-archive linking modifier for native dependencies. - - TODO: This is a stopgap feature and will be removed, - see https://github.com/bazelbuild/rules_rust/issues/1268. - """), - default = False, - ), # Previously `proc_macro_deps` were a part of `deps`, and then proc_macro_host_transition was # used into cfg="host" using `@local_config_platform//:host`. # This fails for remote execution, which needs cfg="exec", and there isn't anything like diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index c34e250089..5a9d569c21 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -780,7 +780,7 @@ def construct_arguments( rustc_flags.add("--codegen=linker=" + ld) rustc_flags.add_joined("--codegen", link_args, join_with = " ", format_joined = "link-args=%s") - _add_native_link_flags(rustc_flags, dep_info, linkstamp_outs, ambiguous_libs, crate_info.type, toolchain, cc_toolchain, feature_configuration, attr.experimental_use_whole_archive_for_native_deps) + _add_native_link_flags(rustc_flags, dep_info, linkstamp_outs, ambiguous_libs, crate_info.type, toolchain, cc_toolchain, feature_configuration) # These always need to be added, even if not linking this crate. add_crate_link_flags(rustc_flags, dep_info, force_all_deps_direct) @@ -1293,15 +1293,11 @@ def _get_crate_dirname(crate): """ return crate.output.dirname -def _portable_link_flags(lib, use_pic, ambiguous_libs, experimental_use_whole_archive_for_native_deps): +def _portable_link_flags(lib, use_pic, ambiguous_libs): artifact = get_preferred_artifact(lib, use_pic) if ambiguous_libs and artifact.path in ambiguous_libs: artifact = ambiguous_libs[artifact.path] if lib.static_library or lib.pic_static_library: - modifiers = "" - if experimental_use_whole_archive_for_native_deps: - modifiers = ":+whole-archive" - # To ensure appropriate linker library argument order, in the presence # of both native libraries that depend on rlibs and rlibs that depend # on native libraries, we use an approach where we "sandwich" the @@ -1319,7 +1315,7 @@ def _portable_link_flags(lib, use_pic, ambiguous_libs, experimental_use_whole_ar # We rely in the behavior of -Clink-arg to put the linker args # at the end of the linker invocation constructed by rustc. return [ - "-lstatic%s=%s" % (modifiers, get_lib_name(artifact)), + "-lstatic=%s" % get_lib_name(artifact), "-Clink-arg=-l%s" % get_lib_name(artifact), ] elif _is_dylib(lib): @@ -1329,18 +1325,18 @@ def _portable_link_flags(lib, use_pic, ambiguous_libs, experimental_use_whole_ar return [] -def _make_link_flags_windows(linker_input_and_use_pic_and_ambiguous_libs_and_experimental_use_whole_archive_for_native_deps): - linker_input, use_pic, ambiguous_libs, experimental_use_whole_archive_for_native_deps = linker_input_and_use_pic_and_ambiguous_libs_and_experimental_use_whole_archive_for_native_deps +def _make_link_flags_windows(linker_input_and_use_pic_and_ambiguous_libs): + linker_input, use_pic, ambiguous_libs = linker_input_and_use_pic_and_ambiguous_libs ret = [] for lib in linker_input.libraries: if lib.alwayslink: ret.extend(["-C", "link-arg=/WHOLEARCHIVE:%s" % get_preferred_artifact(lib, use_pic).path]) else: - ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs, experimental_use_whole_archive_for_native_deps)) + ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs)) return ret -def _make_link_flags_darwin(linker_input_and_use_pic_and_ambiguous_libs_and_experimental_use_whole_archive_for_native_deps): - linker_input, use_pic, ambiguous_libs, experimental_use_whole_archive_for_native_deps = linker_input_and_use_pic_and_ambiguous_libs_and_experimental_use_whole_archive_for_native_deps +def _make_link_flags_darwin(linker_input_and_use_pic_and_ambiguous_libs): + linker_input, use_pic, ambiguous_libs = linker_input_and_use_pic_and_ambiguous_libs ret = [] for lib in linker_input.libraries: if lib.alwayslink: @@ -1349,11 +1345,11 @@ def _make_link_flags_darwin(linker_input_and_use_pic_and_ambiguous_libs_and_expe ("link-arg=-Wl,-force_load,%s" % get_preferred_artifact(lib, use_pic).path), ]) else: - ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs, experimental_use_whole_archive_for_native_deps)) + ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs)) return ret -def _make_link_flags_default(linker_input_and_use_pic_and_ambiguous_libs_and_experimental_use_whole_archive_for_native_deps): - linker_input, use_pic, ambiguous_libs, experimental_use_whole_archive_for_native_deps = linker_input_and_use_pic_and_ambiguous_libs_and_experimental_use_whole_archive_for_native_deps +def _make_link_flags_default(linker_input_and_use_pic_and_ambiguous_libs): + linker_input, use_pic, ambiguous_libs = linker_input_and_use_pic_and_ambiguous_libs ret = [] for lib in linker_input.libraries: if lib.alwayslink: @@ -1366,16 +1362,16 @@ def _make_link_flags_default(linker_input_and_use_pic_and_ambiguous_libs_and_exp "link-arg=-Wl,--no-whole-archive", ]) else: - ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs, experimental_use_whole_archive_for_native_deps)) + ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs)) return ret -def _libraries_dirnames(linker_input_and_use_pic_and_ambiguous_libs_and_experimental_use_whole_archive_for_native_deps): - link_input, use_pic, _, _ = linker_input_and_use_pic_and_ambiguous_libs_and_experimental_use_whole_archive_for_native_deps +def _libraries_dirnames(linker_input_and_use_pic_and_ambiguous_libs): + link_input, use_pic, _ = linker_input_and_use_pic_and_ambiguous_libs # De-duplicate names. return depset([get_preferred_artifact(lib, use_pic).dirname for lib in link_input.libraries]).to_list() -def _add_native_link_flags(args, dep_info, linkstamp_outs, ambiguous_libs, crate_type, toolchain, cc_toolchain, feature_configuration, experimental_use_whole_archive_for_native_deps): +def _add_native_link_flags(args, dep_info, linkstamp_outs, ambiguous_libs, crate_type, toolchain, cc_toolchain, feature_configuration): """Adds linker flags for all dependencies of the current target. Args: @@ -1387,7 +1383,6 @@ def _add_native_link_flags(args, dep_info, linkstamp_outs, ambiguous_libs, crate toolchain (rust_toolchain): The current `rust_toolchain` cc_toolchain (CcToolchainInfo): The current `cc_toolchain` feature_configuration (FeatureConfiguration): feature configuration to use with cc_toolchain - experimental_use_whole_archive_for_native_deps (bool): Whether to use the whole-archive link modifier for native deps, see https://github.com/bazelbuild/rules_rust/issues/1268 """ if crate_type in ["lib", "rlib"]: return @@ -1402,15 +1397,15 @@ def _add_native_link_flags(args, dep_info, linkstamp_outs, ambiguous_libs, crate make_link_flags = _make_link_flags_default # TODO(hlopko): Remove depset flattening by using lambdas once we are on >=Bazel 5.0 - args_and_pic_and_ambiguous_libs_and_use_whole_archive_for_native_deps = [(arg, use_pic, ambiguous_libs, experimental_use_whole_archive_for_native_deps) for arg in dep_info.transitive_noncrates.to_list()] - args.add_all(args_and_pic_and_ambiguous_libs_and_use_whole_archive_for_native_deps, map_each = _libraries_dirnames, uniquify = True, format_each = "-Lnative=%s") + args_and_pic_and_ambiguous_libs = [(arg, use_pic, ambiguous_libs) for arg in dep_info.transitive_noncrates.to_list()] + args.add_all(args_and_pic_and_ambiguous_libs, map_each = _libraries_dirnames, uniquify = True, format_each = "-Lnative=%s") if ambiguous_libs: # If there are ambiguous libs, the disambiguation symlinks to them are # all created in the same directory. Add it to the library search path. ambiguous_libs_dirname = ambiguous_libs.values()[0].dirname args.add("-Lnative={}".format(ambiguous_libs_dirname)) - args.add_all(args_and_pic_and_ambiguous_libs_and_use_whole_archive_for_native_deps, map_each = make_link_flags) + args.add_all(args_and_pic_and_ambiguous_libs, map_each = make_link_flags) for linkstamp_out in linkstamp_outs: args.add_all(["-C", "link-arg=%s" % linkstamp_out.path]) diff --git a/rust/private/rustdoc.bzl b/rust/private/rustdoc.bzl index ffc523a0a3..86c2acd9af 100644 --- a/rust/private/rustdoc.bzl +++ b/rust/private/rustdoc.bzl @@ -265,15 +265,6 @@ rust_doc = rule( providers = [rust_common.crate_info], mandatory = True, ), - "experimental_use_whole_archive_for_native_deps": attr.bool( - doc = dedent("""\ - Whether to use +whole-archive linking modifier for native dependencies. - - TODO: This is a stopgap feature and will be removed, - see https://github.com/bazelbuild/rules_rust/issues/1268. - """), - default = False, - ), "html_after_content": attr.label( doc = "File to add in ``, after content.", allow_single_file = [".html", ".md"], diff --git a/rust/private/rustdoc_test.bzl b/rust/private/rustdoc_test.bzl index ce3c5ace79..f7bc97b65c 100644 --- a/rust/private/rustdoc_test.bzl +++ b/rust/private/rustdoc_test.bzl @@ -181,15 +181,6 @@ rust_doc_test = rule( """), providers = [CrateInfo, CcInfo], ), - "experimental_use_whole_archive_for_native_deps": attr.bool( - doc = dedent("""\ - Whether to use +whole-archive linking modifier for native dependencies. - - TODO: This is a stopgap feature and will be removed, - see https://github.com/bazelbuild/rules_rust/issues/1268. - """), - default = False, - ), "_cc_toolchain": attr.label( doc = ( "In order to use find_cc_toolchain, your rule has to depend " +