Cargo settings

Definitions for all @rules_rust//cargo settings

cargo_manifest_dir_filename_suffixes_to_retain

--@rules_rust//cargo/settings:cargo_manifest_dir_filename_suffixes_to_retain

A flag which determines what files are retained in CARGO_MANIFEST_DIR directories that are created in CargoBuildScriptRun actions.

debug_std_streams_output_group

--@rules_rust//cargo/settings:debug_std_streams_output_group

A flag which adds a streams output group to cargo_build_script targets that contain the raw stderr and stdout streams from the build script.

emit_build_script_warnings

--@rules_rust//cargo/settings:emit_build_script_warnings

A flag which controls whether cargo_build_script warnings (cargo::warning=) are printed to stderr.

Supported values:

  • on: emit warnings for every cargo_build_script target, overriding any per-target emit_warnings = False.
  • auto (default): respect the per-target emit_warnings attribute. crate_universe-generated targets set it to False, so registry/git crates stay quiet (matching Cargo); first-party targets emit by default.
  • off: silence warnings build-wide.

--@rules_rust//cargo/settings:experimental_symlink_execroot

A flag for which causes cargo_build_script to symlink the execroot of the action to the CARGO_MANIFEST_DIR where the scripts are run.

out_dir_volatile_file_basenames

--@rules_rust//cargo/settings:out_dir_volatile_file_basenames

A flag which determines what file basenames are removed from OUT_DIR by cargo_build_script actions to make the _bs.out_dir TreeArtifact deterministic.

Files whose names appear in this list, as well as files with a .d or .pc extension, are deleted from OUT_DIR after the build script runs and before Bazel captures the directory. Files like config.log and Makefile embed the Bazel sandbox path, so their content changes on every action invocation, causing cache misses for all downstream rustc compilations.

use_default_shell_env

--@rules_rust//cargo/settings:use_default_shell_env

A flag which controls the global default of ctx.actions.run.use_default_shell_env for cargo_build_script targets.