From 56237415eea9134d7760de6ff58f92785704ac7c Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Wed, 30 Nov 2022 17:28:41 +0000 Subject: [PATCH] stardoc: Use backtick not `` for attr default values (#1682) * stardoc: Use backtick not `` for attr default values This is a cherry-pick of https://github.com/bazelbuild/stardoc/pull/143 * Regenerate documentation --- docs/WORKSPACE.bazel | 10 +- docs/cargo.md | 56 +-- docs/crate_universe.md | 192 ++++---- docs/defs.md | 226 +++++----- docs/flatten.md | 540 +++++++++++------------ docs/rust_analyzer.md | 10 +- docs/rust_bindgen.md | 32 +- docs/rust_clippy.md | 6 +- docs/rust_doc.md | 20 +- docs/rust_fmt.md | 6 +- docs/rust_proto.md | 28 +- docs/rust_repositories.md | 140 +++--- docs/rust_wasm_bindgen.md | 14 +- docs/settings.md | 2 +- docs/stardoc-attr-default-wrappers.patch | 23 + 15 files changed, 666 insertions(+), 639 deletions(-) create mode 100644 docs/stardoc-attr-default-wrappers.patch diff --git a/docs/WORKSPACE.bazel b/docs/WORKSPACE.bazel index d18f83ed45..60ee5c658f 100644 --- a/docs/WORKSPACE.bazel +++ b/docs/WORKSPACE.bazel @@ -37,10 +37,14 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_stardoc", - sha256 = "aa814dae0ac400bbab2e8881f9915c6f47c49664bf087c409a15f90438d2c23e", + patches = [ + # Pull in https://github.com/bazelbuild/stardoc/pull/143 + "//:stardoc-attr-default-wrappers.patch", + ], + sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.1/stardoc-0.5.1.tar.gz", - "https://github.com/bazelbuild/stardoc/releases/download/0.5.1/stardoc-0.5.1.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz", + "https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz", ], ) diff --git a/docs/cargo.md b/docs/cargo.md index d2e24b81b2..448764cf5e 100644 --- a/docs/cargo.md +++ b/docs/cargo.md @@ -23,20 +23,20 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this repository. | Name | required | | -| binary | The binary to build (the --bin parameter for Cargo). If left empty, the repository name will be used. | String | optional | "" | -| build_mode | The build mode the binary should be built with | String | optional | "release" | -| cargo_lockfile | The lockfile of the crate_universe resolver | Label | required | | -| cargo_toml | The path of the crate_universe resolver manifest (Cargo.toml file) | Label | required | | -| env | A mapping of platform triple to a set of environment variables. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | -| env_label | A mapping of platform triple to a set of environment variables. This attribute differs from env in that all variables passed here must be fully qualified labels of files. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | -| iso_date | The iso_date of cargo binary the resolver should use. Note: This can only be set if version is beta or nightly | String | optional | "" | -| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| srcs | Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made | List of labels | optional | [] | -| timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | 600 | -| version | The version of cargo the resolver should use | String | optional | "1.65.0" | +| name | A unique name for this repository. | Name | required | | +| binary | The binary to build (the --bin parameter for Cargo). If left empty, the repository name will be used. | String | optional | "" | +| build_mode | The build mode the binary should be built with | String | optional | "release" | +| cargo_lockfile | The lockfile of the crate_universe resolver | Label | required | | +| cargo_toml | The path of the crate_universe resolver manifest (Cargo.toml file) | Label | required | | +| env | A mapping of platform triple to a set of environment variables. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | +| env_label | A mapping of platform triple to a set of environment variables. This attribute differs from env in that all variables passed here must be fully qualified labels of files. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | +| iso_date | The iso_date of cargo binary the resolver should use. Note: This can only be set if version is beta or nightly | String | optional | "" | +| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | +| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | +| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | +| srcs | Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made | List of labels | optional | [] | +| timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | 600 | +| version | The version of cargo the resolver should use | String | optional | "1.65.0" | @@ -54,9 +54,9 @@ A rule for generating variables for dependent `cargo_build_script`s without a bu | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| out_dir | Folder containing additional inputs when building all direct dependencies.

This has the same effect as a cargo_build_script which prints puts files into $OUT_DIR, but without requiring a build script. | Label | optional | None | -| src | File containing additional environment variables to set for build scripts of direct dependencies.

This has the same effect as a cargo_build_script which prints cargo:VAR=VALUE lines, but without requiring a build script.

This 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 (\\). | Label | required | | +| name | A unique name for this target. | Name | required | | +| out_dir | Folder containing additional inputs when building all direct dependencies.

This has the same effect as a cargo_build_script which prints puts files into $OUT_DIR, but without requiring a build script. | Label | optional | None | +| src | File containing additional environment variables to set for build scripts of direct dependencies.

This has the same effect as a cargo_build_script which prints cargo:VAR=VALUE lines, but without requiring a build script.

This 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 (\\). | Label | required | | @@ -132,17 +132,17 @@ The `hello_lib` target will be build with the flags and the environment variable | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | The name for the underlying rule. This should be the name of the package being compiled, optionally with a suffix of _build_script. | none | -| crate_features | A list of features to enable for the build script. | [] | -| version | The semantic version (semver) of the crate. | None | -| deps | The dependencies of the crate. | [] | -| build_script_env | Environment variables for build scripts. | {} | -| data | Files needed by the build script. | [] | -| tools | Tools (executables) needed by the build script. | [] | -| links | Name of the native library this crate links against. | None | -| rustc_env | Environment variables to set in rustc when compiling the build script. | {} | -| rustc_flags | List of compiler flags passed to rustc. | [] | -| visibility | Visibility to apply to the generated build script output. | None | -| tags | (list of str, optional): Tags to apply to the generated build script output. | None | +| crate_features | A list of features to enable for the build script. | `[]` | +| version | The semantic version (semver) of the crate. | `None` | +| deps | The dependencies of the crate. | `[]` | +| build_script_env | Environment variables for build scripts. | `{}` | +| data | Files needed by the build script. | `[]` | +| tools | Tools (executables) needed by the build script. | `[]` | +| links | Name of the native library this crate links against. | `None` | +| rustc_env | Environment variables to set in rustc when compiling the build script. | `{}` | +| rustc_flags | List of compiler flags passed to rustc. | `[]` | +| visibility | Visibility to apply to the generated build script output. | `None` | +| tags | (list of str, optional): Tags to apply to the generated build script output. | `None` | | kwargs | Forwards to the underlying rust_binary rule. | none | diff --git a/docs/crate_universe.md b/docs/crate_universe.md index 065c877848..51f46c5308 100644 --- a/docs/crate_universe.md +++ b/docs/crate_universe.md @@ -242,7 +242,7 @@ Rust targets found in the dependency graph defined by the given manifests. it on its own. When initially setting up this rule, an empty file should be created and then populated by repinning dependencies. - +<a id="#crates_repository_repinning_updating_dependencies"></a> ### Repinning / Updating Dependencies @@ -275,26 +275,26 @@ that is called behind the scenes to update dependencies. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this repository. | Name | required | | -| annotations | Extra settings to apply to crates. See [crate.annotation](#crateannotation). | Dictionary: String -> List of strings | optional | {} | -| cargo_config | A [Cargo configuration](https://doc.rust-lang.org/cargo/reference/config.html) file | Label | optional | None | -| cargo_lockfile | The path used to store the crates_repository specific [Cargo.lock](https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html) file. In the case that your crates_repository corresponds directly with an existing Cargo.toml file which has a paired Cargo.lock file, that Cargo.lock file should be used here, which will keep the versions used by cargo and bazel in sync. | Label | required | | -| generate_build_scripts | Whether or not to generate [cargo build scripts](https://doc.rust-lang.org/cargo/reference/build-scripts.html) by default. | Boolean | optional | True | -| generator | The absolute label of a generator. Eg. @cargo_bazel_bootstrap//:cargo-bazel. This is typically used when bootstrapping | String | optional | "" | -| generator_sha256s | Dictionary of host_triple -> sha256 for a cargo-bazel binary. | Dictionary: String -> String | optional | {} | -| generator_urls | URL template from which to download the cargo-bazel binary. {host_triple} and will be filled in according to the host platform. | Dictionary: String -> String | optional | {} | -| isolated | If true, CARGO_HOME will be overwritten to a directory within the generated repository in order to prevent other uses of Cargo from impacting having any effect on the generated targets produced by this rule. For users who either have multiple crate_repository definitions in a WORKSPACE or rapidly re-pin dependencies, setting this to false may improve build times. This variable is also controled by CARGO_BAZEL_ISOLATED environment variable. | Boolean | optional | True | -| lockfile | The path to a file to use for reproducible renderings. If set, this file must exist within the workspace (but can be empty) before this rule will work. | Label | optional | None | -| manifests | A list of Cargo manifests (Cargo.toml files). | List of labels | optional | [] | -| packages | A set of crates (packages) specifications to depend on. See [crate.spec](#crate.spec). | Dictionary: String -> String | optional | {} | -| quiet | If stdout and stderr should not be printed to the terminal. | Boolean | optional | True | -| render_config | The configuration flags to use for rendering. Use //crate_universe:defs.bzl\%render_config to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" | -| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {cfg} (eg. 'exec'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {cfg} (eg. 'exec'), and {tool} (eg. 'cargo.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| rust_version | The version of Rust the currently registered toolchain is using. Eg. 1.56.0, or nightly-2021-09-08 | String | optional | "1.65.0" | -| splicing_config | The configuration flags to use for splicing Cargo maniests. Use //crate_universe:defs.bzl\%rsplicing_config to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" | -| supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | ["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-pc-windows-msvc", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "armv7-linux-androideabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd", "riscv32imc-unknown-none-elf"] | +| name | A unique name for this repository. | Name | required | | +| annotations | Extra settings to apply to crates. See [crate.annotation](#crateannotation). | Dictionary: String -> List of strings | optional | {} | +| cargo_config | A [Cargo configuration](https://doc.rust-lang.org/cargo/reference/config.html) file | Label | optional | None | +| cargo_lockfile | The path used to store the crates_repository specific [Cargo.lock](https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html) file. In the case that your crates_repository corresponds directly with an existing Cargo.toml file which has a paired Cargo.lock file, that Cargo.lock file should be used here, which will keep the versions used by cargo and bazel in sync. | Label | required | | +| generate_build_scripts | Whether or not to generate [cargo build scripts](https://doc.rust-lang.org/cargo/reference/build-scripts.html) by default. | Boolean | optional | True | +| generator | The absolute label of a generator. Eg. @cargo_bazel_bootstrap//:cargo-bazel. This is typically used when bootstrapping | String | optional | "" | +| generator_sha256s | Dictionary of host_triple -> sha256 for a cargo-bazel binary. | Dictionary: String -> String | optional | {} | +| generator_urls | URL template from which to download the cargo-bazel binary. {host_triple} and will be filled in according to the host platform. | Dictionary: String -> String | optional | {} | +| isolated | If true, CARGO_HOME will be overwritten to a directory within the generated repository in order to prevent other uses of Cargo from impacting having any effect on the generated targets produced by this rule. For users who either have multiple crate_repository definitions in a WORKSPACE or rapidly re-pin dependencies, setting this to false may improve build times. This variable is also controled by CARGO_BAZEL_ISOLATED environment variable. | Boolean | optional | True | +| lockfile | The path to a file to use for reproducible renderings. If set, this file must exist within the workspace (but can be empty) before this rule will work. | Label | optional | None | +| manifests | A list of Cargo manifests (Cargo.toml files). | List of labels | optional | [] | +| packages | A set of crates (packages) specifications to depend on. See [crate.spec](#crate.spec). | Dictionary: String -> String | optional | {} | +| quiet | If stdout and stderr should not be printed to the terminal. | Boolean | optional | True | +| render_config | The configuration flags to use for rendering. Use //crate_universe:defs.bzl\%render_config to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" | +| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | +| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {cfg} (eg. 'exec'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | +| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {cfg} (eg. 'exec'), and {tool} (eg. 'cargo.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | +| rust_version | The version of Rust the currently registered toolchain is using. Eg. 1.56.0, or nightly-2021-09-08 | String | optional | "1.65.0" | +| splicing_config | The configuration flags to use for splicing Cargo maniests. Use //crate_universe:defs.bzl\%rsplicing_config to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" | +| supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | ["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-pc-windows-msvc", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "armv7-linux-androideabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd", "riscv32imc-unknown-none-elf"] | @@ -355,7 +355,7 @@ directory next to where the target is defined. To run it, simply call: bazel run //3rdparty:crates_vendor ``` - +<a id="#crates_vendor_repinning_updating_dependencies"></a> ### Repinning / Updating Dependencies @@ -384,21 +384,21 @@ call against the generated workspace. The following table describes how to contr | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| annotations | Extra settings to apply to crates. See [crate.annotation](#crateannotation). | Dictionary: String -> List of strings | optional | {} | -| bazel | The path to a bazel binary used to locate the output_base for the current workspace. | Label | optional | None | -| buildifier | The path to a [buildifier](https://github.com/bazelbuild/buildtools/blob/5.0.1/buildifier/README.md) binary used to format generated BUILD files. | Label | optional | //crate_universe/private/vendor:buildifier | -| cargo_bazel | The cargo-bazel binary to use for vendoring. If this attribute is not set, then a CARGO_BAZEL_GENERATOR_PATH action env will be used. | Label | optional | @cargo_bazel_bootstrap//:binary | -| cargo_config | A [Cargo configuration](https://doc.rust-lang.org/cargo/reference/config.html) file. | Label | optional | None | -| cargo_lockfile | The path to an existing Cargo.lock file | Label | optional | None | -| generate_build_scripts | Whether or not to generate [cargo build scripts](https://doc.rust-lang.org/cargo/reference/build-scripts.html) by default. | Boolean | optional | True | -| manifests | A list of Cargo manifests (Cargo.toml files). | List of labels | optional | [] | -| mode | Flags determining how crates should be vendored. local is where crate source and BUILD files are written to the repository. remote is where only BUILD files are written and repository rules used to fetch source code. | String | optional | "remote" | -| packages | A set of crates (packages) specifications to depend on. See [crate.spec](#crate.spec). | Dictionary: String -> String | optional | {} | -| repository_name | The name of the repository to generate for remote vendor modes. If unset, the label name will be used | String | optional | "" | -| splicing_config | The configuration flags to use for splicing Cargo maniests. Use //crate_universe:defs.bzl\%rsplicing_config to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" | -| supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | ["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-pc-windows-msvc", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "armv7-linux-androideabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd", "riscv32imc-unknown-none-elf"] | -| vendor_path | The path to a directory to write files into. Absolute paths will be treated as relative to the workspace root | String | optional | "crates" | +| name | A unique name for this target. | Name | required | | +| annotations | Extra settings to apply to crates. See [crate.annotation](#crateannotation). | Dictionary: String -> List of strings | optional | {} | +| bazel | The path to a bazel binary used to locate the output_base for the current workspace. | Label | optional | None | +| buildifier | The path to a [buildifier](https://github.com/bazelbuild/buildtools/blob/5.0.1/buildifier/README.md) binary used to format generated BUILD files. | Label | optional | //crate_universe/private/vendor:buildifier | +| cargo_bazel | The cargo-bazel binary to use for vendoring. If this attribute is not set, then a CARGO_BAZEL_GENERATOR_PATH action env will be used. | Label | optional | @cargo_bazel_bootstrap//:binary | +| cargo_config | A [Cargo configuration](https://doc.rust-lang.org/cargo/reference/config.html) file. | Label | optional | None | +| cargo_lockfile | The path to an existing Cargo.lock file | Label | optional | None | +| generate_build_scripts | Whether or not to generate [cargo build scripts](https://doc.rust-lang.org/cargo/reference/build-scripts.html) by default. | Boolean | optional | True | +| manifests | A list of Cargo manifests (Cargo.toml files). | List of labels | optional | [] | +| mode | Flags determining how crates should be vendored. local is where crate source and BUILD files are written to the repository. remote is where only BUILD files are written and repository rules used to fetch source code. | String | optional | "remote" | +| packages | A set of crates (packages) specifications to depend on. See [crate.spec](#crate.spec). | Dictionary: String -> String | optional | {} | +| repository_name | The name of the repository to generate for remote vendor modes. If unset, the label name will be used | String | optional | "" | +| splicing_config | The configuration flags to use for splicing Cargo maniests. Use //crate_universe:defs.bzl\%rsplicing_config to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" | +| supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | ["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-pc-windows-msvc", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "armv7-linux-androideabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd", "riscv32imc-unknown-none-elf"] | +| vendor_path | The path to a directory to write files into. Absolute paths will be treated as relative to the workspace root | String | optional | "crates" | @@ -420,13 +420,13 @@ Setting any one flag will otherwise determine the contents of the returned dict. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| normal | If True, normal dependencies are included in the output list. | False | -| normal_dev | If True, normla dev dependencies will be included in the output list.. | False | -| proc_macro | If True, proc_macro dependencies are included in the output list. | False | -| proc_macro_dev | If True, dev proc_macro dependencies are included in the output list. | False | -| build | If True, build dependencies are included in the output list. | False | -| build_proc_macro | If True, build proc_macro dependencies are included in the output list. | False | -| package_name | The package name of the set of dependencies to look up. Defaults to native.package_name() when unset. | None | +| normal | If True, normal dependencies are included in the output list. | `False` | +| normal_dev | If True, normla dev dependencies will be included in the output list.. | `False` | +| proc_macro | If True, proc_macro dependencies are included in the output list. | `False` | +| proc_macro_dev | If True, dev proc_macro dependencies are included in the output list. | `False` | +| build | If True, build dependencies are included in the output list. | `False` | +| build_proc_macro | If True, build proc_macro dependencies are included in the output list. | `False` | +| package_name | The package name of the set of dependencies to look up. Defaults to native.package_name() when unset. | `None` | **RETURNS** @@ -453,13 +453,13 @@ otherwise impact the contents of the returned list. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| normal | If True, normal dependencies are included in the output list. | False | -| normal_dev | If True, normla dev dependencies will be included in the output list.. | False | -| proc_macro | If True, proc_macro dependencies are included in the output list. | False | -| proc_macro_dev | If True, dev proc_macro dependencies are included in the output list. | False | -| build | If True, build dependencies are included in the output list. | False | -| build_proc_macro | If True, build proc_macro dependencies are included in the output list. | False | -| package_name | The package name of the set of dependencies to look up. Defaults to native.package_name() when unset. | None | +| normal | If True, normal dependencies are included in the output list. | `False` | +| normal_dev | If True, normla dev dependencies will be included in the output list.. | `False` | +| proc_macro | If True, proc_macro dependencies are included in the output list. | `False` | +| proc_macro_dev | If True, dev proc_macro dependencies are included in the output list. | `False` | +| build | If True, build dependencies are included in the output list. | `False` | +| build_proc_macro | If True, build proc_macro dependencies are included in the output list. | `False` | +| package_name | The package name of the set of dependencies to look up. Defaults to native.package_name() when unset. | `None` | **RETURNS** @@ -486,12 +486,12 @@ See [specifying dependencies][sd] in the Cargo book for more details. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| package | The explicit name of the package (used when attempting to alias a crate). | None | -| version | The exact version of the crate. Cannot be used with git. | None | -| default_features | Maps to the default-features flag. | True | -| features | A list of features to use for the crate | [] | -| git | The Git url to use for the crate. Cannot be used with version. | None | -| rev | The git revision of the remote crate. Tied with the git param. | None | +| package | The explicit name of the package (used when attempting to alias a crate). | `None` | +| version | The exact version of the crate. Cannot be used with git. | `None` | +| default_features | Maps to the default-features flag. | `True` | +| features | A list of features to use for the crate | `[]` | +| git | The Git url to use for the crate. Cannot be used with version. | `None` | +| rev | The git revision of the remote crate. Tied with the git param. | `None` | **RETURNS** @@ -518,32 +518,32 @@ A collection of extra attributes and settings for a particular crate | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| version | The version or semver-conditions to match with a crate. | "*" | -| additive_build_file | A file containing extra contents to write to the bottom of generated BUILD files. | None | -| additive_build_file_content | Extra contents to write to the bottom of generated BUILD files. | None | -| build_script_data | A list of labels to add to a crate's cargo_build_script::data attribute. | None | -| build_script_tools | A list of labels to add to a crate's cargo_build_script::tools attribute. | None | -| build_script_data_glob | A list of glob patterns to add to a crate's cargo_build_script::data attribute. | None | -| build_script_deps | A list of labels to add to a crate's cargo_build_script::deps attribute. | None | -| build_script_env | Additional environment variables to set on a crate's cargo_build_script::env attribute. | None | -| build_script_proc_macro_deps | A list of labels to add to a crate's cargo_build_script::proc_macro_deps attribute. | None | -| build_script_rustc_env | Additional environment variables to set on a crate's cargo_build_script::env attribute. | None | -| build_script_toolchains | A list of labels to set on a crates's cargo_build_script::toolchains attribute. | None | -| compile_data | A list of labels to add to a crate's rust_library::compile_data attribute. | None | -| compile_data_glob | A list of glob patterns to add to a crate's rust_library::compile_data attribute. | None | -| crate_features | A list of strings to add to a crate's rust_library::crate_features attribute. | None | -| data | A list of labels to add to a crate's rust_library::data attribute. | None | -| data_glob | A list of glob patterns to add to a crate's rust_library::data attribute. | None | -| deps | A list of labels to add to a crate's rust_library::deps attribute. | None | -| gen_build_script | An authorative flag to determine whether or not to produce cargo_build_script targets for the current crate. | None | -| patch_args | The patch_args attribute of a Bazel repository rule. See [http_archive.patch_args](https://docs.bazel.build/versions/main/repo/http.html#http_archive-patch_args) | None | -| patch_tool | The patch_tool attribute of a Bazel repository rule. See [http_archive.patch_tool](https://docs.bazel.build/versions/main/repo/http.html#http_archive-patch_tool) | None | -| patches | The patches attribute of a Bazel repository rule. See [http_archive.patches](https://docs.bazel.build/versions/main/repo/http.html#http_archive-patches) | None | -| proc_macro_deps | A list of labels to add to a crate's rust_library::proc_macro_deps attribute. | None | -| rustc_env | Additional variables to set on a crate's rust_library::rustc_env attribute. | None | -| rustc_env_files | A list of labels to set on a crate's rust_library::rustc_env_files attribute. | None | -| rustc_flags | A list of strings to set on a crate's rust_library::rustc_flags attribute. | None | -| shallow_since | An optional timestamp used for crates originating from a git repository instead of a crate registry. This flag optimizes fetching the source code. | None | +| version | The version or semver-conditions to match with a crate. | `"*"` | +| additive_build_file | A file containing extra contents to write to the bottom of generated BUILD files. | `None` | +| additive_build_file_content | Extra contents to write to the bottom of generated BUILD files. | `None` | +| build_script_data | A list of labels to add to a crate's cargo_build_script::data attribute. | `None` | +| build_script_tools | A list of labels to add to a crate's cargo_build_script::tools attribute. | `None` | +| build_script_data_glob | A list of glob patterns to add to a crate's cargo_build_script::data attribute. | `None` | +| build_script_deps | A list of labels to add to a crate's cargo_build_script::deps attribute. | `None` | +| build_script_env | Additional environment variables to set on a crate's cargo_build_script::env attribute. | `None` | +| build_script_proc_macro_deps | A list of labels to add to a crate's cargo_build_script::proc_macro_deps attribute. | `None` | +| build_script_rustc_env | Additional environment variables to set on a crate's cargo_build_script::env attribute. | `None` | +| build_script_toolchains | A list of labels to set on a crates's cargo_build_script::toolchains attribute. | `None` | +| compile_data | A list of labels to add to a crate's rust_library::compile_data attribute. | `None` | +| compile_data_glob | A list of glob patterns to add to a crate's rust_library::compile_data attribute. | `None` | +| crate_features | A list of strings to add to a crate's rust_library::crate_features attribute. | `None` | +| data | A list of labels to add to a crate's rust_library::data attribute. | `None` | +| data_glob | A list of glob patterns to add to a crate's rust_library::data attribute. | `None` | +| deps | A list of labels to add to a crate's rust_library::deps attribute. | `None` | +| gen_build_script | An authorative flag to determine whether or not to produce cargo_build_script targets for the current crate. | `None` | +| patch_args | The patch_args attribute of a Bazel repository rule. See [http_archive.patch_args](https://docs.bazel.build/versions/main/repo/http.html#http_archive-patch_args) | `None` | +| patch_tool | The patch_tool attribute of a Bazel repository rule. See [http_archive.patch_tool](https://docs.bazel.build/versions/main/repo/http.html#http_archive-patch_tool) | `None` | +| patches | The patches attribute of a Bazel repository rule. See [http_archive.patches](https://docs.bazel.build/versions/main/repo/http.html#http_archive-patches) | `None` | +| proc_macro_deps | A list of labels to add to a crate's rust_library::proc_macro_deps attribute. | `None` | +| rustc_env | Additional variables to set on a crate's rust_library::rustc_env attribute. | `None` | +| rustc_env_files | A list of labels to set on a crate's rust_library::rustc_env_files attribute. | `None` | +| rustc_flags | A list of strings to set on a crate's rust_library::rustc_flags attribute. | `None` | +| shallow_since | An optional timestamp used for crates originating from a git repository instead of a crate registry. This flag optimizes fetching the source code. | `None` | **RETURNS** @@ -566,7 +566,7 @@ Define information for extra workspace members | Name | Description | Default Value | | :------------- | :------------- | :------------- | | version | The semver of the crate to download. Must be an exact version. | none | -| sha256 | The sha256 checksum of the .crate file. | None | +| sha256 | The sha256 checksum of the .crate file. | `None` | **RETURNS** @@ -589,7 +589,7 @@ Finds the fully qualified label of the requested crates for the package where th | Name | Description | Default Value | | :------------- | :------------- | :------------- | | deps | The desired list of crate targets. | none | -| package_name | The package name of the set of dependencies to look up. Defaults to native.package_name(). | None | +| package_name | The package name of the set of dependencies to look up. Defaults to native.package_name(). | `None` | **RETURNS** @@ -623,8 +623,8 @@ Define dependencies of the `cargo-bazel` Rust target | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| rust_version | The version of rust to use when generating dependencies. | "1.65.0" | -| bootstrap | If true, a cargo_bootstrap_repository target will be generated. | False | +| rust_version | The version of rust to use when generating dependencies. | `"1.65.0"` | +| bootstrap | If true, a cargo_bootstrap_repository target will be generated. | `False` | @@ -657,14 +657,14 @@ can be found below where the supported keys for each template can be found in th | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| build_file_template | The base template to use for BUILD file names. The available format keys are [{name}, {version}]. | "//:BUILD.{name}-{version}.bazel" | -| crate_label_template | The base template to use for crate labels. The available format keys are [{repository}, {name}, {version}, {target}]. | "@{repository}__{name}-{version}//:{target}" | -| crate_repository_template | The base template to use for Crate label repository names. The available format keys are [{repository}, {name}, {version}]. | "{repository}__{name}-{version}" | -| crates_module_template | The pattern to use for the defs.bzl and BUILD.bazel file names used for the crates module. The available format keys are [{file}]. | "//:{file}" | -| default_package_name | The default package name to use in the rendered macros. This affects the auto package detection of things like all_crate_deps. | None | -| platforms_template | The base template to use for platform names. See [platforms documentation](https://docs.bazel.build/versions/main/platforms.html). The available format keys are [{triple}]. | "@rules_rust//rust/platform:{triple}" | -| regen_command | An optional command to demonstrate how generated files should be regenerated. | None | -| vendor_mode | An optional configuration for rendirng content to be rendered into repositories. | None | +| build_file_template | The base template to use for BUILD file names. The available format keys are [{name}, {version}]. | `"//:BUILD.{name}-{version}.bazel"` | +| crate_label_template | The base template to use for crate labels. The available format keys are [{repository}, {name}, {version}, {target}]. | `"@{repository}__{name}-{version}//:{target}"` | +| crate_repository_template | The base template to use for Crate label repository names. The available format keys are [{repository}, {name}, {version}]. | `"{repository}__{name}-{version}"` | +| crates_module_template | The pattern to use for the defs.bzl and BUILD.bazel file names used for the crates module. The available format keys are [{file}]. | `"//:{file}"` | +| default_package_name | The default package name to use in the rendered macros. This affects the auto package detection of things like all_crate_deps. | `None` | +| platforms_template | The base template to use for platform names. See [platforms documentation](https://docs.bazel.build/versions/main/platforms.html). The available format keys are [{triple}]. | `"@rules_rust//rust/platform:{triple}"` | +| regen_command | An optional command to demonstrate how generated files should be regenerated. | `None` | +| vendor_mode | An optional configuration for rendirng content to be rendered into repositories. | `None` | **RETURNS** @@ -689,7 +689,7 @@ Various settings used to configure Cargo manifest splicing behavior. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| resolver_version | The [resolver version][rv] to use in generated Cargo manifests. This flag is **only** used when splicing a manifest from direct package definitions. See crates_repository::packages. | "1" | +| resolver_version | The [resolver version][rv] to use in generated Cargo manifests. This flag is **only** used when splicing a manifest from direct package definitions. See crates_repository::packages. | `"1"` | **RETURNS** diff --git a/docs/defs.md b/docs/defs.md index ac7affe206..4b2574123a 100644 --- a/docs/defs.md +++ b/docs/defs.md @@ -28,7 +28,7 @@ Control whether to print clippy output or store it to a file, using the configur | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -46,7 +46,7 @@ Change the [--error-format](https://doc.rust-lang.org/rustc/command-line-argumen | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -64,7 +64,7 @@ Add additional rustc_flag from the command line with `--@rules_rust//:extra_rust | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -82,7 +82,7 @@ Add additional rustc_flags from the command line with `--@rules_rust//:extra_rus | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -123,7 +123,7 @@ pub struct Greeter { } impl Greeter { - pub fn new(greeting: &str) -> Greeter { + pub fn new(greeting: &str) -> Greeter { Greeter { greeting: greeting.to_string(), } } @@ -187,26 +187,26 @@ is available under the key `dsym_folder` in `OutputGroupInfo`. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| crate_type | Crate type that will be passed to rustc to be used for building this crate.

This option is a temporary workaround and should be used only when building for WebAssembly targets (//rust/platform:wasi and //rust/platform:wasm). | String | optional | "bin" | -| 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_cc_common_link | Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. | Integer | optional | -1 | -| 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 | [] | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | -1 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| crate_type | Crate type that will be passed to rustc to be used for building this crate.

This option is a temporary workaround and should be used only when building for WebAssembly targets (//rust/platform:wasi and //rust/platform:wasm). | String | optional | "bin" | +| 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_cc_common_link | Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. | Integer | optional | -1 | +| 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 | [] | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | -1 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -242,7 +242,7 @@ pub struct Greeter { } impl Greeter { - pub fn new(greeting: &str) -> Greeter { + pub fn new(greeting: &str) -> Greeter { Greeter { greeting: greeting.to_string(), } } @@ -288,23 +288,23 @@ INFO: Elapsed time: 1.245s, Critical Path: 1.01s | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | [] | -| disable_pipelining | Disables pipelining for this rule if it is globally enabled. This will cause this rule to not produce a .rmeta file and all the dependent crates will instead use the .rlib file. | Boolean | optional | False | -| edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | [] | +| disable_pipelining | Disables pipelining for this rule if it is globally enabled. This will cause this rule to not produce a .rmeta file and all the dependent crates will instead use the .rlib file. | Boolean | optional | False | +| edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -325,22 +325,22 @@ Builds a Rust proc-macro crate. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | "" | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | "" | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -369,22 +369,22 @@ When building the whole binary in Bazel, use `rust_library` instead. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | "" | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | "" | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -413,22 +413,22 @@ When building the whole binary in Bazel, use `rust_library` instead. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | "" | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | "" | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -463,11 +463,11 @@ pub struct Greeter { } impl Greeter { - pub fn new(greeting: &str) -> Greeter { + pub fn new(greeting: &str) -> Greeter { Greeter { greeting: greeting.to_string(), } } - pub fn greet(&self, thing: &str) -> String { + pub fn greet(&self, thing: &str) -> String { format!("{} {}", &self.greeting, thing) } } @@ -564,26 +564,26 @@ Run the test with `bazel test //hello_lib:greeting_test`. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate | Target inline tests declared in the given crate

These tests are typically those that would be held out under #[cfg(test)] declarations. | Label | optional | None | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | "" | -| 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. | Dictionary: String -> String | optional | {} | -| experimental_use_cc_common_link | Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. | Integer | optional | -1 | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| use_libtest_harness | Whether to use libtest. For targets using this flag, individual tests can be run by using the [--test_arg](https://docs.bazel.build/versions/4.0.0/command-line-reference.html#flag--test_arg) flag. E.g. bazel test //src:rust_test --test_arg=foo::test::test_fn. | Boolean | optional | True | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate | Target inline tests declared in the given crate

These tests are typically those that would be held out under #[cfg(test)] declarations. | Label | optional | None | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | "" | +| 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. | Dictionary: String -> String | optional | {} | +| experimental_use_cc_common_link | Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. | Integer | optional | -1 | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| use_libtest_harness | Whether to use libtest. For targets using this flag, individual tests can be run by using the [--test_arg](https://docs.bazel.build/versions/4.0.0/command-line-reference.html#flag--test_arg) flag. E.g. bazel test //src:rust_test --test_arg=foo::test::test_fn. | Boolean | optional | True | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | diff --git a/docs/flatten.md b/docs/flatten.md index 9a73478905..9a2f2654e4 100644 --- a/docs/flatten.md +++ b/docs/flatten.md @@ -69,7 +69,7 @@ Control whether to print clippy output or store it to a file, using the configur | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -89,20 +89,20 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this repository. | Name | required | | -| binary | The binary to build (the --bin parameter for Cargo). If left empty, the repository name will be used. | String | optional | "" | -| build_mode | The build mode the binary should be built with | String | optional | "release" | -| cargo_lockfile | The lockfile of the crate_universe resolver | Label | required | | -| cargo_toml | The path of the crate_universe resolver manifest (Cargo.toml file) | Label | required | | -| env | A mapping of platform triple to a set of environment variables. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | -| env_label | A mapping of platform triple to a set of environment variables. This attribute differs from env in that all variables passed here must be fully qualified labels of files. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | -| iso_date | The iso_date of cargo binary the resolver should use. Note: This can only be set if version is beta or nightly | String | optional | "" | -| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| srcs | Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made | List of labels | optional | [] | -| timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | 600 | -| version | The version of cargo the resolver should use | String | optional | "1.65.0" | +| name | A unique name for this repository. | Name | required | | +| binary | The binary to build (the --bin parameter for Cargo). If left empty, the repository name will be used. | String | optional | "" | +| build_mode | The build mode the binary should be built with | String | optional | "release" | +| cargo_lockfile | The lockfile of the crate_universe resolver | Label | required | | +| cargo_toml | The path of the crate_universe resolver manifest (Cargo.toml file) | Label | required | | +| env | A mapping of platform triple to a set of environment variables. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | +| env_label | A mapping of platform triple to a set of environment variables. This attribute differs from env in that all variables passed here must be fully qualified labels of files. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | +| iso_date | The iso_date of cargo binary the resolver should use. Note: This can only be set if version is beta or nightly | String | optional | "" | +| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | +| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | +| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | +| srcs | Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made | List of labels | optional | [] | +| timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | 600 | +| version | The version of cargo the resolver should use | String | optional | "1.65.0" | @@ -120,9 +120,9 @@ A rule for generating variables for dependent `cargo_build_script`s without a bu | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| out_dir | Folder containing additional inputs when building all direct dependencies.

This has the same effect as a cargo_build_script which prints puts files into $OUT_DIR, but without requiring a build script. | Label | optional | None | -| src | File containing additional environment variables to set for build scripts of direct dependencies.

This has the same effect as a cargo_build_script which prints cargo:VAR=VALUE lines, but without requiring a build script.

This 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 (\\). | Label | required | | +| name | A unique name for this target. | Name | required | | +| out_dir | Folder containing additional inputs when building all direct dependencies.

This has the same effect as a cargo_build_script which prints puts files into $OUT_DIR, but without requiring a build script. | Label | optional | None | +| src | File containing additional environment variables to set for build scripts of direct dependencies.

This has the same effect as a cargo_build_script which prints cargo:VAR=VALUE lines, but without requiring a build script.

This 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 (\\). | Label | required | | @@ -140,7 +140,7 @@ Change the [--error-format](https://doc.rust-lang.org/rustc/command-line-argumen | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -158,7 +158,7 @@ Add additional rustc_flag from the command line with `--@rules_rust//:extra_rust | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -176,7 +176,7 @@ Add additional rustc_flags from the command line with `--@rules_rust//:extra_rus | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -194,7 +194,7 @@ A rule defining an incompatible flag. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | | issue | The link to the github issue associated with this flag | String | required | | @@ -213,10 +213,10 @@ A toolchain for [rust-analyzer](https://rust-analyzer.github.io/). | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| proc_macro_srv | The path to a rust_analyzer_proc_macro_srv binary. | Label | optional | None | -| rustc | The path to a rustc binary. | Label | required | | -| rustc_srcs | The source code of rustc. | Label | required | | +| name | A unique name for this target. | Name | required | | +| proc_macro_srv | The path to a rust_analyzer_proc_macro_srv binary. | Label | optional | None | +| rustc | The path to a rustc binary. | Label | required | | +| rustc_srcs | The source code of rustc. | Label | required | | @@ -257,7 +257,7 @@ pub struct Greeter { } impl Greeter { - pub fn new(greeting: &str) -> Greeter { + pub fn new(greeting: &str) -> Greeter { Greeter { greeting: greeting.to_string(), } } @@ -321,26 +321,26 @@ is available under the key `dsym_folder` in `OutputGroupInfo`. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| crate_type | Crate type that will be passed to rustc to be used for building this crate.

This option is a temporary workaround and should be used only when building for WebAssembly targets (//rust/platform:wasi and //rust/platform:wasm). | String | optional | "bin" | -| 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_cc_common_link | Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. | Integer | optional | -1 | -| 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 | [] | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | -1 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| crate_type | Crate type that will be passed to rustc to be used for building this crate.

This option is a temporary workaround and should be used only when building for WebAssembly targets (//rust/platform:wasi and //rust/platform:wasm). | String | optional | "bin" | +| 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_cc_common_link | Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. | Integer | optional | -1 | +| 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 | [] | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | -1 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -358,12 +358,12 @@ Generates a rust source file from a cc_library and a header. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| bindgen_flags | Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details. | List of strings | optional | [] | -| cc_lib | The cc_library that contains the .h file. This is used to find the transitive includes. | Label | optional | None | -| clang_flags | Flags to pass directly to the clang executable. | List of strings | optional | [] | -| header | The .h file to generate bindings for. | Label | optional | None | -| rustfmt | Enable or disable running rustfmt on the generated file. | Boolean | optional | True | +| name | A unique name for this target. | Name | required | | +| bindgen_flags | Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details. | List of strings | optional | [] | +| cc_lib | The cc_library that contains the .h file. This is used to find the transitive includes. | Label | optional | None | +| clang_flags | Flags to pass directly to the clang executable. | List of strings | optional | [] | +| header | The .h file to generate bindings for. | Label | optional | None | +| rustfmt | Enable or disable running rustfmt on the generated file. | Boolean | optional | True | @@ -407,12 +407,12 @@ For additional information, see the [Bazel toolchains documentation](https://doc | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| bindgen | The label of a bindgen executable. | Label | optional | None | -| clang | The label of a clang executable. | Label | optional | None | -| libclang | A cc_library that provides bindgen's runtime dependency on libclang. | Label | optional | None | -| libstdcxx | A cc_library that satisfies libclang's libstdc++ dependency. This is used to make the execution of clang hermetic. If None, system libraries will be used instead. | Label | optional | None | -| rustfmt | The label of a rustfmt executable. If this is not provided, falls back to the rust_toolchain rustfmt. | Label | optional | None | +| name | A unique name for this target. | Name | required | | +| bindgen | The label of a bindgen executable. | Label | optional | None | +| clang | The label of a clang executable. | Label | optional | None | +| libclang | A cc_library that provides bindgen's runtime dependency on libclang. | Label | optional | None | +| libstdcxx | A cc_library that satisfies libclang's libstdc++ dependency. This is used to make the execution of clang hermetic. If None, system libraries will be used instead. | Label | optional | None | +| rustfmt | The label of a rustfmt executable. If this is not provided, falls back to the rust_toolchain rustfmt. | Label | optional | None | @@ -465,8 +465,8 @@ rust_clippy( | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| deps | Rust targets to run clippy on. | List of labels | optional | [] | +| name | A unique name for this target. | Name | required | | +| deps | Rust targets to run clippy on. | List of labels | optional | [] | @@ -520,13 +520,13 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| 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 | | -| 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 | -| markdown_css | CSS files to include via <link> in a rendered Markdown file. | List of labels | optional | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| 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 | | +| 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 | +| markdown_css | CSS files to include via <link> in a rendered Markdown file. | List of labels | optional | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | @@ -580,9 +580,9 @@ Running `bazel test //hello_lib:hello_lib_doc_test` will run all documentation t | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| 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 | [] | +| 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 | [] | @@ -623,9 +623,9 @@ rust_binary( | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| deps | List of proto_library dependencies that will be built. One crate for each proto_library will be created with the corresponding gRPC stubs. | List of labels | required | | -| rust_deps | The crates the generated library depends on. | List of labels | optional | [] | +| name | A unique name for this target. | Name | required | | +| deps | List of proto_library dependencies that will be built. One crate for each proto_library will be created with the corresponding gRPC stubs. | List of labels | required | | +| rust_deps | The crates the generated library depends on. | List of labels | optional | [] | @@ -661,7 +661,7 @@ pub struct Greeter { } impl Greeter { - pub fn new(greeting: &str) -> Greeter { + pub fn new(greeting: &str) -> Greeter { Greeter { greeting: greeting.to_string(), } } @@ -707,23 +707,23 @@ INFO: Elapsed time: 1.245s, Critical Path: 1.01s | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | [] | -| disable_pipelining | Disables pipelining for this rule if it is globally enabled. This will cause this rule to not produce a .rmeta file and all the dependent crates will instead use the .rlib file. | Boolean | optional | False | -| edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | [] | +| disable_pipelining | Disables pipelining for this rule if it is globally enabled. This will cause this rule to not produce a .rmeta file and all the dependent crates will instead use the .rlib file. | Boolean | optional | False | +| edition | The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. | String | optional | "" | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -744,22 +744,22 @@ Builds a Rust proc-macro crate. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | "" | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | "" | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -800,9 +800,9 @@ rust_binary( | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| deps | List of proto_library dependencies that will be built. One crate for each proto_library will be created with the corresponding stubs. | List of labels | required | | -| rust_deps | The crates the generated library depends on. | List of labels | optional | [] | +| name | A unique name for this target. | Name | required | | +| deps | List of proto_library dependencies that will be built. One crate for each proto_library will be created with the corresponding stubs. | List of labels | required | | +| rust_deps | The crates the generated library depends on. | List of labels | optional | [] | @@ -853,13 +853,13 @@ See @rules_rust//proto:BUILD for examples of defining the toolchain. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| edition | The edition used by the generated rust source. | String | optional | "" | -| grpc_compile_deps | The crates the generated grpc libraries depends on. | List of labels | optional | [Label("//proto/3rdparty/crates:protobuf"), Label("//proto/3rdparty/crates:grpc"), Label("//proto/3rdparty/crates:tls-api"), Label("//proto/3rdparty/crates:tls-api-stub")] | -| grpc_plugin | The location of the Rust protobuf compiler plugin to generate rust gRPC stubs. | Label | optional | //proto:protoc_gen_rust_grpc | -| proto_compile_deps | The crates the generated protobuf libraries depends on. | List of labels | optional | [Label("//proto/3rdparty/crates:protobuf")] | -| proto_plugin | The location of the Rust protobuf compiler plugin used to generate rust sources. | Label | optional | //proto:protoc_gen_rust | -| protoc | The location of the protoc binary. It should be an executable target. | Label | optional | @com_google_protobuf//:protoc | +| name | A unique name for this target. | Name | required | | +| edition | The edition used by the generated rust source. | String | optional | "" | +| grpc_compile_deps | The crates the generated grpc libraries depends on. | List of labels | optional | [Label("//proto/3rdparty/crates:protobuf"), Label("//proto/3rdparty/crates:grpc"), Label("//proto/3rdparty/crates:tls-api"), Label("//proto/3rdparty/crates:tls-api-stub")] | +| grpc_plugin | The location of the Rust protobuf compiler plugin to generate rust gRPC stubs. | Label | optional | //proto:protoc_gen_rust_grpc | +| proto_compile_deps | The crates the generated protobuf libraries depends on. | List of labels | optional | [Label("//proto/3rdparty/crates:protobuf")] | +| proto_plugin | The location of the Rust protobuf compiler plugin used to generate rust sources. | Label | optional | //proto:protoc_gen_rust | +| protoc | The location of the protoc binary. It should be an executable target. | Label | optional | @com_google_protobuf//:protoc | @@ -888,22 +888,22 @@ When building the whole binary in Bazel, use `rust_library` instead. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | "" | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | "" | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -932,22 +932,22 @@ When building the whole binary in Bazel, use `rust_library` instead. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | "" | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | "" | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -965,8 +965,8 @@ A dedicated filegroup-like rule for Rust stdlib artifacts. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| srcs | The list of targets/files that are components of the rust-stdlib file group | List of labels | required | | +| name | A unique name for this target. | Name | required | | +| srcs | The list of targets/files that are components of the rust-stdlib file group | List of labels | required | | @@ -1001,11 +1001,11 @@ pub struct Greeter { } impl Greeter { - pub fn new(greeting: &str) -> Greeter { + pub fn new(greeting: &str) -> Greeter { Greeter { greeting: greeting.to_string(), } } - pub fn greet(&self, thing: &str) -> String { + pub fn greet(&self, thing: &str) -> String { format!("{} {}", &self.greeting, thing) } } @@ -1102,26 +1102,26 @@ Run the test with `bazel test //hello_lib:greeting_test`. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | -| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | -| crate | Target inline tests declared in the given crate

These tests are typically those that would be held out under #[cfg(test)] declarations. | Label | optional | None | -| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | -| crate_name | Crate name to use for this target.

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 | "" | -| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | -| 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 | "" | -| 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. | Dictionary: String -> String | optional | {} | -| experimental_use_cc_common_link | Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. | Integer | optional | -1 | -| 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 | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | -| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | -| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | -| use_libtest_harness | Whether to use libtest. For targets using this flag, individual tests can be run by using the [--test_arg](https://docs.bazel.build/versions/4.0.0/command-line-reference.html#flag--test_arg) flag. E.g. bazel test //src:rust_test --test_arg=foo::test::test_fn. | Boolean | optional | True | -| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | +| name | A unique name for this target. | Name | required | | +| aliases | Remap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given. | Dictionary: Label -> String | optional | {} | +| compile_data | List of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the [include_str!](https://doc.rust-lang.org/std/macro.include_str!.html) macro. | List of labels | optional | [] | +| crate | Target inline tests declared in the given crate

These tests are typically those that would be held out under #[cfg(test)] declarations. | Label | optional | None | +| crate_features | List of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags. | List of strings | optional | [] | +| crate_name | Crate name to use for this target.

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 | "" | +| crate_root | The file that will be passed to rustc to be used for building this crate.

If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. | Label | optional | None | +| 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 | "" | +| 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. | Dictionary: String -> String | optional | {} | +| experimental_use_cc_common_link | Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. | Integer | optional | -1 | +| 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 | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| srcs | List of Rust .rs source files used to build the library.

If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. | List of labels | optional | [] | +| stamp | Whether to encode build information into the Rustc action. Possible values:

- stamp = 1: Always stamp the build information into the Rustc action, even in [--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.

- stamp = 0: Always replace build information by constant values. This gives good build result caching.

- stamp = -1: Embedding of build information is controlled by the [--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.

Stamped targets are not rebuilt unless their dependencies change.

For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how [cc_library.linkstamps](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.linkstamp) behaves. | Integer | optional | 0 | +| use_libtest_harness | Whether to use libtest. For targets using this flag, individual tests can be run by using the [--test_arg](https://docs.bazel.build/versions/4.0.0/command-line-reference.html#flag--test_arg) flag. E.g. bazel test //src:rust_test --test_arg=foo::test::test_fn. | Boolean | optional | True | +| version | A version to inject in the cargo environment variable. | String | optional | "0.0.0" | @@ -1182,32 +1182,32 @@ See @rules_rust//rust:repositories.bzl for examples of defining the @rust_cpuX r | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | Label | optional | None | +| name | A unique name for this target. | Name | required | | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | Label | optional | None | | binary_ext | The extension for binaries created from rustc. | String | required | | -| cargo | The location of the cargo binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | -| clippy_driver | The location of the clippy-driver binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | -| debug_info | Rustc debug info levels per opt level | Dictionary: String -> String | optional | {"dbg": "2", "fastbuild": "0", "opt": "0"} | -| default_edition | The edition to use for rust_* rules that don't specify an edition. If absent, every rule is required to specify its edition attribute. | String | optional | "" | +| cargo | The location of the cargo binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | +| clippy_driver | The location of the clippy-driver binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | +| debug_info | Rustc debug info levels per opt level | Dictionary: String -> String | optional | {"dbg": "2", "fastbuild": "0", "opt": "0"} | +| default_edition | The edition to use for rust_* rules that don't specify an edition. If absent, every rule is required to specify its edition attribute. | String | optional | "" | | dylib_ext | The extension for dynamic libraries created from rustc. | String | required | | -| env | Environment variables to set in actions. | Dictionary: String -> String | optional | {} | +| env | Environment variables to set in actions. | Dictionary: String -> String | optional | {} | | exec_triple | The platform triple for the toolchains execution environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations | String | required | | -| experimental_use_cc_common_link | Label to a boolean build setting that controls whether cc_common.link is used to link rust binaries. | Label | optional | //rust/settings:experimental_use_cc_common_link | -| llvm_cov | The location of the llvm-cov binary. Can be a direct source or a filegroup containing one item. If None, rust code is not instrumented for coverage. | Label | optional | None | -| llvm_profdata | The location of the llvm-profdata binary. Can be a direct source or a filegroup containing one item. If llvm_cov is None, this can be None as well and rust code is not instrumented for coverage. | Label | optional | None | -| llvm_tools | LLVM tools that are shipped with the Rust toolchain. | Label | optional | None | -| opt_level | Rustc optimization levels. | Dictionary: String -> String | optional | {"dbg": "0", "fastbuild": "0", "opt": "3"} | +| experimental_use_cc_common_link | Label to a boolean build setting that controls whether cc_common.link is used to link rust binaries. | Label | optional | //rust/settings:experimental_use_cc_common_link | +| llvm_cov | The location of the llvm-cov binary. Can be a direct source or a filegroup containing one item. If None, rust code is not instrumented for coverage. | Label | optional | None | +| llvm_profdata | The location of the llvm-profdata binary. Can be a direct source or a filegroup containing one item. If llvm_cov is None, this can be None as well and rust code is not instrumented for coverage. | Label | optional | None | +| llvm_tools | LLVM tools that are shipped with the Rust toolchain. | Label | optional | None | +| opt_level | Rustc optimization levels. | Dictionary: String -> String | optional | {"dbg": "0", "fastbuild": "0", "opt": "3"} | | os | The operating system for the current toolchain | String | required | | -| rust_doc | The location of the rustdoc binary. Can be a direct source or a filegroup containing one item. | Label | required | | -| rust_std | The Rust standard library. | Label | optional | None | -| rustc | The location of the rustc binary. Can be a direct source or a filegroup containing one item. | Label | required | | -| rustc_lib | The libraries used by rustc during compilation. | Label | optional | None | -| rustc_srcs | **Deprecated**: Instead see [rust_analyzer_toolchain](#rust_analyzer_toolchain) | Label | optional | None | -| rustfmt | The location of the rustfmt binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | +| rust_doc | The location of the rustdoc binary. Can be a direct source or a filegroup containing one item. | Label | required | | +| rust_std | The Rust standard library. | Label | optional | None | +| rustc | The location of the rustc binary. Can be a direct source or a filegroup containing one item. | Label | required | | +| rustc_lib | The libraries used by rustc during compilation. | Label | optional | None | +| rustc_srcs | **Deprecated**: Instead see [rust_analyzer_toolchain](#rust_analyzer_toolchain) | Label | optional | None | +| rustfmt | The location of the rustfmt binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | | staticlib_ext | The extension for static libraries created from rustc. | String | required | | | stdlib_linkflags | Additional linker flags to use when Rust standard library is linked by a C++ linker (rustc will deal with these automatically). Subject to location expansion with respect to the srcs of the rust_std attribute. | List of strings | required | | -| target_json | Override the target_triple with a custom target specification. For more details see: https://doc.rust-lang.org/rustc/targets/custom.html | Label | optional | None | -| target_triple | The platform triple for the toolchains target environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations | String | optional | "" | +| target_json | Override the target_triple with a custom target specification. For more details see: https://doc.rust-lang.org/rustc/targets/custom.html | Label | optional | None | +| target_triple | The platform triple for the toolchains target environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations | String | optional | "" | @@ -1226,10 +1226,10 @@ Generates a toolchain-bearing repository that declares the toolchains from some | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this repository. | Name | required | | -| exec_compatible_with | A list of constraints for the execution platform for this toolchain. | List of strings | optional | [] | -| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| target_compatible_with | A list of constraints for the target platform for this toolchain. | List of strings | optional | [] | +| name | A unique name for this repository. | Name | required | | +| exec_compatible_with | A list of constraints for the execution platform for this toolchain. | List of strings | optional | [] | +| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | +| target_compatible_with | A list of constraints for the target platform for this toolchain. | List of strings | optional | [] | | toolchain | The name of the toolchain implementation target. | String | required | | | toolchain_type | The toolchain type of the toolchain to declare | String | required | | @@ -1253,19 +1253,19 @@ A given instance of this rule should be accompanied by a toolchain_repository_pr | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this repository. | Name | required | | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | String | optional | "" | -| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | Dictionary: String -> String | optional | {} | -| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | Boolean | optional | False | -| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | String | optional | "" | +| name | A unique name for this repository. | Name | required | | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | String | optional | "" | +| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | Dictionary: String -> String | optional | {} | +| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | Boolean | optional | False | +| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | String | optional | "" | | exec_triple | The Rust-style target that this compiler runs on | String | required | | -| include_rustc_srcs | Whether to download and unpack the rustc source files. These are very large, and slow to unpack, but are required to support rust analyzer. An environment variable RULES_RUST_TOOLCHAIN_INCLUDE_RUSTC_SRCS can also be used to control this attribute. This variable will take precedence over the hard coded attribute. Setting it to true to activates this attribute where all other values deactivate it. | Boolean | optional | False | -| iso_date | The date of the tool (or None, if the version is a specific version). | String | optional | "" | -| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| rustfmt_version | The version of the tool among "nightly", "beta", or an exact version. | String | optional | "" | -| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | Dictionary: String -> String | optional | {} | +| include_rustc_srcs | Whether to download and unpack the rustc source files. These are very large, and slow to unpack, but are required to support rust analyzer. An environment variable RULES_RUST_TOOLCHAIN_INCLUDE_RUSTC_SRCS can also be used to control this attribute. This variable will take precedence over the hard coded attribute. Setting it to true to activates this attribute where all other values deactivate it. | Boolean | optional | False | +| iso_date | The date of the tool (or None, if the version is a specific version). | String | optional | "" | +| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | +| rustfmt_version | The version of the tool among "nightly", "beta", or an exact version. | String | optional | "" | +| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | Dictionary: String -> String | optional | {} | | target_triple | The Rust-style target that this compiler builds for. | String | required | | -| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | List of strings | optional | ["https://static.rust-lang.org/dist/{}.tar.gz"] | +| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | List of strings | optional | ["https://static.rust-lang.org/dist/{}.tar.gz"] | | version | The version of the tool among "nightly", "beta", or an exact version. | String | required | | @@ -1300,10 +1300,10 @@ An example of this rule in use can be seen at [@rules_rust//examples/wasm](../ex | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| bindgen_flags | Flags to pass directly to the bindgen executable. See https://github.com/rustwasm/wasm-bindgen/ for details. | List of strings | optional | [] | -| target | The type of output to generate. See https://rustwasm.github.io/wasm-bindgen/reference/deployment.html for details. | String | optional | "bundler" | -| wasm_file | The .wasm file or crate to generate bindings for. | Label | required | | +| name | A unique name for this target. | Name | required | | +| bindgen_flags | Flags to pass directly to the bindgen executable. See https://github.com/rustwasm/wasm-bindgen/ for details. | List of strings | optional | [] | +| target | The type of output to generate. See https://rustwasm.github.io/wasm-bindgen/reference/deployment.html for details. | String | optional | "bundler" | +| wasm_file | The .wasm file or crate to generate bindings for. | Label | required | | @@ -1350,8 +1350,8 @@ For additional information, see the [Bazel toolchains documentation][toolchains] | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| bindgen | The label of a wasm-bindgen-cli executable. | Label | optional | None | +| name | A unique name for this target. | Name | required | | +| bindgen | The label of a wasm-bindgen-cli executable. | Label | optional | None | @@ -1369,8 +1369,8 @@ A test rule for performing `rustfmt --check` on a set of targets | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| targets | Rust targets to run rustfmt --check on. | List of labels | optional | [] | +| name | A unique name for this target. | Name | required | | +| targets | Rust targets to run rustfmt --check on. | List of labels | optional | [] | @@ -1536,17 +1536,17 @@ The `hello_lib` target will be build with the flags and the environment variable | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | The name for the underlying rule. This should be the name of the package being compiled, optionally with a suffix of _build_script. | none | -| crate_features | A list of features to enable for the build script. | [] | -| version | The semantic version (semver) of the crate. | None | -| deps | The dependencies of the crate. | [] | -| build_script_env | Environment variables for build scripts. | {} | -| data | Files needed by the build script. | [] | -| tools | Tools (executables) needed by the build script. | [] | -| links | Name of the native library this crate links against. | None | -| rustc_env | Environment variables to set in rustc when compiling the build script. | {} | -| rustc_flags | List of compiler flags passed to rustc. | [] | -| visibility | Visibility to apply to the generated build script output. | None | -| tags | (list of str, optional): Tags to apply to the generated build script output. | None | +| crate_features | A list of features to enable for the build script. | `[]` | +| version | The semantic version (semver) of the crate. | `None` | +| deps | The dependencies of the crate. | `[]` | +| build_script_env | Environment variables for build scripts. | `{}` | +| data | Files needed by the build script. | `[]` | +| tools | Tools (executables) needed by the build script. | `[]` | +| links | Name of the native library this crate links against. | `None` | +| rustc_env | Environment variables to set in rustc when compiling the build script. | `{}` | +| rustc_flags | List of compiler flags passed to rustc. | `[]` | +| visibility | Visibility to apply to the generated build script output. | `None` | +| tags | (list of str, optional): Tags to apply to the generated build script output. | `None` | | kwargs | Forwards to the underlying rust_binary rule. | none | @@ -1642,9 +1642,9 @@ Arguments are the same as `rust_bindgen`, and `kwargs` are passed directly to ru | name | A unique name for this target. | none | | header | The label of the .h file to generate bindings for. | none | | cc_lib | The label of the cc_library that contains the .h file. This is used to find the transitive includes. | none | -| bindgen_flags | Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details. | None | -| clang_flags | Flags to pass directly to the clang executable. | None | -| rustfmt | Enable or disable running rustfmt on the generated file. | True | +| bindgen_flags | Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details. | `None` | +| clang_flags | Flags to pass directly to the clang executable. | `None` | +| rustfmt | Enable or disable running rustfmt on the generated file. | `True` | | kwargs | Arguments to forward to the underlying rust_library rule. | none | @@ -1666,7 +1666,7 @@ Registers the default toolchains for the `rules_rust` [bindgen][bg] rules. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| register_toolchains | Whether or not to register toolchains. | True | +| register_toolchains | Whether or not to register toolchains. | `True` | @@ -1684,7 +1684,7 @@ Declare dependencies needed for proto compilation. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| register_default_toolchain | If True, the default [rust_proto_toolchain](#rust_proto_toolchain) (@rules_rust//proto:default-proto-toolchain) is registered. This toolchain requires a set of dependencies that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. | True | +| register_default_toolchain | If True, the default [rust_proto_toolchain](#rust_proto_toolchain) (@rules_rust//proto:default-proto-toolchain) is registered. This toolchain requires a set of dependencies that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. | `True` | @@ -1733,17 +1733,17 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | False | -| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every target is required to specify its edition attribute. | None | -| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. See [rust_toolchain_repository.include_rustc_srcs](#rust_toolchain_repository-include_rustc_srcs). for more details | False | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | -| iso_date | The date of the nightly or beta release (ignored if the version is a specific version). | None | -| register_toolchains | If true, repositories will be generated to produce and register rust_toolchain targets. | True | -| rustfmt_version | The version of rustfmt. Either "nightly", "beta", or an exact version. Defaults to version if not specified. | None | -| sha256s | A dict associating tool subdirectories to sha256 hashes. | None | -| extra_target_triples | Additional rust-style targets that rust toolchains should support. | ["wasm32-unknown-unknown", "wasm32-wasi"] | -| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | ["https://static.rust-lang.org/dist/{}.tar.gz"] | -| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | "1.65.0" | +| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | `False` | +| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every target is required to specify its edition attribute. | `None` | +| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. See [rust_toolchain_repository.include_rustc_srcs](#rust_toolchain_repository-include_rustc_srcs). for more details | `False` | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` | +| iso_date | The date of the nightly or beta release (ignored if the version is a specific version). | `None` | +| register_toolchains | If true, repositories will be generated to produce and register rust_toolchain targets. | `True` | +| rustfmt_version | The version of rustfmt. Either "nightly", "beta", or an exact version. Defaults to version if not specified. | `None` | +| sha256s | A dict associating tool subdirectories to sha256 hashes. | `None` | +| extra_target_triples | Additional rust-style targets that rust toolchains should support. | `["wasm32-unknown-unknown", "wasm32-wasi"]` | +| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | `["https://static.rust-lang.org/dist/{}.tar.gz"]` | +| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | `"1.65.0"` | @@ -1784,17 +1784,17 @@ Assembles a remote repository for the given toolchain params, produces a proxy r | name | The name of the generated repository | none | | version | The version of the tool among "nightly", "beta', or an exact version. | none | | exec_triple | The Rust-style target that this compiler runs on | none | -| include_rustc_srcs | **Deprecated** - instead see [rust_analyzer_toolchain_repository](#rust_analyzer_toolchain_repository). | False | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | -| extra_target_triples | Additional rust-style targets that this set of toolchains should support. | [] | -| iso_date | The date of the tool. | None | -| rustfmt_version | The version of rustfmt to be associated with the toolchain. | None | -| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | None | -| dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". | False | -| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | None | -| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | ["https://static.rust-lang.org/dist/{}.tar.gz"] | -| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | None | -| register_toolchain | If True, the generated rust_toolchain target will become a registered toolchain. | True | +| include_rustc_srcs | **Deprecated** - instead see [rust_analyzer_toolchain_repository](#rust_analyzer_toolchain_repository). | `False` | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` | +| extra_target_triples | Additional rust-style targets that this set of toolchains should support. | `[]` | +| iso_date | The date of the tool. | `None` | +| rustfmt_version | The version of rustfmt to be associated with the toolchain. | `None` | +| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | `None` | +| dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". | `False` | +| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | `None` | +| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | `["https://static.rust-lang.org/dist/{}.tar.gz"]` | +| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | `None` | +| register_toolchain | If True, the generated rust_toolchain target will become a registered toolchain. | `True` | @@ -1885,17 +1885,17 @@ N.B. A "proxy repository" is needed to allow for registering the toolchain (with | version | The version of the tool among "nightly", "beta', or an exact version. | none | | exec_triple | The Rust-style target that this compiler runs on. | none | | target_triple | The Rust-style target to build for. | none | -| exec_compatible_with | A list of constraints for the execution platform for this toolchain. | None | -| target_compatible_with | A list of constraints for the target platform for this toolchain. | None | -| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. | False | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | -| iso_date | The date of the tool. | None | -| rustfmt_version | The version of rustfmt to be associated with the toolchain. | None | -| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | None | -| dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". Defaults to False. | False | -| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | None | -| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz'] | ["https://static.rust-lang.org/dist/{}.tar.gz"] | -| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | None | +| exec_compatible_with | A list of constraints for the execution platform for this toolchain. | `None` | +| target_compatible_with | A list of constraints for the target platform for this toolchain. | `None` | +| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. | `False` | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` | +| iso_date | The date of the tool. | `None` | +| rustfmt_version | The version of rustfmt to be associated with the toolchain. | `None` | +| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | `None` | +| dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". Defaults to False. | `False` | +| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | `None` | +| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz'] | `["https://static.rust-lang.org/dist/{}.tar.gz"]` | +| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | `None` | **RETURNS** @@ -1934,7 +1934,7 @@ Registers the default toolchains for the `rules_rust` [wasm-bindgen][wb] rules. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| register_toolchains | Whether or not to register toolchains. | True | +| register_toolchains | Whether or not to register toolchains. | `True` | @@ -1963,7 +1963,7 @@ Annotates rust rules with RustAnalyzerInfo later used to build a rust-project.js | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -2011,7 +2011,7 @@ $ bazel build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | @@ -2048,6 +2048,6 @@ generated source files are also ignored by this aspect. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | diff --git a/docs/rust_analyzer.md b/docs/rust_analyzer.md index f3cba06587..f7b7f0f810 100644 --- a/docs/rust_analyzer.md +++ b/docs/rust_analyzer.md @@ -94,10 +94,10 @@ A toolchain for [rust-analyzer](https://rust-analyzer.github.io/). | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| proc_macro_srv | The path to a rust_analyzer_proc_macro_srv binary. | Label | optional | None | -| rustc | The path to a rustc binary. | Label | required | | -| rustc_srcs | The source code of rustc. | Label | required | | +| name | A unique name for this target. | Name | required | | +| proc_macro_srv | The path to a rust_analyzer_proc_macro_srv binary. | Label | optional | None | +| rustc | The path to a rustc binary. | Label | required | | +| rustc_srcs | The source code of rustc. | Label | required | | @@ -126,6 +126,6 @@ Annotates rust rules with RustAnalyzerInfo later used to build a rust-project.js | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | diff --git a/docs/rust_bindgen.md b/docs/rust_bindgen.md index 3e282483ae..7c1de29fa4 100644 --- a/docs/rust_bindgen.md +++ b/docs/rust_bindgen.md @@ -51,12 +51,12 @@ Generates a rust source file from a cc_library and a header. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| bindgen_flags | Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details. | List of strings | optional | [] | -| cc_lib | The cc_library that contains the .h file. This is used to find the transitive includes. | Label | optional | None | -| clang_flags | Flags to pass directly to the clang executable. | List of strings | optional | [] | -| header | The .h file to generate bindings for. | Label | optional | None | -| rustfmt | Enable or disable running rustfmt on the generated file. | Boolean | optional | True | +| name | A unique name for this target. | Name | required | | +| bindgen_flags | Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details. | List of strings | optional | [] | +| cc_lib | The cc_library that contains the .h file. This is used to find the transitive includes. | Label | optional | None | +| clang_flags | Flags to pass directly to the clang executable. | List of strings | optional | [] | +| header | The .h file to generate bindings for. | Label | optional | None | +| rustfmt | Enable or disable running rustfmt on the generated file. | Boolean | optional | True | @@ -100,12 +100,12 @@ For additional information, see the [Bazel toolchains documentation](https://doc | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| bindgen | The label of a bindgen executable. | Label | optional | None | -| clang | The label of a clang executable. | Label | optional | None | -| libclang | A cc_library that provides bindgen's runtime dependency on libclang. | Label | optional | None | -| libstdcxx | A cc_library that satisfies libclang's libstdc++ dependency. This is used to make the execution of clang hermetic. If None, system libraries will be used instead. | Label | optional | None | -| rustfmt | The label of a rustfmt executable. If this is not provided, falls back to the rust_toolchain rustfmt. | Label | optional | None | +| name | A unique name for this target. | Name | required | | +| bindgen | The label of a bindgen executable. | Label | optional | None | +| clang | The label of a clang executable. | Label | optional | None | +| libclang | A cc_library that provides bindgen's runtime dependency on libclang. | Label | optional | None | +| libstdcxx | A cc_library that satisfies libclang's libstdc++ dependency. This is used to make the execution of clang hermetic. If None, system libraries will be used instead. | Label | optional | None | +| rustfmt | The label of a rustfmt executable. If this is not provided, falls back to the rust_toolchain rustfmt. | Label | optional | None | @@ -141,9 +141,9 @@ Arguments are the same as `rust_bindgen`, and `kwargs` are passed directly to ru | name | A unique name for this target. | none | | header | The label of the .h file to generate bindings for. | none | | cc_lib | The label of the cc_library that contains the .h file. This is used to find the transitive includes. | none | -| bindgen_flags | Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details. | None | -| clang_flags | Flags to pass directly to the clang executable. | None | -| rustfmt | Enable or disable running rustfmt on the generated file. | True | +| bindgen_flags | Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details. | `None` | +| clang_flags | Flags to pass directly to the clang executable. | `None` | +| rustfmt | Enable or disable running rustfmt on the generated file. | `True` | | kwargs | Arguments to forward to the underlying rust_library rule. | none | @@ -165,6 +165,6 @@ Registers the default toolchains for the `rules_rust` [bindgen][bg] rules. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| register_toolchains | Whether or not to register toolchains. | True | +| register_toolchains | Whether or not to register toolchains. | `True` | diff --git a/docs/rust_clippy.md b/docs/rust_clippy.md index 3e426f9100..9d4745e0e8 100644 --- a/docs/rust_clippy.md +++ b/docs/rust_clippy.md @@ -87,8 +87,8 @@ rust_clippy( | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| deps | Rust targets to run clippy on. | List of labels | optional | [] | +| name | A unique name for this target. | Name | required | | +| deps | Rust targets to run clippy on. | List of labels | optional | [] | @@ -136,6 +136,6 @@ $ bazel build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | diff --git a/docs/rust_doc.md b/docs/rust_doc.md index 009172fc9d..f9ae8358ca 100644 --- a/docs/rust_doc.md +++ b/docs/rust_doc.md @@ -55,13 +55,13 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| 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 | | -| 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 | -| markdown_css | CSS files to include via <link> in a rendered Markdown file. | List of labels | optional | [] | -| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | +| 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 | | +| 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 | +| markdown_css | CSS files to include via <link> in a rendered Markdown file. | List of labels | optional | [] | +| rustc_flags | List of compiler flags passed to rustc.

These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). | List of strings | optional | [] | @@ -115,8 +115,8 @@ Running `bazel test //hello_lib:hello_lib_doc_test` will run all documentation t | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| 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 | [] | +| 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 | [] | diff --git a/docs/rust_fmt.md b/docs/rust_fmt.md index e05f19d85c..18cbb4c4ee 100644 --- a/docs/rust_fmt.md +++ b/docs/rust_fmt.md @@ -61,8 +61,8 @@ A test rule for performing `rustfmt --check` on a set of targets | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| targets | Rust targets to run rustfmt --check on. | List of labels | optional | [] | +| name | A unique name for this target. | Name | required | | +| targets | Rust targets to run rustfmt --check on. | List of labels | optional | [] | @@ -99,6 +99,6 @@ generated source files are also ignored by this aspect. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | diff --git a/docs/rust_proto.md b/docs/rust_proto.md index 479cdb533c..4c21d5e2ca 100644 --- a/docs/rust_proto.md +++ b/docs/rust_proto.md @@ -155,9 +155,9 @@ rust_binary( | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| deps | List of proto_library dependencies that will be built. One crate for each proto_library will be created with the corresponding gRPC stubs. | List of labels | required | | -| rust_deps | The crates the generated library depends on. | List of labels | optional | [] | +| name | A unique name for this target. | Name | required | | +| deps | List of proto_library dependencies that will be built. One crate for each proto_library will be created with the corresponding gRPC stubs. | List of labels | required | | +| rust_deps | The crates the generated library depends on. | List of labels | optional | [] | @@ -198,9 +198,9 @@ rust_binary( | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| deps | List of proto_library dependencies that will be built. One crate for each proto_library will be created with the corresponding stubs. | List of labels | required | | -| rust_deps | The crates the generated library depends on. | List of labels | optional | [] | +| name | A unique name for this target. | Name | required | | +| deps | List of proto_library dependencies that will be built. One crate for each proto_library will be created with the corresponding stubs. | List of labels | required | | +| rust_deps | The crates the generated library depends on. | List of labels | optional | [] | @@ -251,13 +251,13 @@ See @rules_rust//proto:BUILD for examples of defining the toolchain. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| edition | The edition used by the generated rust source. | String | optional | "" | -| grpc_compile_deps | The crates the generated grpc libraries depends on. | List of labels | optional | [Label("//proto/3rdparty/crates:protobuf"), Label("//proto/3rdparty/crates:grpc"), Label("//proto/3rdparty/crates:tls-api"), Label("//proto/3rdparty/crates:tls-api-stub")] | -| grpc_plugin | The location of the Rust protobuf compiler plugin to generate rust gRPC stubs. | Label | optional | //proto:protoc_gen_rust_grpc | -| proto_compile_deps | The crates the generated protobuf libraries depends on. | List of labels | optional | [Label("//proto/3rdparty/crates:protobuf")] | -| proto_plugin | The location of the Rust protobuf compiler plugin used to generate rust sources. | Label | optional | //proto:protoc_gen_rust | -| protoc | The location of the protoc binary. It should be an executable target. | Label | optional | @com_google_protobuf//:protoc | +| name | A unique name for this target. | Name | required | | +| edition | The edition used by the generated rust source. | String | optional | "" | +| grpc_compile_deps | The crates the generated grpc libraries depends on. | List of labels | optional | [Label("//proto/3rdparty/crates:protobuf"), Label("//proto/3rdparty/crates:grpc"), Label("//proto/3rdparty/crates:tls-api"), Label("//proto/3rdparty/crates:tls-api-stub")] | +| grpc_plugin | The location of the Rust protobuf compiler plugin to generate rust gRPC stubs. | Label | optional | //proto:protoc_gen_rust_grpc | +| proto_compile_deps | The crates the generated protobuf libraries depends on. | List of labels | optional | [Label("//proto/3rdparty/crates:protobuf")] | +| proto_plugin | The location of the Rust protobuf compiler plugin used to generate rust sources. | Label | optional | //proto:protoc_gen_rust | +| protoc | The location of the protoc binary. It should be an executable target. | Label | optional | @com_google_protobuf//:protoc | @@ -275,7 +275,7 @@ Declare dependencies needed for proto compilation. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| register_default_toolchain | If True, the default [rust_proto_toolchain](#rust_proto_toolchain) (@rules_rust//proto:default-proto-toolchain) is registered. This toolchain requires a set of dependencies that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. | True | +| register_default_toolchain | If True, the default [rust_proto_toolchain](#rust_proto_toolchain) (@rules_rust//proto:default-proto-toolchain) is registered. This toolchain requires a set of dependencies that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. | `True` | diff --git a/docs/rust_repositories.md b/docs/rust_repositories.md index 2489022bc9..56a3cb06a1 100644 --- a/docs/rust_repositories.md +++ b/docs/rust_repositories.md @@ -27,8 +27,8 @@ A dedicated filegroup-like rule for Rust stdlib artifacts. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| srcs | The list of targets/files that are components of the rust-stdlib file group | List of labels | required | | +| name | A unique name for this target. | Name | required | | +| srcs | The list of targets/files that are components of the rust-stdlib file group | List of labels | required | | @@ -89,32 +89,32 @@ See @rules_rust//rust:repositories.bzl for examples of defining the @rust_cpuX r | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | Label | optional | None | +| name | A unique name for this target. | Name | required | | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | Label | optional | None | | binary_ext | The extension for binaries created from rustc. | String | required | | -| cargo | The location of the cargo binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | -| clippy_driver | The location of the clippy-driver binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | -| debug_info | Rustc debug info levels per opt level | Dictionary: String -> String | optional | {"dbg": "2", "fastbuild": "0", "opt": "0"} | -| default_edition | The edition to use for rust_* rules that don't specify an edition. If absent, every rule is required to specify its edition attribute. | String | optional | "" | +| cargo | The location of the cargo binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | +| clippy_driver | The location of the clippy-driver binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | +| debug_info | Rustc debug info levels per opt level | Dictionary: String -> String | optional | {"dbg": "2", "fastbuild": "0", "opt": "0"} | +| default_edition | The edition to use for rust_* rules that don't specify an edition. If absent, every rule is required to specify its edition attribute. | String | optional | "" | | dylib_ext | The extension for dynamic libraries created from rustc. | String | required | | -| env | Environment variables to set in actions. | Dictionary: String -> String | optional | {} | +| env | Environment variables to set in actions. | Dictionary: String -> String | optional | {} | | exec_triple | The platform triple for the toolchains execution environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations | String | required | | -| experimental_use_cc_common_link | Label to a boolean build setting that controls whether cc_common.link is used to link rust binaries. | Label | optional | //rust/settings:experimental_use_cc_common_link | -| llvm_cov | The location of the llvm-cov binary. Can be a direct source or a filegroup containing one item. If None, rust code is not instrumented for coverage. | Label | optional | None | -| llvm_profdata | The location of the llvm-profdata binary. Can be a direct source or a filegroup containing one item. If llvm_cov is None, this can be None as well and rust code is not instrumented for coverage. | Label | optional | None | -| llvm_tools | LLVM tools that are shipped with the Rust toolchain. | Label | optional | None | -| opt_level | Rustc optimization levels. | Dictionary: String -> String | optional | {"dbg": "0", "fastbuild": "0", "opt": "3"} | +| experimental_use_cc_common_link | Label to a boolean build setting that controls whether cc_common.link is used to link rust binaries. | Label | optional | //rust/settings:experimental_use_cc_common_link | +| llvm_cov | The location of the llvm-cov binary. Can be a direct source or a filegroup containing one item. If None, rust code is not instrumented for coverage. | Label | optional | None | +| llvm_profdata | The location of the llvm-profdata binary. Can be a direct source or a filegroup containing one item. If llvm_cov is None, this can be None as well and rust code is not instrumented for coverage. | Label | optional | None | +| llvm_tools | LLVM tools that are shipped with the Rust toolchain. | Label | optional | None | +| opt_level | Rustc optimization levels. | Dictionary: String -> String | optional | {"dbg": "0", "fastbuild": "0", "opt": "3"} | | os | The operating system for the current toolchain | String | required | | -| rust_doc | The location of the rustdoc binary. Can be a direct source or a filegroup containing one item. | Label | required | | -| rust_std | The Rust standard library. | Label | optional | None | -| rustc | The location of the rustc binary. Can be a direct source or a filegroup containing one item. | Label | required | | -| rustc_lib | The libraries used by rustc during compilation. | Label | optional | None | -| rustc_srcs | **Deprecated**: Instead see [rust_analyzer_toolchain](#rust_analyzer_toolchain) | Label | optional | None | -| rustfmt | The location of the rustfmt binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | +| rust_doc | The location of the rustdoc binary. Can be a direct source or a filegroup containing one item. | Label | required | | +| rust_std | The Rust standard library. | Label | optional | None | +| rustc | The location of the rustc binary. Can be a direct source or a filegroup containing one item. | Label | required | | +| rustc_lib | The libraries used by rustc during compilation. | Label | optional | None | +| rustc_srcs | **Deprecated**: Instead see [rust_analyzer_toolchain](#rust_analyzer_toolchain) | Label | optional | None | +| rustfmt | The location of the rustfmt binary. Can be a direct source or a filegroup containing one item. | Label | optional | None | | staticlib_ext | The extension for static libraries created from rustc. | String | required | | | stdlib_linkflags | Additional linker flags to use when Rust standard library is linked by a C++ linker (rustc will deal with these automatically). Subject to location expansion with respect to the srcs of the rust_std attribute. | List of strings | required | | -| target_json | Override the target_triple with a custom target specification. For more details see: https://doc.rust-lang.org/rustc/targets/custom.html | Label | optional | None | -| target_triple | The platform triple for the toolchains target environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations | String | optional | "" | +| target_json | Override the target_triple with a custom target specification. For more details see: https://doc.rust-lang.org/rustc/targets/custom.html | Label | optional | None | +| target_triple | The platform triple for the toolchains target environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations | String | optional | "" | @@ -133,10 +133,10 @@ Generates a toolchain-bearing repository that declares the toolchains from some | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this repository. | Name | required | | -| exec_compatible_with | A list of constraints for the execution platform for this toolchain. | List of strings | optional | [] | -| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| target_compatible_with | A list of constraints for the target platform for this toolchain. | List of strings | optional | [] | +| name | A unique name for this repository. | Name | required | | +| exec_compatible_with | A list of constraints for the execution platform for this toolchain. | List of strings | optional | [] | +| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | +| target_compatible_with | A list of constraints for the target platform for this toolchain. | List of strings | optional | [] | | toolchain | The name of the toolchain implementation target. | String | required | | | toolchain_type | The toolchain type of the toolchain to declare | String | required | | @@ -160,19 +160,19 @@ A given instance of this rule should be accompanied by a toolchain_repository_pr | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this repository. | Name | required | | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | String | optional | "" | -| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | Dictionary: String -> String | optional | {} | -| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | Boolean | optional | False | -| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | String | optional | "" | +| name | A unique name for this repository. | Name | required | | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | String | optional | "" | +| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | Dictionary: String -> String | optional | {} | +| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | Boolean | optional | False | +| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | String | optional | "" | | exec_triple | The Rust-style target that this compiler runs on | String | required | | -| include_rustc_srcs | Whether to download and unpack the rustc source files. These are very large, and slow to unpack, but are required to support rust analyzer. An environment variable RULES_RUST_TOOLCHAIN_INCLUDE_RUSTC_SRCS can also be used to control this attribute. This variable will take precedence over the hard coded attribute. Setting it to true to activates this attribute where all other values deactivate it. | Boolean | optional | False | -| iso_date | The date of the tool (or None, if the version is a specific version). | String | optional | "" | -| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| rustfmt_version | The version of the tool among "nightly", "beta", or an exact version. | String | optional | "" | -| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | Dictionary: String -> String | optional | {} | +| include_rustc_srcs | Whether to download and unpack the rustc source files. These are very large, and slow to unpack, but are required to support rust analyzer. An environment variable RULES_RUST_TOOLCHAIN_INCLUDE_RUSTC_SRCS can also be used to control this attribute. This variable will take precedence over the hard coded attribute. Setting it to true to activates this attribute where all other values deactivate it. | Boolean | optional | False | +| iso_date | The date of the tool (or None, if the version is a specific version). | String | optional | "" | +| repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | +| rustfmt_version | The version of the tool among "nightly", "beta", or an exact version. | String | optional | "" | +| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | Dictionary: String -> String | optional | {} | | target_triple | The Rust-style target that this compiler builds for. | String | required | | -| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | List of strings | optional | ["https://static.rust-lang.org/dist/{}.tar.gz"] | +| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | List of strings | optional | ["https://static.rust-lang.org/dist/{}.tar.gz"] | | version | The version of the tool among "nightly", "beta", or an exact version. | String | required | | @@ -220,17 +220,17 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | False | -| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every target is required to specify its edition attribute. | None | -| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. See [rust_toolchain_repository.include_rustc_srcs](#rust_toolchain_repository-include_rustc_srcs). for more details | False | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | -| iso_date | The date of the nightly or beta release (ignored if the version is a specific version). | None | -| register_toolchains | If true, repositories will be generated to produce and register rust_toolchain targets. | True | -| rustfmt_version | The version of rustfmt. Either "nightly", "beta", or an exact version. Defaults to version if not specified. | None | -| sha256s | A dict associating tool subdirectories to sha256 hashes. | None | -| extra_target_triples | Additional rust-style targets that rust toolchains should support. | ["wasm32-unknown-unknown", "wasm32-wasi"] | -| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | ["https://static.rust-lang.org/dist/{}.tar.gz"] | -| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | "1.65.0" | +| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | `False` | +| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every target is required to specify its edition attribute. | `None` | +| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. See [rust_toolchain_repository.include_rustc_srcs](#rust_toolchain_repository-include_rustc_srcs). for more details | `False` | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` | +| iso_date | The date of the nightly or beta release (ignored if the version is a specific version). | `None` | +| register_toolchains | If true, repositories will be generated to produce and register rust_toolchain targets. | `True` | +| rustfmt_version | The version of rustfmt. Either "nightly", "beta", or an exact version. Defaults to version if not specified. | `None` | +| sha256s | A dict associating tool subdirectories to sha256 hashes. | `None` | +| extra_target_triples | Additional rust-style targets that rust toolchains should support. | `["wasm32-unknown-unknown", "wasm32-wasi"]` | +| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | `["https://static.rust-lang.org/dist/{}.tar.gz"]` | +| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | `"1.65.0"` | @@ -271,17 +271,17 @@ Assembles a remote repository for the given toolchain params, produces a proxy r | name | The name of the generated repository | none | | version | The version of the tool among "nightly", "beta', or an exact version. | none | | exec_triple | The Rust-style target that this compiler runs on | none | -| include_rustc_srcs | **Deprecated** - instead see [rust_analyzer_toolchain_repository](#rust_analyzer_toolchain_repository). | False | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | -| extra_target_triples | Additional rust-style targets that this set of toolchains should support. | [] | -| iso_date | The date of the tool. | None | -| rustfmt_version | The version of rustfmt to be associated with the toolchain. | None | -| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | None | -| dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". | False | -| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | None | -| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | ["https://static.rust-lang.org/dist/{}.tar.gz"] | -| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | None | -| register_toolchain | If True, the generated rust_toolchain target will become a registered toolchain. | True | +| include_rustc_srcs | **Deprecated** - instead see [rust_analyzer_toolchain_repository](#rust_analyzer_toolchain_repository). | `False` | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` | +| extra_target_triples | Additional rust-style targets that this set of toolchains should support. | `[]` | +| iso_date | The date of the tool. | `None` | +| rustfmt_version | The version of rustfmt to be associated with the toolchain. | `None` | +| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | `None` | +| dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". | `False` | +| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | `None` | +| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | `["https://static.rust-lang.org/dist/{}.tar.gz"]` | +| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | `None` | +| register_toolchain | If True, the generated rust_toolchain target will become a registered toolchain. | `True` | @@ -308,17 +308,17 @@ N.B. A "proxy repository" is needed to allow for registering the toolchain (with | version | The version of the tool among "nightly", "beta', or an exact version. | none | | exec_triple | The Rust-style target that this compiler runs on. | none | | target_triple | The Rust-style target to build for. | none | -| exec_compatible_with | A list of constraints for the execution platform for this toolchain. | None | -| target_compatible_with | A list of constraints for the target platform for this toolchain. | None | -| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. | False | -| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | -| iso_date | The date of the tool. | None | -| rustfmt_version | The version of rustfmt to be associated with the toolchain. | None | -| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | None | -| dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". Defaults to False. | False | -| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | None | -| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz'] | ["https://static.rust-lang.org/dist/{}.tar.gz"] | -| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | None | +| exec_compatible_with | A list of constraints for the execution platform for this toolchain. | `None` | +| target_compatible_with | A list of constraints for the target platform for this toolchain. | `None` | +| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. | `False` | +| allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` | +| iso_date | The date of the tool. | `None` | +| rustfmt_version | The version of rustfmt to be associated with the toolchain. | `None` | +| edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. | `None` | +| dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". Defaults to False. | `False` | +| sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | `None` | +| urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz'] | `["https://static.rust-lang.org/dist/{}.tar.gz"]` | +| auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | `None` | **RETURNS** diff --git a/docs/rust_wasm_bindgen.md b/docs/rust_wasm_bindgen.md index 9af8ad3fc6..4ea6c23edc 100644 --- a/docs/rust_wasm_bindgen.md +++ b/docs/rust_wasm_bindgen.md @@ -56,10 +56,10 @@ An example of this rule in use can be seen at [@rules_rust//examples/wasm](../ex | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| bindgen_flags | Flags to pass directly to the bindgen executable. See https://github.com/rustwasm/wasm-bindgen/ for details. | List of strings | optional | [] | -| target | The type of output to generate. See https://rustwasm.github.io/wasm-bindgen/reference/deployment.html for details. | String | optional | "bundler" | -| wasm_file | The .wasm file or crate to generate bindings for. | Label | required | | +| name | A unique name for this target. | Name | required | | +| bindgen_flags | Flags to pass directly to the bindgen executable. See https://github.com/rustwasm/wasm-bindgen/ for details. | List of strings | optional | [] | +| target | The type of output to generate. See https://rustwasm.github.io/wasm-bindgen/reference/deployment.html for details. | String | optional | "bundler" | +| wasm_file | The .wasm file or crate to generate bindings for. | Label | required | | @@ -106,8 +106,8 @@ For additional information, see the [Bazel toolchains documentation][toolchains] | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | -| bindgen | The label of a wasm-bindgen-cli executable. | Label | optional | None | +| name | A unique name for this target. | Name | required | | +| bindgen | The label of a wasm-bindgen-cli executable. | Label | optional | None | @@ -142,6 +142,6 @@ Registers the default toolchains for the `rules_rust` [wasm-bindgen][wb] rules. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| register_toolchains | Whether or not to register toolchains. | True | +| register_toolchains | Whether or not to register toolchains. | `True` | diff --git a/docs/settings.md b/docs/settings.md index 0a1339ceee..d872c661cf 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -19,7 +19,7 @@ A rule defining an incompatible flag. | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this target. | Name | required | | +| name | A unique name for this target. | Name | required | | | issue | The link to the github issue associated with this flag | String | required | | diff --git a/docs/stardoc-attr-default-wrappers.patch b/docs/stardoc-attr-default-wrappers.patch new file mode 100644 index 0000000000..46ce163ba8 --- /dev/null +++ b/docs/stardoc-attr-default-wrappers.patch @@ -0,0 +1,23 @@ +commit 677356a2a00a2cb3b10e458c8586a2ea8bd562a4 +Author: Daniel Wagner-Hall +Date: Wed Nov 30 13:00:47 2022 +0000 + + Use backtick not `` for attr default values + + GitHub Pages doesn't recognise blocks, so renders these + attributes with smart-quotes, which means you can't copy-paste them into + a starlark file. + +diff --git stardoc/templates/markdown_tables/func.vm stardoc/templates/markdown_tables/func.vm +index 5275d08..e0d2496 100644 +--- stardoc/templates/markdown_tables/func.vm ++++ stardoc/templates/markdown_tables/func.vm +@@ -15,7 +15,7 @@ ${util.htmlEscape($funcInfo.docString)} + | Name | Description | Default Value | + | :------------- | :------------- | :------------- | + #foreach ($param in $funcInfo.getParameterList()) +-| $param.name | #if(!$param.docString.isEmpty()) ${util.markdownCellFormat($param.docString)} #else

-

#end | #if(!$param.getDefaultValue().isEmpty()) ${util.htmlEscape($param.getDefaultValue())} #else none #end| ++| $param.name | #if(!$param.docString.isEmpty()) ${util.markdownCellFormat($param.docString)} #else

-

#end | #if(!$param.getDefaultValue().isEmpty()) `${util.htmlEscape($param.getDefaultValue())}` #else none #end| + #end + #end + #if (!$funcInfo.getReturn().docString.isEmpty())