You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Warning**: This rule is currently experimental. [Rust Benchmark tests][rust-bench] require the `Bencher` interface in the unstable `libtest` crate, which is behind the `test` unstable feature gate. As a result, using this rule would require using a nightly binary release of Rust.
@@ -145,13 +146,15 @@ Run the benchmark test using: `bazel run //fibonacci:fibonacci_bench`.
145
146
| <aid="rust_benchmark-crate_name"></a>crate_name | Crate name to use for this target.<br><br>This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores. | String | optional | "" |
146
147
| <aid="rust_benchmark-crate_root"></a>crate_root | The file that will be passed to <code>rustc</code> to be used for building this crate.<br><br>If <code>crate_root</code> is not set, then this rule will look for a <code>lib.rs</code> file (or <code>main.rs</code> for rust_binary) or the single file in <code>srcs</code> if <code>srcs</code> contains only one file. | <ahref="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
147
148
| <aid="rust_benchmark-data"></a>data | List of files used by this rule at compile time and runtime.<br><br>If including data at compile time with include_str!() and similar, prefer <code>compile_data</code> over <code>data</code>, to prevent the data also being included in the runfiles. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
149
+
| <aid="rust_benchmark-default_args"></a>default_args | The default arguments to pass to the benchmark binary. This attribute is used if the built-in <code>args</code> attribute is not set. | List of strings | optional |["--bench"]|
148
150
| <aid="rust_benchmark-deps"></a>deps | List of other libraries to be linked to this library target.<br><br>These can be either other <code>rust_library</code> targets or <code>cc_library</code> targets if linking a native library. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
149
151
| <aid="rust_benchmark-edition"></a>edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" |
150
152
| <aid="rust_benchmark-proc_macro_deps"></a>proc_macro_deps | List of <code>rust_library</code> targets with kind <code>proc-macro</code> used to help build this library target. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
151
153
| <aid="rust_benchmark-rustc_env"></a>rustc_env | Dictionary of additional <code>"key": "value"</code> environment variables to set for rustc.<br><br>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. | <ahref="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
152
154
| <aid="rust_benchmark-rustc_env_files"></a>rustc_env_files | Files containing additional environment variables to set for rustc.<br><br>These files should contain a single variable per line, of format <code>NAME=value</code>, and newlines may be included in a value by ending a line with a trailing back-slash (<code>\</code>).<br><br>The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
153
155
| <aid="rust_benchmark-rustc_flags"></a>rustc_flags | List of compiler flags passed to <code>rustc</code>.<br><br>These strings are subject to Make variable expansion for predefined source/output path variables like <code>$location</code>, <code>$execpath</code>, and <code>$rootpath</code>. This expansion is useful if you wish to pass a generated file of arguments to rustc: <code>@$(location //package:target)</code>. | List of strings | optional |[]|
154
156
| <aid="rust_benchmark-srcs"></a>srcs | List of Rust <code>.rs</code> source files used to build the library.<br><br>If <code>srcs</code> contains more than one file, then there must be a file either named <code>lib.rs</code>. Otherwise, <code>crate_root</code> must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
157
+
| <aid="rust_benchmark-use_libtest_harness"></a>use_libtest_harness | Generate the test harness for this benchmark. Note that [Criterion](https://bheisler.github.io/criterion.rs/book/index.html) benchmarks do not use a test harness, but the nightly <code>#[bench]</code> api does. Pass True if you have a <code>#[bench]</code> api test. | Boolean | optional | False |
155
158
| <aid="rust_benchmark-version"></a>version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" |
**Warning**: This rule is currently experimental. [Rust Benchmark tests][rust-bench] require the `Bencher` interface in the unstable `libtest` crate, which is behind the `test` unstable feature gate. As a result, using this rule would require using a nightly binary release of Rust.
@@ -310,13 +311,15 @@ Run the benchmark test using: `bazel run //fibonacci:fibonacci_bench`.
310
311
| <aid="rust_benchmark-crate_name"></a>crate_name | Crate name to use for this target.<br><br>This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores. | String | optional | "" |
311
312
| <aid="rust_benchmark-crate_root"></a>crate_root | The file that will be passed to <code>rustc</code> to be used for building this crate.<br><br>If <code>crate_root</code> is not set, then this rule will look for a <code>lib.rs</code> file (or <code>main.rs</code> for rust_binary) or the single file in <code>srcs</code> if <code>srcs</code> contains only one file. | <ahref="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
312
313
| <aid="rust_benchmark-data"></a>data | List of files used by this rule at compile time and runtime.<br><br>If including data at compile time with include_str!() and similar, prefer <code>compile_data</code> over <code>data</code>, to prevent the data also being included in the runfiles. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
314
+
| <aid="rust_benchmark-default_args"></a>default_args | The default arguments to pass to the benchmark binary. This attribute is used if the built-in <code>args</code> attribute is not set. | List of strings | optional |["--bench"]|
313
315
| <aid="rust_benchmark-deps"></a>deps | List of other libraries to be linked to this library target.<br><br>These can be either other <code>rust_library</code> targets or <code>cc_library</code> targets if linking a native library. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
314
316
| <aid="rust_benchmark-edition"></a>edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" |
315
317
| <aid="rust_benchmark-proc_macro_deps"></a>proc_macro_deps | List of <code>rust_library</code> targets with kind <code>proc-macro</code> used to help build this library target. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
316
318
| <aid="rust_benchmark-rustc_env"></a>rustc_env | Dictionary of additional <code>"key": "value"</code> environment variables to set for rustc.<br><br>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. | <ahref="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
317
319
| <aid="rust_benchmark-rustc_env_files"></a>rustc_env_files | Files containing additional environment variables to set for rustc.<br><br>These files should contain a single variable per line, of format <code>NAME=value</code>, and newlines may be included in a value by ending a line with a trailing back-slash (<code>\</code>).<br><br>The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
318
320
| <aid="rust_benchmark-rustc_flags"></a>rustc_flags | List of compiler flags passed to <code>rustc</code>.<br><br>These strings are subject to Make variable expansion for predefined source/output path variables like <code>$location</code>, <code>$execpath</code>, and <code>$rootpath</code>. This expansion is useful if you wish to pass a generated file of arguments to rustc: <code>@$(location //package:target)</code>. | List of strings | optional |[]|
319
321
| <aid="rust_benchmark-srcs"></a>srcs | List of Rust <code>.rs</code> source files used to build the library.<br><br>If <code>srcs</code> contains more than one file, then there must be a file either named <code>lib.rs</code>. Otherwise, <code>crate_root</code> must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional |[]|
322
+
| <aid="rust_benchmark-use_libtest_harness"></a>use_libtest_harness | Generate the test harness for this benchmark. Note that [Criterion](https://bheisler.github.io/criterion.rs/book/index.html) benchmarks do not use a test harness, but the nightly <code>#[bench]</code> api does. Pass True if you have a <code>#[bench]</code> api test. | Boolean | optional | False |
320
323
| <aid="rust_benchmark-version"></a>version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" |
0 commit comments