Squashed 'third_party/rules_rust/' content from commit bf59038ca
git-subtree-dir: third_party/rules_rust
git-subtree-split: bf59038cac11798cbaef9f3bf965bad8182b97fa
Signed-off-by: Brian Silverman <bsilver16384@gmail.com>
Change-Id: I5a20e403203d670df467ea97dde9a4ac40339a8d
diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/BUILD.bazel
diff --git a/tools/allowlists/function_transition_allowlist/BUILD.bazel b/tools/allowlists/function_transition_allowlist/BUILD.bazel
new file mode 100644
index 0000000..9fdee4b
--- /dev/null
+++ b/tools/allowlists/function_transition_allowlist/BUILD.bazel
@@ -0,0 +1,4 @@
+package_group(
+ name = "function_transition_allowlist",
+ packages = ["//..."],
+)
diff --git a/tools/clippy/BUILD.bazel b/tools/clippy/BUILD.bazel
new file mode 100644
index 0000000..09e246f
--- /dev/null
+++ b/tools/clippy/BUILD.bazel
@@ -0,0 +1 @@
+exports_files(["clippy.toml"])
diff --git a/tools/clippy/clippy.toml b/tools/clippy/clippy.toml
new file mode 100644
index 0000000..7a4b169
--- /dev/null
+++ b/tools/clippy/clippy.toml
@@ -0,0 +1 @@
+# clippy options: https://rust-lang.github.io/rust-clippy/
diff --git a/tools/runfiles/BUILD.bazel b/tools/runfiles/BUILD.bazel
new file mode 100644
index 0000000..7a2eceb
--- /dev/null
+++ b/tools/runfiles/BUILD.bazel
@@ -0,0 +1,23 @@
+load(
+ "//rust:defs.bzl",
+ "rust_doc_test",
+ "rust_library",
+ "rust_test",
+)
+
+rust_library(
+ name = "runfiles",
+ srcs = ["runfiles.rs"],
+ visibility = ["//visibility:public"],
+)
+
+rust_test(
+ name = "runfiles_test",
+ crate = ":runfiles",
+ data = ["data/sample.txt"],
+)
+
+rust_doc_test(
+ name = "runfiles_doc_test",
+ crate = ":runfiles",
+)
diff --git a/tools/runfiles/data/sample.txt b/tools/runfiles/data/sample.txt
new file mode 100644
index 0000000..398ec97
--- /dev/null
+++ b/tools/runfiles/data/sample.txt
@@ -0,0 +1 @@
+Example Text!
\ No newline at end of file
diff --git a/tools/runfiles/runfiles.rs b/tools/runfiles/runfiles.rs
new file mode 100644
index 0000000..04f3366
--- /dev/null
+++ b/tools/runfiles/runfiles.rs
@@ -0,0 +1,250 @@
+//! Runfiles lookup library for Bazel-built Rust binaries and tests.
+//!
+//! USAGE:
+//!
+//! 1. Depend on this runfiles library from your build rule:
+//! ```python
+//! rust_binary(
+//! name = "my_binary",
+//! ...
+//! data = ["//path/to/my/data.txt"],
+//! deps = ["@rules_rust//tools/runfiles"],
+//! )
+//! ```
+//!
+//! 2. Import the runfiles library.
+//! ```ignore
+//! extern crate runfiles;
+//!
+//! use runfiles::Runfiles;
+//! ```
+//!
+//! 3. Create a Runfiles object and use rlocation to look up runfile paths:
+//! ```ignore -- This doesn't work under rust_doc_test because argv[0] is not what we expect.
+//!
+//! use runfiles::Runfiles;
+//!
+//! let r = Runfiles::create().unwrap();
+//! let path = r.rlocation("my_workspace/path/to/my/data.txt");
+//!
+//! let f = File::open(path).unwrap();
+//! // ...
+//! ```
+
+use std::collections::HashMap;
+use std::env;
+use std::ffi::OsString;
+use std::fs;
+use std::io;
+use std::path::Path;
+use std::path::PathBuf;
+
+#[derive(Debug)]
+enum Mode {
+ DirectoryBased(PathBuf),
+ ManifestBased(HashMap<PathBuf, PathBuf>),
+}
+
+#[derive(Debug)]
+pub struct Runfiles {
+ mode: Mode,
+}
+
+impl Runfiles {
+ /// Creates a manifest based Runfiles object when
+ /// RUNFILES_MANIFEST_ONLY environment variable is present,
+ /// or a directory based Runfiles object otherwise.
+ pub fn create() -> io::Result<Self> {
+ if is_manifest_only() {
+ Self::create_manifest_based()
+ } else {
+ Self::create_directory_based()
+ }
+ }
+
+ fn create_directory_based() -> io::Result<Self> {
+ Ok(Runfiles {
+ mode: Mode::DirectoryBased(find_runfiles_dir()?),
+ })
+ }
+
+ fn create_manifest_based() -> io::Result<Self> {
+ let manifest_path = find_manifest_path()?;
+ let manifest_content = std::fs::read_to_string(manifest_path)?;
+ let path_mapping = manifest_content
+ .lines()
+ .map(|line| {
+ let pair = line
+ .split_once(' ')
+ .expect("manifest file contained unexpected content");
+ (pair.0.into(), pair.1.into())
+ })
+ .collect::<HashMap<_, _>>();
+ Ok(Runfiles {
+ mode: Mode::ManifestBased(path_mapping),
+ })
+ }
+
+ /// Returns the runtime path of a runfile.
+ ///
+ /// Runfiles are data-dependencies of Bazel-built binaries and tests.
+ /// The returned path may not be valid. The caller should check the path's
+ /// validity and that the path exists.
+ pub fn rlocation(&self, path: impl AsRef<Path>) -> PathBuf {
+ let path = path.as_ref();
+ if path.is_absolute() {
+ return path.to_path_buf();
+ }
+ match &self.mode {
+ Mode::DirectoryBased(runfiles_dir) => runfiles_dir.join(path),
+ Mode::ManifestBased(path_mapping) => path_mapping
+ .get(path)
+ .unwrap_or_else(|| {
+ panic!("Path {} not found among runfiles.", path.to_string_lossy())
+ })
+ .clone(),
+ }
+ }
+}
+
+/// Returns the .runfiles directory for the currently executing binary.
+pub fn find_runfiles_dir() -> io::Result<PathBuf> {
+ assert_ne!(
+ std::env::var_os("RUNFILES_MANIFEST_ONLY").unwrap_or_else(|| OsString::from("0")),
+ "1"
+ );
+
+ // If bazel told us about the runfiles dir, use that without looking further.
+ if let Some(test_srcdir) = std::env::var_os("TEST_SRCDIR").map(PathBuf::from) {
+ if test_srcdir.is_dir() {
+ return Ok(test_srcdir);
+ }
+ }
+
+ // Consume the first argument (argv[0])
+ let exec_path = std::env::args().next().expect("arg 0 was not set");
+
+ let mut binary_path = PathBuf::from(&exec_path);
+ loop {
+ // Check for our neighboring $binary.runfiles directory.
+ let mut runfiles_name = binary_path.file_name().unwrap().to_owned();
+ runfiles_name.push(".runfiles");
+
+ let runfiles_path = binary_path.with_file_name(&runfiles_name);
+ if runfiles_path.is_dir() {
+ return Ok(runfiles_path);
+ }
+
+ // Check if we're already under a *.runfiles directory.
+ {
+ // TODO: 1.28 adds Path::ancestors() which is a little simpler.
+ let mut next = binary_path.parent();
+ while let Some(ancestor) = next {
+ if ancestor
+ .file_name()
+ .map_or(false, |f| f.to_string_lossy().ends_with(".runfiles"))
+ {
+ return Ok(ancestor.to_path_buf());
+ }
+ next = ancestor.parent();
+ }
+ }
+
+ if !fs::symlink_metadata(&binary_path)?.file_type().is_symlink() {
+ break;
+ }
+ // Follow symlinks and keep looking.
+ let link_target = binary_path.read_link()?;
+ binary_path = if link_target.is_absolute() {
+ link_target
+ } else {
+ let link_dir = binary_path.parent().unwrap();
+ env::current_dir()?.join(link_dir).join(link_target)
+ }
+ }
+
+ Err(make_io_error("failed to find .runfiles directory"))
+}
+
+fn make_io_error(msg: &str) -> io::Error {
+ io::Error::new(io::ErrorKind::Other, msg)
+}
+
+fn is_manifest_only() -> bool {
+ match std::env::var("RUNFILES_MANIFEST_ONLY") {
+ Ok(val) => val == "1",
+ Err(_) => false,
+ }
+}
+
+fn find_manifest_path() -> io::Result<PathBuf> {
+ assert_eq!(
+ std::env::var_os("RUNFILES_MANIFEST_ONLY").expect("RUNFILES_MANIFEST_ONLY was not set"),
+ OsString::from("1")
+ );
+ match std::env::var_os("RUNFILES_MANIFEST_FILE") {
+ Some(path) => Ok(path.into()),
+ None => Err(
+ make_io_error(
+ "RUNFILES_MANIFEST_ONLY was set to '1', but RUNFILES_MANIFEST_FILE was not set. Did Bazel change?"))
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ use std::fs::File;
+ use std::io::prelude::*;
+
+ #[test]
+ fn test_can_read_data_from_runfiles() {
+ // We want to run two test cases: one with the $TEST_SRCDIR environment variable set and one
+ // with it not set. Since environment variables are global state, we need to ensure the two
+ // test cases do not run concurrently. Rust runs tests in parallel and does not provide an
+ // easy way to synchronise them, so we run both test cases in the same #[test] function.
+
+ let test_srcdir = env::var_os("TEST_SRCDIR").expect("bazel did not provide TEST_SRCDIR");
+
+ // Test case 1: $TEST_SRCDIR is set.
+ {
+ let r = Runfiles::create().unwrap();
+
+ let mut f =
+ File::open(r.rlocation("rules_rust/tools/runfiles/data/sample.txt")).unwrap();
+
+ let mut buffer = String::new();
+ f.read_to_string(&mut buffer).unwrap();
+
+ assert_eq!("Example Text!", buffer);
+ }
+
+ // Test case 2: $TEST_SRCDIR is *not* set.
+ {
+ env::remove_var("TEST_SRCDIR");
+
+ let r = Runfiles::create().unwrap();
+
+ let mut f =
+ File::open(r.rlocation("rules_rust/tools/runfiles/data/sample.txt")).unwrap();
+
+ let mut buffer = String::new();
+ f.read_to_string(&mut buffer).unwrap();
+
+ assert_eq!("Example Text!", buffer);
+
+ env::set_var("TEST_SRCDIR", test_srcdir);
+ }
+ }
+
+ #[test]
+ fn test_manifest_based_can_read_data_from_runfiles() {
+ let mut path_mapping = HashMap::new();
+ path_mapping.insert("a/b".into(), "c/d".into());
+ let r = Runfiles {
+ mode: Mode::ManifestBased(path_mapping),
+ };
+
+ assert_eq!(r.rlocation("a/b"), PathBuf::from("c/d"));
+ }
+}
diff --git a/tools/rust_analyzer/BUILD.bazel b/tools/rust_analyzer/BUILD.bazel
new file mode 100644
index 0000000..d73ea63
--- /dev/null
+++ b/tools/rust_analyzer/BUILD.bazel
@@ -0,0 +1,56 @@
+load("//rust:defs.bzl", "rust_binary", "rust_clippy", "rust_library", "rust_test")
+load("//tools:tool_utils.bzl", "aspect_repository")
+
+rust_binary(
+ name = "gen_rust_project",
+ srcs = ["main.rs"],
+ edition = "2018",
+ rustc_env = {
+ "ASPECT_REPOSITORY": aspect_repository(),
+ },
+ visibility = ["//visibility:public"],
+ deps = [
+ ":gen_rust_project_lib",
+ "//tools/rust_analyzer/raze:anyhow",
+ "//tools/rust_analyzer/raze:env_logger",
+ "//tools/rust_analyzer/raze:log",
+ "//tools/rust_analyzer/raze:structopt",
+ "//util/label",
+ ],
+)
+
+rust_library(
+ name = "gen_rust_project_lib",
+ srcs = glob(
+ ["**/*.rs"],
+ exclude = ["main.rs"],
+ ),
+ data = [
+ "//rust/private:rust_analyzer_detect_sysroot",
+ ],
+ edition = "2018",
+ deps = [
+ "//tools/runfiles",
+ "//tools/rust_analyzer/raze:anyhow",
+ "//tools/rust_analyzer/raze:log",
+ "//tools/rust_analyzer/raze:serde",
+ "//tools/rust_analyzer/raze:serde_json",
+ ],
+)
+
+rust_test(
+ name = "gen_rust_project_lib_test",
+ crate = ":gen_rust_project_lib",
+ deps = [
+ "//tools/rust_analyzer/raze:itertools",
+ ],
+)
+
+rust_clippy(
+ name = "gen_rust_project_clippy",
+ testonly = True,
+ visibility = ["//visibility:private"],
+ deps = [
+ ":gen_rust_project",
+ ],
+)
diff --git a/tools/rust_analyzer/aquery.rs b/tools/rust_analyzer/aquery.rs
new file mode 100644
index 0000000..12164ab
--- /dev/null
+++ b/tools/rust_analyzer/aquery.rs
@@ -0,0 +1,590 @@
+use std::collections::{BTreeMap, BTreeSet};
+use std::fs::File;
+use std::option::Option;
+use std::path::Path;
+use std::path::PathBuf;
+use std::process::Command;
+
+use anyhow::Context;
+use serde::Deserialize;
+
+#[derive(Debug, Deserialize)]
+struct AqueryOutput {
+ artifacts: Vec<Artifact>,
+ actions: Vec<Action>,
+ #[serde(rename = "pathFragments")]
+ path_fragments: Vec<PathFragment>,
+}
+
+#[derive(Debug, Deserialize)]
+struct Artifact {
+ id: u32,
+ #[serde(rename = "pathFragmentId")]
+ path_fragment_id: u32,
+}
+
+#[derive(Debug, Deserialize)]
+struct PathFragment {
+ id: u32,
+ label: String,
+ #[serde(rename = "parentId")]
+ parent_id: Option<u32>,
+}
+
+#[derive(Debug, Deserialize)]
+struct Action {
+ #[serde(rename = "outputIds")]
+ output_ids: Vec<u32>,
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct CrateSpec {
+ pub crate_id: String,
+ pub display_name: String,
+ pub edition: String,
+ pub root_module: String,
+ pub is_workspace_member: bool,
+ pub deps: BTreeSet<String>,
+ pub proc_macro_dylib_path: Option<String>,
+ pub source: Option<CrateSpecSource>,
+ pub cfg: Vec<String>,
+ pub env: BTreeMap<String, String>,
+ pub target: String,
+ pub crate_type: String,
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct CrateSpecSource {
+ pub exclude_dirs: Vec<String>,
+ pub include_dirs: Vec<String>,
+}
+
+pub fn get_crate_specs(
+ bazel: &Path,
+ workspace: &Path,
+ execution_root: &Path,
+ targets: &[String],
+ rules_rust_name: &str,
+) -> anyhow::Result<BTreeSet<CrateSpec>> {
+ log::debug!("Get crate specs with targets: {:?}", targets);
+ let target_pattern = targets
+ .iter()
+ .map(|t| format!("deps({})", t))
+ .collect::<Vec<_>>()
+ .join("+");
+
+ let aquery_output = Command::new(bazel)
+ .current_dir(workspace)
+ .arg("aquery")
+ .arg("--include_aspects")
+ .arg(format!(
+ "--aspects={}//rust:defs.bzl%rust_analyzer_aspect",
+ rules_rust_name
+ ))
+ .arg("--output_groups=rust_analyzer_crate_spec")
+ .arg(format!(
+ r#"outputs(".*[.]rust_analyzer_crate_spec",{})"#,
+ target_pattern
+ ))
+ .arg("--output=jsonproto")
+ .output()?;
+
+ let crate_spec_files =
+ parse_aquery_output_files(execution_root, &String::from_utf8(aquery_output.stdout)?)?;
+
+ let crate_specs = crate_spec_files
+ .into_iter()
+ .map(|file| {
+ let f = File::open(&file)
+ .with_context(|| format!("Failed to open file: {}", file.display()))?;
+ serde_json::from_reader(f)
+ .with_context(|| format!("Failed to deserialize file: {}", file.display()))
+ })
+ .collect::<anyhow::Result<Vec<CrateSpec>>>()?;
+
+ consolidate_crate_specs(crate_specs)
+}
+
+fn parse_aquery_output_files(
+ execution_root: &Path,
+ aquery_stdout: &str,
+) -> anyhow::Result<Vec<PathBuf>> {
+ let out: AqueryOutput = serde_json::from_str(aquery_stdout)?;
+
+ let artifacts = out
+ .artifacts
+ .iter()
+ .map(|a| (a.id, a))
+ .collect::<BTreeMap<_, _>>();
+ let path_fragments = out
+ .path_fragments
+ .iter()
+ .map(|pf| (pf.id, pf))
+ .collect::<BTreeMap<_, _>>();
+
+ let mut output_files: Vec<PathBuf> = Vec::new();
+ for action in out.actions {
+ for output_id in action.output_ids {
+ let artifact = artifacts
+ .get(&output_id)
+ .expect("internal consistency error in bazel output");
+ let path = path_from_fragments(artifact.path_fragment_id, &path_fragments)?;
+ let path = execution_root.join(path);
+ if path.exists() {
+ output_files.push(path);
+ } else {
+ log::warn!("Skipping missing crate_spec file: {:?}", path);
+ }
+ }
+ }
+
+ Ok(output_files)
+}
+
+fn path_from_fragments(
+ id: u32,
+ fragments: &BTreeMap<u32, &PathFragment>,
+) -> anyhow::Result<PathBuf> {
+ let path_fragment = fragments
+ .get(&id)
+ .expect("internal consistency error in bazel output");
+
+ let buf = match path_fragment.parent_id {
+ Some(parent_id) => path_from_fragments(parent_id, fragments)?
+ .join(PathBuf::from(&path_fragment.label.clone())),
+ None => PathBuf::from(&path_fragment.label.clone()),
+ };
+
+ Ok(buf)
+}
+
+/// Read all crate specs, deduplicating crates with the same ID. This happens when
+/// a rust_test depends on a rust_library, for example.
+fn consolidate_crate_specs(crate_specs: Vec<CrateSpec>) -> anyhow::Result<BTreeSet<CrateSpec>> {
+ let mut consolidated_specs: BTreeMap<String, CrateSpec> = BTreeMap::new();
+ for spec in crate_specs.into_iter() {
+ log::debug!("{:?}", spec);
+ if let Some(existing) = consolidated_specs.get_mut(&spec.crate_id) {
+ existing.deps.extend(spec.deps);
+
+ // display_name should match the library's crate name because Rust Analyzer
+ // seems to use display_name for matching crate entries in rust-project.json
+ // against symbols in source files. For more details, see
+ // https://github.com/bazelbuild/rules_rust/issues/1032
+ if spec.crate_type == "rlib" {
+ existing.display_name = spec.display_name;
+ existing.crate_type = "rlib".into();
+ }
+
+ // For proc-macro crates that exist within the workspace, there will be a
+ // generated crate-spec in both the fastbuild and opt-exec configuration.
+ // Prefer proc macro paths with an opt-exec component in the path.
+ if let Some(dylib_path) = spec.proc_macro_dylib_path.as_ref() {
+ const OPT_PATH_COMPONENT: &str = "-opt-exec-";
+ if dylib_path.contains(OPT_PATH_COMPONENT) {
+ existing.proc_macro_dylib_path.replace(dylib_path.clone());
+ }
+ }
+ } else {
+ consolidated_specs.insert(spec.crate_id.clone(), spec);
+ }
+ }
+
+ Ok(consolidated_specs.into_values().collect())
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+ use itertools::Itertools;
+
+ #[test]
+ fn consolidate_lib_then_test_specs() {
+ let crate_specs = vec![
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-lib_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-extra_test_dep.rs".into(),
+ display_name: "extra_test_dep".into(),
+ edition: "2018".into(),
+ root_module: "extra_test_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-lib_dep.rs".into(),
+ display_name: "lib_dep".into(),
+ edition: "2018".into(),
+ root_module: "lib_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib_test".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-extra_test_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "bin".into(),
+ },
+ ];
+
+ assert_eq!(
+ consolidate_crate_specs(crate_specs).unwrap(),
+ BTreeSet::from([
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-lib_dep.rs".into(), "ID-extra_test_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-extra_test_dep.rs".into(),
+ display_name: "extra_test_dep".into(),
+ edition: "2018".into(),
+ root_module: "extra_test_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-lib_dep.rs".into(),
+ display_name: "lib_dep".into(),
+ edition: "2018".into(),
+ root_module: "lib_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ ])
+ );
+ }
+
+ #[test]
+ fn consolidate_test_then_lib_specs() {
+ let crate_specs = vec![
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib_test".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-extra_test_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "bin".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-lib_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-extra_test_dep.rs".into(),
+ display_name: "extra_test_dep".into(),
+ edition: "2018".into(),
+ root_module: "extra_test_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-lib_dep.rs".into(),
+ display_name: "lib_dep".into(),
+ edition: "2018".into(),
+ root_module: "lib_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ ];
+
+ assert_eq!(
+ consolidate_crate_specs(crate_specs).unwrap(),
+ BTreeSet::from([
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-lib_dep.rs".into(), "ID-extra_test_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-extra_test_dep.rs".into(),
+ display_name: "extra_test_dep".into(),
+ edition: "2018".into(),
+ root_module: "extra_test_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-lib_dep.rs".into(),
+ display_name: "lib_dep".into(),
+ edition: "2018".into(),
+ root_module: "lib_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ ])
+ );
+ }
+
+ #[test]
+ fn consolidate_lib_test_main_specs() {
+ // mylib.rs is a library but has tests and an entry point, and mylib2.rs
+ // depends on mylib.rs. The display_name of the library target mylib.rs
+ // should be "mylib" no matter what order the crate specs is in.
+ // Otherwise Rust Analyzer will not be able to resolve references to
+ // mylib in mylib2.rs.
+ let crate_specs = vec![
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib_test".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "bin".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib_main".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "bin".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-mylib2.rs".into(),
+ display_name: "mylib2".into(),
+ edition: "2018".into(),
+ root_module: "mylib2.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-mylib.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ ];
+
+ for perm in crate_specs.into_iter().permutations(4) {
+ assert_eq!(
+ consolidate_crate_specs(perm).unwrap(),
+ BTreeSet::from([
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from([]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-mylib2.rs".into(),
+ display_name: "mylib2".into(),
+ edition: "2018".into(),
+ root_module: "mylib2.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-mylib.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ ])
+ );
+ }
+ }
+
+ #[test]
+ fn consolidate_proc_macro_prefer_exec() {
+ // proc macro crates should prefer the -opt-exec- path which is always generated
+ // during builds where it is used, while the fastbuild version would only be built
+ // when explicitly building that target.
+ let crate_specs = vec![
+ CrateSpec {
+ crate_id: "ID-myproc_macro.rs".into(),
+ display_name: "myproc_macro".into(),
+ edition: "2018".into(),
+ root_module: "myproc_macro.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: Some(
+ "bazel-out/k8-opt-exec-F005BA11/bin/myproc_macro/libmyproc_macro-12345.so"
+ .into(),
+ ),
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "proc_macro".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-myproc_macro.rs".into(),
+ display_name: "myproc_macro".into(),
+ edition: "2018".into(),
+ root_module: "myproc_macro.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: Some(
+ "bazel-out/k8-fastbuild/bin/myproc_macro/libmyproc_macro-12345.so".into(),
+ ),
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "proc_macro".into(),
+ },
+ ];
+
+ for perm in crate_specs.into_iter().permutations(2) {
+ assert_eq!(
+ consolidate_crate_specs(perm).unwrap(),
+ BTreeSet::from([CrateSpec {
+ crate_id: "ID-myproc_macro.rs".into(),
+ display_name: "myproc_macro".into(),
+ edition: "2018".into(),
+ root_module: "myproc_macro.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: Some(
+ "bazel-out/k8-opt-exec-F005BA11/bin/myproc_macro/libmyproc_macro-12345.so"
+ .into()
+ ),
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "proc_macro".into(),
+ },])
+ );
+ }
+ }
+}
diff --git a/tools/rust_analyzer/deps.bzl b/tools/rust_analyzer/deps.bzl
new file mode 100644
index 0000000..0d2b4a5
--- /dev/null
+++ b/tools/rust_analyzer/deps.bzl
@@ -0,0 +1,11 @@
+"""
+The dependencies for running the gen_rust_project binary.
+"""
+
+load("//tools/rust_analyzer/raze:crates.bzl", "rules_rust_tools_rust_analyzer_fetch_remote_crates")
+
+def rust_analyzer_deps():
+ rules_rust_tools_rust_analyzer_fetch_remote_crates()
+
+# For legacy support
+gen_rust_project_dependencies = rust_analyzer_deps
diff --git a/tools/rust_analyzer/lib.rs b/tools/rust_analyzer/lib.rs
new file mode 100644
index 0000000..68db7e0
--- /dev/null
+++ b/tools/rust_analyzer/lib.rs
@@ -0,0 +1,79 @@
+use std::path::Path;
+use std::process::Command;
+
+use anyhow::anyhow;
+use runfiles::Runfiles;
+
+mod aquery;
+mod rust_project;
+
+const SYSROOT_SRC_FILE_RUNFILES_PREFIX: &str = "rules_rust";
+
+pub fn generate_crate_info(
+ bazel: impl AsRef<Path>,
+ workspace: impl AsRef<Path>,
+ rules_rust: impl AsRef<str>,
+ targets: &[String],
+) -> anyhow::Result<()> {
+ log::debug!("Building rust_analyzer_crate_spec files for {:?}", targets);
+
+ let output = Command::new(bazel.as_ref())
+ .current_dir(workspace.as_ref())
+ .arg("build")
+ .arg(format!(
+ "--aspects={}//rust:defs.bzl%rust_analyzer_aspect",
+ rules_rust.as_ref()
+ ))
+ .arg("--output_groups=rust_analyzer_crate_spec")
+ .args(targets)
+ .output()?;
+
+ if !output.status.success() {
+ return Err(anyhow!(
+ "bazel build failed:({})\n{}",
+ output.status,
+ String::from_utf8_lossy(&output.stderr)
+ ));
+ }
+
+ Ok(())
+}
+
+pub fn write_rust_project(
+ bazel: impl AsRef<Path>,
+ workspace: impl AsRef<Path>,
+ rules_rust_name: &impl AsRef<str>,
+ targets: &[String],
+ execution_root: impl AsRef<Path>,
+ rust_project_path: impl AsRef<Path>,
+) -> anyhow::Result<()> {
+ let crate_specs = aquery::get_crate_specs(
+ bazel.as_ref(),
+ workspace.as_ref(),
+ execution_root.as_ref(),
+ targets,
+ rules_rust_name.as_ref(),
+ )?;
+
+ let workspace_name = match rules_rust_name.as_ref().trim_start_matches('@') {
+ "" => SYSROOT_SRC_FILE_RUNFILES_PREFIX,
+ s => s,
+ };
+ let sysroot_path = format!(
+ "{}/rust/private/rust_analyzer_detect_sysroot.rust_analyzer_sysroot_src",
+ workspace_name
+ );
+ let r = Runfiles::create()?;
+ let path = r.rlocation(sysroot_path);
+ let sysroot_src = std::fs::read_to_string(&path)?;
+
+ let rust_project = rust_project::generate_rust_project(&sysroot_src, &crate_specs)?;
+
+ rust_project::write_rust_project(
+ rust_project_path.as_ref(),
+ execution_root.as_ref(),
+ &rust_project,
+ )?;
+
+ Ok(())
+}
diff --git a/tools/rust_analyzer/main.rs b/tools/rust_analyzer/main.rs
new file mode 100644
index 0000000..2bad0e9
--- /dev/null
+++ b/tools/rust_analyzer/main.rs
@@ -0,0 +1,120 @@
+use std::collections::HashMap;
+use std::env;
+use std::path::PathBuf;
+use std::process::Command;
+
+use anyhow::anyhow;
+use gen_rust_project_lib::generate_crate_info;
+use gen_rust_project_lib::write_rust_project;
+use structopt::StructOpt;
+
+// TODO(david): This shells out to an expected rule in the workspace root //:rust_analyzer that the user must define.
+// It would be more convenient if it could automatically discover all the rust code in the workspace if this target
+// does not exist.
+fn main() -> anyhow::Result<()> {
+ env_logger::init();
+
+ let config = parse_config()?;
+
+ let workspace_root = config
+ .workspace
+ .as_ref()
+ .expect("failed to find workspace root, set with --workspace");
+
+ let execution_root = config
+ .execution_root
+ .as_ref()
+ .expect("failed to find execution root, is --execution-root set correctly?");
+
+ let rules_rust_name = env!("ASPECT_REPOSITORY");
+
+ // Generate the crate specs.
+ generate_crate_info(
+ &config.bazel,
+ &workspace_root,
+ &rules_rust_name,
+ &config.targets,
+ )?;
+
+ // Use the generated files to write rust-project.json.
+ write_rust_project(
+ &config.bazel,
+ &workspace_root,
+ &rules_rust_name,
+ &config.targets,
+ &execution_root,
+ &workspace_root.join("rust-project.json"),
+ )?;
+
+ Ok(())
+}
+
+// Parse the configuration flags and supplement with bazel info as needed.
+fn parse_config() -> anyhow::Result<Config> {
+ let mut config = Config::from_args();
+
+ // Ensure we know the workspace. If we are under `bazel run`, the
+ // BUILD_WORKSPACE_DIR environment variable will be present.
+ if config.workspace.is_none() {
+ if let Some(ws_dir) = env::var_os("BUILD_WORKSPACE_DIRECTORY") {
+ config.workspace = Some(PathBuf::from(ws_dir));
+ }
+ }
+
+ if config.workspace.is_some() && config.execution_root.is_some() {
+ return Ok(config);
+ }
+
+ // We need some info from `bazel info`. Fetch it now.
+ let mut bazel_info_command = Command::new(&config.bazel);
+ bazel_info_command.arg("info");
+ if let Some(workspace) = &config.workspace {
+ bazel_info_command.current_dir(workspace);
+ }
+
+ // Execute bazel info.
+ let output = bazel_info_command.output()?;
+ if !output.status.success() {
+ return Err(anyhow!(
+ "Failed to run `bazel info` ({:?}): {}",
+ output.status,
+ String::from_utf8_lossy(&output.stderr)
+ ));
+ }
+
+ // Extract the output.
+ let output = String::from_utf8_lossy(output.stdout.as_slice());
+ let bazel_info = output
+ .trim()
+ .split('\n')
+ .map(|line| line.split_at(line.find(':').expect("missing `:` in bazel info output")))
+ .map(|(k, v)| (k, (&v[1..]).trim()))
+ .collect::<HashMap<_, _>>();
+
+ if config.workspace.is_none() {
+ config.workspace = bazel_info.get("workspace").map(Into::into);
+ }
+ if config.execution_root.is_none() {
+ config.execution_root = bazel_info.get("execution_root").map(Into::into);
+ }
+
+ Ok(config)
+}
+
+#[derive(Debug, StructOpt)]
+struct Config {
+ // If not specified, uses the result of `bazel info workspace`.
+ #[structopt(long)]
+ workspace: Option<PathBuf>,
+
+ // If not specified, uses the result of `bazel info execution_root`.
+ #[structopt(long)]
+ execution_root: Option<PathBuf>,
+
+ #[structopt(long, default_value = "bazel")]
+ bazel: PathBuf,
+
+ // Space separated list of target patterns that comes after all other args.
+ #[structopt(default_value = "@//...")]
+ targets: Vec<String>,
+}
diff --git a/tools/rust_analyzer/raze/BUILD.bazel b/tools/rust_analyzer/raze/BUILD.bazel
new file mode 100644
index 0000000..a494da4
--- /dev/null
+++ b/tools/rust_analyzer/raze/BUILD.bazel
@@ -0,0 +1,84 @@
+"""
+@generated
+cargo-raze generated Bazel file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+package(default_visibility = ["//visibility:public"])
+
+licenses([
+ "notice", # See individual crates for specific licenses
+])
+
+# Aliased targets
+alias(
+ name = "anyhow",
+ actual = "@rules_rust_tools_rust_analyzer__anyhow__1_0_45//:anyhow",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "env_logger",
+ actual = "@rules_rust_tools_rust_analyzer__env_logger__0_9_0//:env_logger",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "itertools",
+ actual = "@rules_rust_tools_rust_analyzer__itertools__0_10_1//:itertools",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "log",
+ actual = "@rules_rust_tools_rust_analyzer__log__0_4_14//:log",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "serde",
+ actual = "@rules_rust_tools_rust_analyzer__serde__1_0_130//:serde",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "serde_json",
+ actual = "@rules_rust_tools_rust_analyzer__serde_json__1_0_69//:serde_json",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "structopt",
+ actual = "@rules_rust_tools_rust_analyzer__structopt__0_3_25//:structopt",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+# Export file for Stardoc support
+exports_files(
+ [
+ "crates.bzl",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/tools/rust_analyzer/raze/Cargo.raze.lock b/tools/rust_analyzer/raze/Cargo.raze.lock
new file mode 100644
index 0000000..d78e906
--- /dev/null
+++ b/tools/rust_analyzer/raze/Cargo.raze.lock
@@ -0,0 +1,377 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "aho-corasick"
+version = "0.7.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "ansi_term"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7"
+
+[[package]]
+name = "atty"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
+dependencies = [
+ "hermit-abi",
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "clap"
+version = "2.33.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
+dependencies = [
+ "ansi_term",
+ "atty",
+ "bitflags",
+ "strsim",
+ "textwrap",
+ "unicode-width",
+ "vec_map",
+]
+
+[[package]]
+name = "compile_with_bazel"
+version = "0.0.0"
+dependencies = [
+ "anyhow",
+ "env_logger",
+ "itertools",
+ "log",
+ "serde",
+ "serde_json",
+ "structopt",
+]
+
+[[package]]
+name = "either"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
+
+[[package]]
+name = "env_logger"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
+dependencies = [
+ "atty",
+ "humantime",
+ "log",
+ "regex",
+ "termcolor",
+]
+
+[[package]]
+name = "heck"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
+dependencies = [
+ "unicode-segmentation",
+]
+
+[[package]]
+name = "hermit-abi"
+version = "0.1.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "humantime"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
+
+[[package]]
+name = "itertools"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "itoa"
+version = "0.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
+[[package]]
+name = "libc"
+version = "0.2.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
+
+[[package]]
+name = "log"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "memchr"
+version = "2.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
+
+[[package]]
+name = "proc-macro-error"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+dependencies = [
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
+dependencies = [
+ "unicode-xid",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "regex"
+version = "1.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.6.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
+
+[[package]]
+name = "ryu"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
+
+[[package]]
+name = "serde"
+version = "1.0.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "strsim"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
+
+[[package]]
+name = "structopt"
+version = "0.3.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c"
+dependencies = [
+ "clap",
+ "lazy_static",
+ "structopt-derive",
+]
+
+[[package]]
+name = "structopt-derive"
+version = "0.4.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
+dependencies = [
+ "heck",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "syn"
+version = "1.0.81"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-xid",
+]
+
+[[package]]
+name = "termcolor"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "textwrap"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
+dependencies = [
+ "unicode-width",
+]
+
+[[package]]
+name = "unicode-segmentation"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
+
+[[package]]
+name = "unicode-width"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
+
+[[package]]
+name = "unicode-xid"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
+
+[[package]]
+name = "vec_map"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
+
+[[package]]
+name = "version_check"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-util"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/tools/rust_analyzer/raze/Cargo.toml b/tools/rust_analyzer/raze/Cargo.toml
new file mode 100644
index 0000000..4a9b0ee
--- /dev/null
+++ b/tools/rust_analyzer/raze/Cargo.toml
@@ -0,0 +1,26 @@
+[package]
+name = "compile_with_bazel"
+version = "0.0.0"
+edition="2018"
+
+[lib]
+path = "fake_lib.rs"
+
+[dependencies]
+anyhow = "1.0"
+log = "0.4"
+env_logger = "0.9"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
+structopt = "0.3"
+
+[dev-dependencies]
+itertools = "0.10"
+
+[package.metadata.raze]
+genmode = "Remote"
+workspace_path = "//tools/rust_analyzer/raze"
+gen_workspace_prefix = "rules_rust_tools_rust_analyzer"
+rust_rules_workspace_name = "rules_rust"
+package_aliases_dir = "."
+default_gen_buildrs = true
diff --git a/tools/rust_analyzer/raze/crates.bzl b/tools/rust_analyzer/raze/crates.bzl
new file mode 100644
index 0000000..336972e
--- /dev/null
+++ b/tools/rust_analyzer/raze/crates.bzl
@@ -0,0 +1,442 @@
+"""
+@generated
+cargo-raze generated Bazel file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") # buildifier: disable=load
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # buildifier: disable=load
+load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") # buildifier: disable=load
+
+def rules_rust_tools_rust_analyzer_fetch_remote_crates():
+ """This function defines a collection of repos and should be called in a WORKSPACE file"""
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__aho_corasick__0_7_18",
+ url = "https://crates.io/api/v1/crates/aho-corasick/0.7.18/download",
+ type = "tar.gz",
+ sha256 = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f",
+ strip_prefix = "aho-corasick-0.7.18",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.aho-corasick-0.7.18.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__ansi_term__0_11_0",
+ url = "https://crates.io/api/v1/crates/ansi_term/0.11.0/download",
+ type = "tar.gz",
+ sha256 = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b",
+ strip_prefix = "ansi_term-0.11.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.ansi_term-0.11.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__anyhow__1_0_45",
+ url = "https://crates.io/api/v1/crates/anyhow/1.0.45/download",
+ type = "tar.gz",
+ sha256 = "ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7",
+ strip_prefix = "anyhow-1.0.45",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.anyhow-1.0.45.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__atty__0_2_14",
+ url = "https://crates.io/api/v1/crates/atty/0.2.14/download",
+ type = "tar.gz",
+ sha256 = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8",
+ strip_prefix = "atty-0.2.14",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.atty-0.2.14.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__bitflags__1_3_2",
+ url = "https://crates.io/api/v1/crates/bitflags/1.3.2/download",
+ type = "tar.gz",
+ sha256 = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a",
+ strip_prefix = "bitflags-1.3.2",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.bitflags-1.3.2.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__cfg_if__1_0_0",
+ url = "https://crates.io/api/v1/crates/cfg-if/1.0.0/download",
+ type = "tar.gz",
+ sha256 = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd",
+ strip_prefix = "cfg-if-1.0.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.cfg-if-1.0.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__clap__2_33_3",
+ url = "https://crates.io/api/v1/crates/clap/2.33.3/download",
+ type = "tar.gz",
+ sha256 = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002",
+ strip_prefix = "clap-2.33.3",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.clap-2.33.3.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__either__1_6_1",
+ url = "https://crates.io/api/v1/crates/either/1.6.1/download",
+ type = "tar.gz",
+ sha256 = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457",
+ strip_prefix = "either-1.6.1",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.either-1.6.1.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__env_logger__0_9_0",
+ url = "https://crates.io/api/v1/crates/env_logger/0.9.0/download",
+ type = "tar.gz",
+ sha256 = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3",
+ strip_prefix = "env_logger-0.9.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.env_logger-0.9.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__heck__0_3_3",
+ url = "https://crates.io/api/v1/crates/heck/0.3.3/download",
+ type = "tar.gz",
+ sha256 = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c",
+ strip_prefix = "heck-0.3.3",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.heck-0.3.3.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__hermit_abi__0_1_19",
+ url = "https://crates.io/api/v1/crates/hermit-abi/0.1.19/download",
+ type = "tar.gz",
+ sha256 = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33",
+ strip_prefix = "hermit-abi-0.1.19",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.hermit-abi-0.1.19.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__humantime__2_1_0",
+ url = "https://crates.io/api/v1/crates/humantime/2.1.0/download",
+ type = "tar.gz",
+ sha256 = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4",
+ strip_prefix = "humantime-2.1.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.humantime-2.1.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__itertools__0_10_1",
+ url = "https://crates.io/api/v1/crates/itertools/0.10.1/download",
+ type = "tar.gz",
+ sha256 = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf",
+ strip_prefix = "itertools-0.10.1",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.itertools-0.10.1.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__itoa__0_4_8",
+ url = "https://crates.io/api/v1/crates/itoa/0.4.8/download",
+ type = "tar.gz",
+ sha256 = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4",
+ strip_prefix = "itoa-0.4.8",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.itoa-0.4.8.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__lazy_static__1_4_0",
+ url = "https://crates.io/api/v1/crates/lazy_static/1.4.0/download",
+ type = "tar.gz",
+ sha256 = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646",
+ strip_prefix = "lazy_static-1.4.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.lazy_static-1.4.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__libc__0_2_107",
+ url = "https://crates.io/api/v1/crates/libc/0.2.107/download",
+ type = "tar.gz",
+ sha256 = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219",
+ strip_prefix = "libc-0.2.107",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.libc-0.2.107.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__log__0_4_14",
+ url = "https://crates.io/api/v1/crates/log/0.4.14/download",
+ type = "tar.gz",
+ sha256 = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710",
+ strip_prefix = "log-0.4.14",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.log-0.4.14.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__memchr__2_4_1",
+ url = "https://crates.io/api/v1/crates/memchr/2.4.1/download",
+ type = "tar.gz",
+ sha256 = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a",
+ strip_prefix = "memchr-2.4.1",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.memchr-2.4.1.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__proc_macro_error__1_0_4",
+ url = "https://crates.io/api/v1/crates/proc-macro-error/1.0.4/download",
+ type = "tar.gz",
+ sha256 = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c",
+ strip_prefix = "proc-macro-error-1.0.4",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.proc-macro-error-1.0.4.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__proc_macro_error_attr__1_0_4",
+ url = "https://crates.io/api/v1/crates/proc-macro-error-attr/1.0.4/download",
+ type = "tar.gz",
+ sha256 = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869",
+ strip_prefix = "proc-macro-error-attr-1.0.4",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.proc-macro-error-attr-1.0.4.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__proc_macro2__1_0_32",
+ url = "https://crates.io/api/v1/crates/proc-macro2/1.0.32/download",
+ type = "tar.gz",
+ sha256 = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43",
+ strip_prefix = "proc-macro2-1.0.32",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.proc-macro2-1.0.32.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__quote__1_0_10",
+ url = "https://crates.io/api/v1/crates/quote/1.0.10/download",
+ type = "tar.gz",
+ sha256 = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05",
+ strip_prefix = "quote-1.0.10",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.quote-1.0.10.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__regex__1_5_4",
+ url = "https://crates.io/api/v1/crates/regex/1.5.4/download",
+ type = "tar.gz",
+ sha256 = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461",
+ strip_prefix = "regex-1.5.4",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.regex-1.5.4.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__regex_syntax__0_6_25",
+ url = "https://crates.io/api/v1/crates/regex-syntax/0.6.25/download",
+ type = "tar.gz",
+ sha256 = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b",
+ strip_prefix = "regex-syntax-0.6.25",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.regex-syntax-0.6.25.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__ryu__1_0_5",
+ url = "https://crates.io/api/v1/crates/ryu/1.0.5/download",
+ type = "tar.gz",
+ sha256 = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e",
+ strip_prefix = "ryu-1.0.5",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.ryu-1.0.5.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__serde__1_0_130",
+ url = "https://crates.io/api/v1/crates/serde/1.0.130/download",
+ type = "tar.gz",
+ sha256 = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913",
+ strip_prefix = "serde-1.0.130",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.serde-1.0.130.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__serde_derive__1_0_130",
+ url = "https://crates.io/api/v1/crates/serde_derive/1.0.130/download",
+ type = "tar.gz",
+ sha256 = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b",
+ strip_prefix = "serde_derive-1.0.130",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.serde_derive-1.0.130.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__serde_json__1_0_69",
+ url = "https://crates.io/api/v1/crates/serde_json/1.0.69/download",
+ type = "tar.gz",
+ sha256 = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8",
+ strip_prefix = "serde_json-1.0.69",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.serde_json-1.0.69.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__strsim__0_8_0",
+ url = "https://crates.io/api/v1/crates/strsim/0.8.0/download",
+ type = "tar.gz",
+ sha256 = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a",
+ strip_prefix = "strsim-0.8.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.strsim-0.8.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__structopt__0_3_25",
+ url = "https://crates.io/api/v1/crates/structopt/0.3.25/download",
+ type = "tar.gz",
+ sha256 = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c",
+ strip_prefix = "structopt-0.3.25",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.structopt-0.3.25.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__structopt_derive__0_4_18",
+ url = "https://crates.io/api/v1/crates/structopt-derive/0.4.18/download",
+ type = "tar.gz",
+ sha256 = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0",
+ strip_prefix = "structopt-derive-0.4.18",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.structopt-derive-0.4.18.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__syn__1_0_81",
+ url = "https://crates.io/api/v1/crates/syn/1.0.81/download",
+ type = "tar.gz",
+ sha256 = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966",
+ strip_prefix = "syn-1.0.81",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.syn-1.0.81.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__termcolor__1_1_2",
+ url = "https://crates.io/api/v1/crates/termcolor/1.1.2/download",
+ type = "tar.gz",
+ sha256 = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4",
+ strip_prefix = "termcolor-1.1.2",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.termcolor-1.1.2.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__textwrap__0_11_0",
+ url = "https://crates.io/api/v1/crates/textwrap/0.11.0/download",
+ type = "tar.gz",
+ sha256 = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060",
+ strip_prefix = "textwrap-0.11.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.textwrap-0.11.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__unicode_segmentation__1_8_0",
+ url = "https://crates.io/api/v1/crates/unicode-segmentation/1.8.0/download",
+ type = "tar.gz",
+ sha256 = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b",
+ strip_prefix = "unicode-segmentation-1.8.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.unicode-segmentation-1.8.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__unicode_width__0_1_9",
+ url = "https://crates.io/api/v1/crates/unicode-width/0.1.9/download",
+ type = "tar.gz",
+ sha256 = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973",
+ strip_prefix = "unicode-width-0.1.9",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.unicode-width-0.1.9.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__unicode_xid__0_2_2",
+ url = "https://crates.io/api/v1/crates/unicode-xid/0.2.2/download",
+ type = "tar.gz",
+ sha256 = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3",
+ strip_prefix = "unicode-xid-0.2.2",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.unicode-xid-0.2.2.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__vec_map__0_8_2",
+ url = "https://crates.io/api/v1/crates/vec_map/0.8.2/download",
+ type = "tar.gz",
+ sha256 = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191",
+ strip_prefix = "vec_map-0.8.2",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.vec_map-0.8.2.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__version_check__0_9_3",
+ url = "https://crates.io/api/v1/crates/version_check/0.9.3/download",
+ type = "tar.gz",
+ sha256 = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe",
+ strip_prefix = "version_check-0.9.3",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.version_check-0.9.3.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__winapi__0_3_9",
+ url = "https://crates.io/api/v1/crates/winapi/0.3.9/download",
+ type = "tar.gz",
+ sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419",
+ strip_prefix = "winapi-0.3.9",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.winapi-0.3.9.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__winapi_i686_pc_windows_gnu__0_4_0",
+ url = "https://crates.io/api/v1/crates/winapi-i686-pc-windows-gnu/0.4.0/download",
+ type = "tar.gz",
+ sha256 = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6",
+ strip_prefix = "winapi-i686-pc-windows-gnu-0.4.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__winapi_util__0_1_5",
+ url = "https://crates.io/api/v1/crates/winapi-util/0.1.5/download",
+ type = "tar.gz",
+ sha256 = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178",
+ strip_prefix = "winapi-util-0.1.5",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.winapi-util-0.1.5.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__winapi_x86_64_pc_windows_gnu__0_4_0",
+ url = "https://crates.io/api/v1/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download",
+ type = "tar.gz",
+ sha256 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f",
+ strip_prefix = "winapi-x86_64-pc-windows-gnu-0.4.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel"),
+ )
diff --git a/tools/rust_analyzer/raze/remote/BUILD.aho-corasick-0.7.18.bazel b/tools/rust_analyzer/raze/remote/BUILD.aho-corasick-0.7.18.bazel
new file mode 100644
index 0000000..d0d1788
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.aho-corasick-0.7.18.bazel
@@ -0,0 +1,56 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "unencumbered", # Unlicense from expression "Unlicense OR MIT"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "aho_corasick",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.7.18",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__memchr__2_4_1//:memchr",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.ansi_term-0.11.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.ansi_term-0.11.0.bazel
new file mode 100644
index 0000000..e742b36
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.ansi_term-0.11.0.bazel
@@ -0,0 +1,66 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT"
+])
+
+# Generated Targets
+
+# Unsupported target "colours" with type "example" omitted
+
+rust_library(
+ name = "ansi_term",
+ srcs = glob(["**/*.rs"]),
+ aliases = {
+ },
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.11.0",
+ # buildifier: leave-alone
+ deps = [
+ ] + selects.with_or({
+ # cfg(target_os = "windows")
+ (
+ "@rules_rust//rust/platform:i686-pc-windows-msvc",
+ "@rules_rust//rust/platform:x86_64-pc-windows-msvc",
+ ): [
+ "@rules_rust_tools_rust_analyzer__winapi__0_3_9//:winapi",
+ ],
+ "//conditions:default": [],
+ }),
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.anyhow-1.0.45.bazel b/tools/rust_analyzer/raze/remote/BUILD.anyhow-1.0.45.bazel
new file mode 100644
index 0000000..737d7df
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.anyhow-1.0.45.bazel
@@ -0,0 +1,113 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "anyhow_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.45",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "anyhow",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.45",
+ # buildifier: leave-alone
+ deps = [
+ ":anyhow_build_script",
+ ],
+)
+
+# Unsupported target "compiletest" with type "test" omitted
+
+# Unsupported target "test_autotrait" with type "test" omitted
+
+# Unsupported target "test_backtrace" with type "test" omitted
+
+# Unsupported target "test_boxed" with type "test" omitted
+
+# Unsupported target "test_chain" with type "test" omitted
+
+# Unsupported target "test_context" with type "test" omitted
+
+# Unsupported target "test_convert" with type "test" omitted
+
+# Unsupported target "test_downcast" with type "test" omitted
+
+# Unsupported target "test_ffi" with type "test" omitted
+
+# Unsupported target "test_fmt" with type "test" omitted
+
+# Unsupported target "test_macros" with type "test" omitted
+
+# Unsupported target "test_repr" with type "test" omitted
+
+# Unsupported target "test_source" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.atty-0.2.14.bazel b/tools/rust_analyzer/raze/remote/BUILD.atty-0.2.14.bazel
new file mode 100644
index 0000000..c8b5efa
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.atty-0.2.14.bazel
@@ -0,0 +1,89 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT"
+])
+
+# Generated Targets
+
+# Unsupported target "atty" with type "example" omitted
+
+rust_library(
+ name = "atty",
+ srcs = glob(["**/*.rs"]),
+ aliases = {
+ },
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.2.14",
+ # buildifier: leave-alone
+ deps = [
+ ] + selects.with_or({
+ # cfg(unix)
+ (
+ "@rules_rust//rust/platform:i686-apple-darwin",
+ "@rules_rust//rust/platform:i686-unknown-linux-gnu",
+ "@rules_rust//rust/platform:x86_64-apple-darwin",
+ "@rules_rust//rust/platform:x86_64-unknown-linux-gnu",
+ "@rules_rust//rust/platform:aarch64-apple-darwin",
+ "@rules_rust//rust/platform:aarch64-apple-ios",
+ "@rules_rust//rust/platform:aarch64-linux-android",
+ "@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
+ "@rules_rust//rust/platform:arm-unknown-linux-gnueabi",
+ "@rules_rust//rust/platform:i686-linux-android",
+ "@rules_rust//rust/platform:i686-unknown-freebsd",
+ "@rules_rust//rust/platform:powerpc-unknown-linux-gnu",
+ "@rules_rust//rust/platform:s390x-unknown-linux-gnu",
+ "@rules_rust//rust/platform:x86_64-apple-ios",
+ "@rules_rust//rust/platform:x86_64-linux-android",
+ "@rules_rust//rust/platform:x86_64-unknown-freebsd",
+ ): [
+ "@rules_rust_tools_rust_analyzer__libc__0_2_107//:libc",
+ ],
+ "//conditions:default": [],
+ }) + selects.with_or({
+ # cfg(windows)
+ (
+ "@rules_rust//rust/platform:i686-pc-windows-msvc",
+ "@rules_rust//rust/platform:x86_64-pc-windows-msvc",
+ ): [
+ "@rules_rust_tools_rust_analyzer__winapi__0_3_9//:winapi",
+ ],
+ "//conditions:default": [],
+ }),
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.bazel b/tools/rust_analyzer/raze/remote/BUILD.bazel
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.bazel
diff --git a/tools/rust_analyzer/raze/remote/BUILD.bitflags-1.3.2.bazel b/tools/rust_analyzer/raze/remote/BUILD.bitflags-1.3.2.bazel
new file mode 100644
index 0000000..417aee7
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.bitflags-1.3.2.bazel
@@ -0,0 +1,58 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "bitflags",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.3.2",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
+
+# Unsupported target "basic" with type "test" omitted
+
+# Unsupported target "compile" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.cfg-if-1.0.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.cfg-if-1.0.0.bazel
new file mode 100644
index 0000000..84595a6
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.cfg-if-1.0.0.bazel
@@ -0,0 +1,55 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "cfg_if",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.0",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
+
+# Unsupported target "xcrate" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.clap-2.33.3.bazel b/tools/rust_analyzer/raze/remote/BUILD.clap-2.33.3.bazel
new file mode 100644
index 0000000..0ecdf7a
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.clap-2.33.3.bazel
@@ -0,0 +1,93 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "clap",
+ srcs = glob(["**/*.rs"]),
+ aliases = {
+ },
+ crate_features = [
+ "ansi_term",
+ "atty",
+ "color",
+ "default",
+ "strsim",
+ "suggestions",
+ "vec_map",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "2.33.3",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__atty__0_2_14//:atty",
+ "@rules_rust_tools_rust_analyzer__bitflags__1_3_2//:bitflags",
+ "@rules_rust_tools_rust_analyzer__strsim__0_8_0//:strsim",
+ "@rules_rust_tools_rust_analyzer__textwrap__0_11_0//:textwrap",
+ "@rules_rust_tools_rust_analyzer__unicode_width__0_1_9//:unicode_width",
+ "@rules_rust_tools_rust_analyzer__vec_map__0_8_2//:vec_map",
+ ] + selects.with_or({
+ # cfg(not(windows))
+ (
+ "@rules_rust//rust/platform:i686-apple-darwin",
+ "@rules_rust//rust/platform:i686-unknown-linux-gnu",
+ "@rules_rust//rust/platform:x86_64-apple-darwin",
+ "@rules_rust//rust/platform:x86_64-unknown-linux-gnu",
+ "@rules_rust//rust/platform:aarch64-apple-darwin",
+ "@rules_rust//rust/platform:aarch64-apple-ios",
+ "@rules_rust//rust/platform:aarch64-linux-android",
+ "@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
+ "@rules_rust//rust/platform:arm-unknown-linux-gnueabi",
+ "@rules_rust//rust/platform:i686-linux-android",
+ "@rules_rust//rust/platform:i686-unknown-freebsd",
+ "@rules_rust//rust/platform:powerpc-unknown-linux-gnu",
+ "@rules_rust//rust/platform:s390x-unknown-linux-gnu",
+ "@rules_rust//rust/platform:wasm32-unknown-unknown",
+ "@rules_rust//rust/platform:wasm32-wasi",
+ "@rules_rust//rust/platform:x86_64-apple-ios",
+ "@rules_rust//rust/platform:x86_64-linux-android",
+ "@rules_rust//rust/platform:x86_64-unknown-freebsd",
+ ): [
+ "@rules_rust_tools_rust_analyzer__ansi_term__0_11_0//:ansi_term",
+ ],
+ "//conditions:default": [],
+ }),
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.either-1.6.1.bazel b/tools/rust_analyzer/raze/remote/BUILD.either-1.6.1.bazel
new file mode 100644
index 0000000..0af0135
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.either-1.6.1.bazel
@@ -0,0 +1,53 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "either",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.6.1",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.env_logger-0.9.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.env_logger-0.9.0.bazel
new file mode 100644
index 0000000..4d35482
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.env_logger-0.9.0.bazel
@@ -0,0 +1,71 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "env_logger",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "atty",
+ "default",
+ "humantime",
+ "regex",
+ "termcolor",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.9.0",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__atty__0_2_14//:atty",
+ "@rules_rust_tools_rust_analyzer__humantime__2_1_0//:humantime",
+ "@rules_rust_tools_rust_analyzer__log__0_4_14//:log",
+ "@rules_rust_tools_rust_analyzer__regex__1_5_4//:regex",
+ "@rules_rust_tools_rust_analyzer__termcolor__1_1_2//:termcolor",
+ ],
+)
+
+# Unsupported target "init-twice-retains-filter" with type "test" omitted
+
+# Unsupported target "log-in-log" with type "test" omitted
+
+# Unsupported target "log_tls_dtors" with type "test" omitted
+
+# Unsupported target "regexp_filter" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.heck-0.3.3.bazel b/tools/rust_analyzer/raze/remote/BUILD.heck-0.3.3.bazel
new file mode 100644
index 0000000..7aac083
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.heck-0.3.3.bazel
@@ -0,0 +1,54 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "heck",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.3.3",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__unicode_segmentation__1_8_0//:unicode_segmentation",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.hermit-abi-0.1.19.bazel b/tools/rust_analyzer/raze/remote/BUILD.hermit-abi-0.1.19.bazel
new file mode 100644
index 0000000..99cba1b
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.hermit-abi-0.1.19.bazel
@@ -0,0 +1,55 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "hermit_abi",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.1.19",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__libc__0_2_107//:libc",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.humantime-2.1.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.humantime-2.1.0.bazel
new file mode 100644
index 0000000..9905a0d
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.humantime-2.1.0.bazel
@@ -0,0 +1,57 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "datetime_format" with type "bench" omitted
+
+# Unsupported target "datetime_parse" with type "bench" omitted
+
+rust_library(
+ name = "humantime",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "2.1.0",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.itertools-0.10.1.bazel b/tools/rust_analyzer/raze/remote/BUILD.itertools-0.10.1.bazel
new file mode 100644
index 0000000..20935bf
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.itertools-0.10.1.bazel
@@ -0,0 +1,99 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "bench1" with type "bench" omitted
+
+# Unsupported target "combinations" with type "bench" omitted
+
+# Unsupported target "combinations_with_replacement" with type "bench" omitted
+
+# Unsupported target "fold_specialization" with type "bench" omitted
+
+# Unsupported target "powerset" with type "bench" omitted
+
+# Unsupported target "tree_fold1" with type "bench" omitted
+
+# Unsupported target "tuple_combinations" with type "bench" omitted
+
+# Unsupported target "tuples" with type "bench" omitted
+
+# Unsupported target "iris" with type "example" omitted
+
+rust_library(
+ name = "itertools",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "use_alloc",
+ "use_std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.10.1",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__either__1_6_1//:either",
+ ],
+)
+
+# Unsupported target "adaptors_no_collect" with type "test" omitted
+
+# Unsupported target "flatten_ok" with type "test" omitted
+
+# Unsupported target "fold_specialization" with type "test" omitted
+
+# Unsupported target "macros_hygiene" with type "test" omitted
+
+# Unsupported target "merge_join" with type "test" omitted
+
+# Unsupported target "peeking_take_while" with type "test" omitted
+
+# Unsupported target "quick" with type "test" omitted
+
+# Unsupported target "specializations" with type "test" omitted
+
+# Unsupported target "test_core" with type "test" omitted
+
+# Unsupported target "test_std" with type "test" omitted
+
+# Unsupported target "tuples" with type "test" omitted
+
+# Unsupported target "zip" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.itoa-0.4.8.bazel b/tools/rust_analyzer/raze/remote/BUILD.itoa-0.4.8.bazel
new file mode 100644
index 0000000..27868c7
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.itoa-0.4.8.bazel
@@ -0,0 +1,57 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "bench" with type "bench" omitted
+
+rust_library(
+ name = "itoa",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.8",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
+
+# Unsupported target "test" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.lazy_static-1.4.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.lazy_static-1.4.0.bazel
new file mode 100644
index 0000000..ba88ed7
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.lazy_static-1.4.0.bazel
@@ -0,0 +1,57 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "lazy_static",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.4.0",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
+
+# Unsupported target "no_std" with type "test" omitted
+
+# Unsupported target "test" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.libc-0.2.107.bazel b/tools/rust_analyzer/raze/remote/BUILD.libc-0.2.107.bazel
new file mode 100644
index 0000000..bfb4b82
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.libc-0.2.107.bazel
@@ -0,0 +1,85 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "libc_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.2.107",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "libc",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.2.107",
+ # buildifier: leave-alone
+ deps = [
+ ":libc_build_script",
+ ],
+)
+
+# Unsupported target "const_fn" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.log-0.4.14.bazel b/tools/rust_analyzer/raze/remote/BUILD.log-0.4.14.bazel
new file mode 100644
index 0000000..79cad4d
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.log-0.4.14.bazel
@@ -0,0 +1,92 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "log_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "std",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.14",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+# Unsupported target "value" with type "bench" omitted
+
+rust_library(
+ name = "log",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.14",
+ # buildifier: leave-alone
+ deps = [
+ ":log_build_script",
+ "@rules_rust_tools_rust_analyzer__cfg_if__1_0_0//:cfg_if",
+ ],
+)
+
+# Unsupported target "filters" with type "test" omitted
+
+# Unsupported target "macros" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.memchr-2.4.1.bazel b/tools/rust_analyzer/raze/remote/BUILD.memchr-2.4.1.bazel
new file mode 100644
index 0000000..2016ce4
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.memchr-2.4.1.bazel
@@ -0,0 +1,87 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "unencumbered", # Unlicense from expression "Unlicense OR MIT"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "memchr_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "2.4.1",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "memchr",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "2.4.1",
+ # buildifier: leave-alone
+ deps = [
+ ":memchr_build_script",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-1.0.4.bazel b/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-1.0.4.bazel
new file mode 100644
index 0000000..c6c622c
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-1.0.4.bazel
@@ -0,0 +1,102 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "proc_macro_error_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ "syn",
+ "syn-error",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.4",
+ visibility = ["//visibility:private"],
+ deps = [
+ "@rules_rust_tools_rust_analyzer__version_check__0_9_3//:version_check",
+ ],
+)
+
+rust_library(
+ name = "proc_macro_error",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "syn",
+ "syn-error",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ proc_macro_deps = [
+ "@rules_rust_tools_rust_analyzer__proc_macro_error_attr__1_0_4//:proc_macro_error_attr",
+ ],
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.4",
+ # buildifier: leave-alone
+ deps = [
+ ":proc_macro_error_build_script",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
+ "@rules_rust_tools_rust_analyzer__syn__1_0_81//:syn",
+ ],
+)
+
+# Unsupported target "macro-errors" with type "test" omitted
+
+# Unsupported target "ok" with type "test" omitted
+
+# Unsupported target "runtime-errors" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-attr-1.0.4.bazel b/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-attr-1.0.4.bazel
new file mode 100644
index 0000000..ba807a8
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-attr-1.0.4.bazel
@@ -0,0 +1,86 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "proc_macro_error_attr_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.4",
+ visibility = ["//visibility:private"],
+ deps = [
+ "@rules_rust_tools_rust_analyzer__version_check__0_9_3//:version_check",
+ ],
+)
+
+rust_proc_macro(
+ name = "proc_macro_error_attr",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.4",
+ # buildifier: leave-alone
+ deps = [
+ ":proc_macro_error_attr_build_script",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.proc-macro2-1.0.32.bazel b/tools/rust_analyzer/raze/remote/BUILD.proc-macro2-1.0.32.bazel
new file mode 100644
index 0000000..9252841
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.proc-macro2-1.0.32.bazel
@@ -0,0 +1,98 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "proc_macro2_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ "proc-macro",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.32",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "proc_macro2",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "proc-macro",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.32",
+ # buildifier: leave-alone
+ deps = [
+ ":proc_macro2_build_script",
+ "@rules_rust_tools_rust_analyzer__unicode_xid__0_2_2//:unicode_xid",
+ ],
+)
+
+# Unsupported target "comments" with type "test" omitted
+
+# Unsupported target "features" with type "test" omitted
+
+# Unsupported target "marker" with type "test" omitted
+
+# Unsupported target "test" with type "test" omitted
+
+# Unsupported target "test_fmt" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.quote-1.0.10.bazel b/tools/rust_analyzer/raze/remote/BUILD.quote-1.0.10.bazel
new file mode 100644
index 0000000..77f5236
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.quote-1.0.10.bazel
@@ -0,0 +1,62 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "bench" with type "bench" omitted
+
+rust_library(
+ name = "quote",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "proc-macro",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.10",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ ],
+)
+
+# Unsupported target "compiletest" with type "test" omitted
+
+# Unsupported target "test" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.regex-1.5.4.bazel b/tools/rust_analyzer/raze/remote/BUILD.regex-1.5.4.bazel
new file mode 100644
index 0000000..8ba41a8
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.regex-1.5.4.bazel
@@ -0,0 +1,94 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "shootout-regex-dna" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-bytes" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-cheat" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-replace" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-single" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-single-cheat" with type "example" omitted
+
+rust_library(
+ name = "regex",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "aho-corasick",
+ "memchr",
+ "perf",
+ "perf-cache",
+ "perf-dfa",
+ "perf-inline",
+ "perf-literal",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.5.4",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__aho_corasick__0_7_18//:aho_corasick",
+ "@rules_rust_tools_rust_analyzer__memchr__2_4_1//:memchr",
+ "@rules_rust_tools_rust_analyzer__regex_syntax__0_6_25//:regex_syntax",
+ ],
+)
+
+# Unsupported target "backtrack" with type "test" omitted
+
+# Unsupported target "backtrack-bytes" with type "test" omitted
+
+# Unsupported target "backtrack-utf8bytes" with type "test" omitted
+
+# Unsupported target "crates-regex" with type "test" omitted
+
+# Unsupported target "default" with type "test" omitted
+
+# Unsupported target "default-bytes" with type "test" omitted
+
+# Unsupported target "nfa" with type "test" omitted
+
+# Unsupported target "nfa-bytes" with type "test" omitted
+
+# Unsupported target "nfa-utf8bytes" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.regex-syntax-0.6.25.bazel b/tools/rust_analyzer/raze/remote/BUILD.regex-syntax-0.6.25.bazel
new file mode 100644
index 0000000..d4e0b56
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.regex-syntax-0.6.25.bazel
@@ -0,0 +1,55 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "bench" with type "bench" omitted
+
+rust_library(
+ name = "regex_syntax",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.6.25",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.ryu-1.0.5.bazel b/tools/rust_analyzer/raze/remote/BUILD.ryu-1.0.5.bazel
new file mode 100644
index 0000000..d4df380
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.ryu-1.0.5.bazel
@@ -0,0 +1,101 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # Apache-2.0 from expression "Apache-2.0 OR BSL-1.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "ryu_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.5",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+# Unsupported target "bench" with type "bench" omitted
+
+# Unsupported target "upstream_benchmark" with type "example" omitted
+
+rust_library(
+ name = "ryu",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.5",
+ # buildifier: leave-alone
+ deps = [
+ ":ryu_build_script",
+ ],
+)
+
+# Unsupported target "common_test" with type "test" omitted
+
+# Unsupported target "d2s_table_test" with type "test" omitted
+
+# Unsupported target "d2s_test" with type "test" omitted
+
+# Unsupported target "exhaustive" with type "test" omitted
+
+# Unsupported target "f2s_test" with type "test" omitted
+
+# Unsupported target "s2d_test" with type "test" omitted
+
+# Unsupported target "s2f_test" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.serde-1.0.130.bazel b/tools/rust_analyzer/raze/remote/BUILD.serde-1.0.130.bazel
new file mode 100644
index 0000000..7b5cb8c
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.serde-1.0.130.bazel
@@ -0,0 +1,94 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "serde_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ "derive",
+ "serde_derive",
+ "std",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.130",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "serde",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "derive",
+ "serde_derive",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ proc_macro_deps = [
+ "@rules_rust_tools_rust_analyzer__serde_derive__1_0_130//:serde_derive",
+ ],
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.130",
+ # buildifier: leave-alone
+ deps = [
+ ":serde_build_script",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.serde_derive-1.0.130.bazel b/tools/rust_analyzer/raze/remote/BUILD.serde_derive-1.0.130.bazel
new file mode 100644
index 0000000..2d84e1d
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.serde_derive-1.0.130.bazel
@@ -0,0 +1,88 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "serde_derive_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.130",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_proc_macro(
+ name = "serde_derive",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.130",
+ # buildifier: leave-alone
+ deps = [
+ ":serde_derive_build_script",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
+ "@rules_rust_tools_rust_analyzer__syn__1_0_81//:syn",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.serde_json-1.0.69.bazel b/tools/rust_analyzer/raze/remote/BUILD.serde_json-1.0.69.bazel
new file mode 100644
index 0000000..2f4105f
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.serde_json-1.0.69.bazel
@@ -0,0 +1,90 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "serde_json_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.69",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "serde_json",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.69",
+ # buildifier: leave-alone
+ deps = [
+ ":serde_json_build_script",
+ "@rules_rust_tools_rust_analyzer__itoa__0_4_8//:itoa",
+ "@rules_rust_tools_rust_analyzer__ryu__1_0_5//:ryu",
+ "@rules_rust_tools_rust_analyzer__serde__1_0_130//:serde",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.strsim-0.8.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.strsim-0.8.0.bazel
new file mode 100644
index 0000000..a4df21a
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.strsim-0.8.0.bazel
@@ -0,0 +1,57 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT"
+])
+
+# Generated Targets
+
+# Unsupported target "benches" with type "bench" omitted
+
+rust_library(
+ name = "strsim",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.8.0",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
+
+# Unsupported target "lib" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.structopt-0.3.25.bazel b/tools/rust_analyzer/raze/remote/BUILD.structopt-0.3.25.bazel
new file mode 100644
index 0000000..24b86f7
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.structopt-0.3.25.bazel
@@ -0,0 +1,155 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT"
+])
+
+# Generated Targets
+
+# Unsupported target "after_help" with type "example" omitted
+
+# Unsupported target "at_least_two" with type "example" omitted
+
+# Unsupported target "basic" with type "example" omitted
+
+# Unsupported target "deny_missing_docs" with type "example" omitted
+
+# Unsupported target "doc_comments" with type "example" omitted
+
+# Unsupported target "enum_in_args" with type "example" omitted
+
+# Unsupported target "enum_in_args_with_strum" with type "example" omitted
+
+# Unsupported target "enum_tuple" with type "example" omitted
+
+# Unsupported target "env" with type "example" omitted
+
+# Unsupported target "example" with type "example" omitted
+
+# Unsupported target "flatten" with type "example" omitted
+
+# Unsupported target "gen_completions" with type "example" omitted
+
+# Unsupported target "git" with type "example" omitted
+
+# Unsupported target "group" with type "example" omitted
+
+# Unsupported target "keyvalue" with type "example" omitted
+
+# Unsupported target "negative_flag" with type "example" omitted
+
+# Unsupported target "no_version" with type "example" omitted
+
+# Unsupported target "rename_all" with type "example" omitted
+
+# Unsupported target "required_if" with type "example" omitted
+
+# Unsupported target "skip" with type "example" omitted
+
+# Unsupported target "subcommand_aliases" with type "example" omitted
+
+# Unsupported target "true_or_false" with type "example" omitted
+
+rust_library(
+ name = "structopt",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ proc_macro_deps = [
+ "@rules_rust_tools_rust_analyzer__structopt_derive__0_4_18//:structopt_derive",
+ ],
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.3.25",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__clap__2_33_3//:clap",
+ "@rules_rust_tools_rust_analyzer__lazy_static__1_4_0//:lazy_static",
+ ],
+)
+
+# Unsupported target "argument_naming" with type "test" omitted
+
+# Unsupported target "arguments" with type "test" omitted
+
+# Unsupported target "author_version_about" with type "test" omitted
+
+# Unsupported target "custom-string-parsers" with type "test" omitted
+
+# Unsupported target "default_value" with type "test" omitted
+
+# Unsupported target "deny-warnings" with type "test" omitted
+
+# Unsupported target "doc-comments-help" with type "test" omitted
+
+# Unsupported target "explicit_name_no_renaming" with type "test" omitted
+
+# Unsupported target "flags" with type "test" omitted
+
+# Unsupported target "flatten" with type "test" omitted
+
+# Unsupported target "generics" with type "test" omitted
+
+# Unsupported target "issues" with type "test" omitted
+
+# Unsupported target "macro-errors" with type "test" omitted
+
+# Unsupported target "nested-subcommands" with type "test" omitted
+
+# Unsupported target "non_literal_attributes" with type "test" omitted
+
+# Unsupported target "options" with type "test" omitted
+
+# Unsupported target "privacy" with type "test" omitted
+
+# Unsupported target "raw_bool_literal" with type "test" omitted
+
+# Unsupported target "raw_idents" with type "test" omitted
+
+# Unsupported target "regressions" with type "test" omitted
+
+# Unsupported target "rename_all_env" with type "test" omitted
+
+# Unsupported target "skip" with type "test" omitted
+
+# Unsupported target "special_types" with type "test" omitted
+
+# Unsupported target "subcommands" with type "test" omitted
+
+# Unsupported target "utils" with type "test" omitted
+
+# Unsupported target "we_need_syn_full" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.structopt-derive-0.4.18.bazel b/tools/rust_analyzer/raze/remote/BUILD.structopt-derive-0.4.18.bazel
new file mode 100644
index 0000000..8c8dfd8
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.structopt-derive-0.4.18.bazel
@@ -0,0 +1,58 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT"
+])
+
+# Generated Targets
+
+rust_proc_macro(
+ name = "structopt_derive",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.18",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__heck__0_3_3//:heck",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__proc_macro_error__1_0_4//:proc_macro_error",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
+ "@rules_rust_tools_rust_analyzer__syn__1_0_81//:syn",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.syn-1.0.81.bazel b/tools/rust_analyzer/raze/remote/BUILD.syn-1.0.81.bazel
new file mode 100644
index 0000000..efd5cfe
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.syn-1.0.81.bazel
@@ -0,0 +1,158 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "syn_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "clone-impls",
+ "default",
+ "derive",
+ "full",
+ "parsing",
+ "printing",
+ "proc-macro",
+ "quote",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.81",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+# Unsupported target "file" with type "bench" omitted
+
+# Unsupported target "rust" with type "bench" omitted
+
+rust_library(
+ name = "syn",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "clone-impls",
+ "default",
+ "derive",
+ "full",
+ "parsing",
+ "printing",
+ "proc-macro",
+ "quote",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.81",
+ # buildifier: leave-alone
+ deps = [
+ ":syn_build_script",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
+ "@rules_rust_tools_rust_analyzer__unicode_xid__0_2_2//:unicode_xid",
+ ],
+)
+
+# Unsupported target "test_asyncness" with type "test" omitted
+
+# Unsupported target "test_attribute" with type "test" omitted
+
+# Unsupported target "test_derive_input" with type "test" omitted
+
+# Unsupported target "test_expr" with type "test" omitted
+
+# Unsupported target "test_generics" with type "test" omitted
+
+# Unsupported target "test_grouping" with type "test" omitted
+
+# Unsupported target "test_ident" with type "test" omitted
+
+# Unsupported target "test_item" with type "test" omitted
+
+# Unsupported target "test_iterators" with type "test" omitted
+
+# Unsupported target "test_lit" with type "test" omitted
+
+# Unsupported target "test_meta" with type "test" omitted
+
+# Unsupported target "test_parse_buffer" with type "test" omitted
+
+# Unsupported target "test_parse_stream" with type "test" omitted
+
+# Unsupported target "test_pat" with type "test" omitted
+
+# Unsupported target "test_path" with type "test" omitted
+
+# Unsupported target "test_precedence" with type "test" omitted
+
+# Unsupported target "test_receiver" with type "test" omitted
+
+# Unsupported target "test_round_trip" with type "test" omitted
+
+# Unsupported target "test_shebang" with type "test" omitted
+
+# Unsupported target "test_should_parse" with type "test" omitted
+
+# Unsupported target "test_size" with type "test" omitted
+
+# Unsupported target "test_stmt" with type "test" omitted
+
+# Unsupported target "test_token_trees" with type "test" omitted
+
+# Unsupported target "test_ty" with type "test" omitted
+
+# Unsupported target "test_visibility" with type "test" omitted
+
+# Unsupported target "zzz_stable" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.termcolor-1.1.2.bazel b/tools/rust_analyzer/raze/remote/BUILD.termcolor-1.1.2.bazel
new file mode 100644
index 0000000..7605e0c
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.termcolor-1.1.2.bazel
@@ -0,0 +1,64 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "unencumbered", # Unlicense from expression "Unlicense OR MIT"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "termcolor",
+ srcs = glob(["**/*.rs"]),
+ aliases = {
+ },
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.1.2",
+ # buildifier: leave-alone
+ deps = [
+ ] + selects.with_or({
+ # cfg(windows)
+ (
+ "@rules_rust//rust/platform:i686-pc-windows-msvc",
+ "@rules_rust//rust/platform:x86_64-pc-windows-msvc",
+ ): [
+ "@rules_rust_tools_rust_analyzer__winapi_util__0_1_5//:winapi_util",
+ ],
+ "//conditions:default": [],
+ }),
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.textwrap-0.11.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.textwrap-0.11.0.bazel
new file mode 100644
index 0000000..38a4138
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.textwrap-0.11.0.bazel
@@ -0,0 +1,62 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT"
+])
+
+# Generated Targets
+
+# Unsupported target "linear" with type "bench" omitted
+
+# Unsupported target "layout" with type "example" omitted
+
+# Unsupported target "termwidth" with type "example" omitted
+
+rust_library(
+ name = "textwrap",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.11.0",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__unicode_width__0_1_9//:unicode_width",
+ ],
+)
+
+# Unsupported target "version-numbers" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.unicode-segmentation-1.8.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.unicode-segmentation-1.8.0.bazel
new file mode 100644
index 0000000..126a432
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.unicode-segmentation-1.8.0.bazel
@@ -0,0 +1,59 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "graphemes" with type "bench" omitted
+
+# Unsupported target "unicode_words" with type "bench" omitted
+
+# Unsupported target "word_bounds" with type "bench" omitted
+
+rust_library(
+ name = "unicode_segmentation",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.8.0",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.unicode-width-0.1.9.bazel b/tools/rust_analyzer/raze/remote/BUILD.unicode-width-0.1.9.bazel
new file mode 100644
index 0000000..1b1b356
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.unicode-width-0.1.9.bazel
@@ -0,0 +1,54 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "unicode_width",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.1.9",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.unicode-xid-0.2.2.bazel b/tools/rust_analyzer/raze/remote/BUILD.unicode-xid-0.2.2.bazel
new file mode 100644
index 0000000..9b7936d
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.unicode-xid-0.2.2.bazel
@@ -0,0 +1,58 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "xid" with type "bench" omitted
+
+rust_library(
+ name = "unicode_xid",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.2.2",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
+
+# Unsupported target "exhaustive_tests" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.vec_map-0.8.2.bazel b/tools/rust_analyzer/raze/remote/BUILD.vec_map-0.8.2.bazel
new file mode 100644
index 0000000..a9ca9b9
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.vec_map-0.8.2.bazel
@@ -0,0 +1,53 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "vec_map",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.8.2",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.version_check-0.9.3.bazel b/tools/rust_analyzer/raze/remote/BUILD.version_check-0.9.3.bazel
new file mode 100644
index 0000000..2d24b1f
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.version_check-0.9.3.bazel
@@ -0,0 +1,53 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "version_check",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.9.3",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.winapi-0.3.9.bazel b/tools/rust_analyzer/raze/remote/BUILD.winapi-0.3.9.bazel
new file mode 100644
index 0000000..89fc3a8
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.winapi-0.3.9.bazel
@@ -0,0 +1,105 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "winapi_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "consoleapi",
+ "errhandlingapi",
+ "fileapi",
+ "minwinbase",
+ "minwindef",
+ "processenv",
+ "std",
+ "winbase",
+ "wincon",
+ "winerror",
+ "winnt",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.3.9",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "winapi",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "consoleapi",
+ "errhandlingapi",
+ "fileapi",
+ "minwinbase",
+ "minwindef",
+ "processenv",
+ "std",
+ "winbase",
+ "wincon",
+ "winerror",
+ "winnt",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.3.9",
+ # buildifier: leave-alone
+ deps = [
+ ":winapi_build_script",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel
new file mode 100644
index 0000000..0920950
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel
@@ -0,0 +1,83 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "winapi_i686_pc_windows_gnu_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.0",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "winapi_i686_pc_windows_gnu",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.0",
+ # buildifier: leave-alone
+ deps = [
+ ":winapi_i686_pc_windows_gnu_build_script",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.winapi-util-0.1.5.bazel b/tools/rust_analyzer/raze/remote/BUILD.winapi-util-0.1.5.bazel
new file mode 100644
index 0000000..d72f51f
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.winapi-util-0.1.5.bazel
@@ -0,0 +1,64 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "unencumbered", # Unlicense from expression "Unlicense OR MIT"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "winapi_util",
+ srcs = glob(["**/*.rs"]),
+ aliases = {
+ },
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.1.5",
+ # buildifier: leave-alone
+ deps = [
+ ] + selects.with_or({
+ # cfg(windows)
+ (
+ "@rules_rust//rust/platform:i686-pc-windows-msvc",
+ "@rules_rust//rust/platform:x86_64-pc-windows-msvc",
+ ): [
+ "@rules_rust_tools_rust_analyzer__winapi__0_3_9//:winapi",
+ ],
+ "//conditions:default": [],
+ }),
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel
new file mode 100644
index 0000000..b6b2804
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel
@@ -0,0 +1,83 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "winapi_x86_64_pc_windows_gnu_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.0",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "winapi_x86_64_pc_windows_gnu",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.0",
+ # buildifier: leave-alone
+ deps = [
+ ":winapi_x86_64_pc_windows_gnu_build_script",
+ ],
+)
diff --git a/tools/rust_analyzer/rust_project.rs b/tools/rust_analyzer/rust_project.rs
new file mode 100644
index 0000000..0cc9378
--- /dev/null
+++ b/tools/rust_analyzer/rust_project.rs
@@ -0,0 +1,311 @@
+//! Library for generating rust_project.json files from a `Vec<CrateSpec>`
+//! See official documentation of file format at https://rust-analyzer.github.io/manual.html
+
+use std::collections::{BTreeMap, BTreeSet, HashMap};
+use std::io::ErrorKind;
+use std::path::Path;
+
+use anyhow::anyhow;
+use serde::Serialize;
+
+use crate::aquery::CrateSpec;
+
+/// A `rust-project.json` workspace representation. See
+/// [rust-analyzer documentation][rd] for a thorough description of this interface.
+/// [rd]: https://rust-analyzer.github.io/manual.html#non-cargo-based-projects
+#[derive(Debug, Serialize)]
+pub struct RustProject {
+ /// Path to the directory with *source code* of
+ /// sysroot crates.
+ sysroot_src: Option<String>,
+
+ /// The set of crates comprising the current
+ /// project. Must include all transitive
+ /// dependencies as well as sysroot crate (libstd,
+ /// libcore and such).
+ crates: Vec<Crate>,
+}
+
+/// A `rust-project.json` crate representation. See
+/// [rust-analyzer documentation][rd] for a thorough description of this interface.
+/// [rd]: https://rust-analyzer.github.io/manual.html#non-cargo-based-projects
+#[derive(Debug, Serialize)]
+pub struct Crate {
+ /// A name used in the package's project declaration
+ #[serde(skip_serializing_if = "Option::is_none")]
+ display_name: Option<String>,
+
+ /// Path to the root module of the crate.
+ root_module: String,
+
+ /// Edition of the crate.
+ edition: String,
+
+ /// Dependencies
+ deps: Vec<Dependency>,
+
+ /// Should this crate be treated as a member of current "workspace".
+ #[serde(skip_serializing_if = "Option::is_none")]
+ is_workspace_member: Option<bool>,
+
+ /// Optionally specify the (super)set of `.rs` files comprising this crate.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ source: Option<Source>,
+
+ /// The set of cfgs activated for a given crate, like
+ /// `["unix", "feature=\"foo\"", "feature=\"bar\""]`.
+ cfg: Vec<String>,
+
+ /// Target triple for this Crate.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ target: Option<String>,
+
+ /// Environment variables, used for the `env!` macro
+ #[serde(skip_serializing_if = "Option::is_none")]
+ env: Option<BTreeMap<String, String>>,
+
+ /// Whether the crate is a proc-macro crate.
+ is_proc_macro: bool,
+
+ /// For proc-macro crates, path to compiled proc-macro (.so file).
+ #[serde(skip_serializing_if = "Option::is_none")]
+ proc_macro_dylib_path: Option<String>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct Source {
+ include_dirs: Vec<String>,
+ exclude_dirs: Vec<String>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct Dependency {
+ /// Index of a crate in the `crates` array.
+ #[serde(rename = "crate")]
+ crate_index: usize,
+
+ /// The display name of the crate.
+ name: String,
+}
+
+pub fn generate_rust_project(
+ sysroot_src: &str,
+ crates: &BTreeSet<CrateSpec>,
+) -> anyhow::Result<RustProject> {
+ let mut project = RustProject {
+ sysroot_src: Some(sysroot_src.into()),
+ crates: Vec::new(),
+ };
+
+ let mut unmerged_crates: Vec<&CrateSpec> = crates.iter().collect();
+ let mut skipped_crates: Vec<&CrateSpec> = Vec::new();
+ let mut merged_crates_index: HashMap<String, usize> = HashMap::new();
+
+ while !unmerged_crates.is_empty() {
+ for c in unmerged_crates.iter() {
+ if c.deps
+ .iter()
+ .any(|dep| !merged_crates_index.contains_key(dep))
+ {
+ log::trace!(
+ "Skipped crate {} because missing deps: {:?}",
+ &c.crate_id,
+ c.deps
+ .iter()
+ .filter(|dep| !merged_crates_index.contains_key(*dep))
+ .cloned()
+ .collect::<Vec<_>>()
+ );
+ skipped_crates.push(c);
+ } else {
+ log::trace!("Merging crate {}", &c.crate_id);
+ merged_crates_index.insert(c.crate_id.clone(), project.crates.len());
+ project.crates.push(Crate {
+ display_name: Some(c.display_name.clone()),
+ root_module: c.root_module.clone(),
+ edition: c.edition.clone(),
+ deps: c
+ .deps
+ .iter()
+ .map(|dep| {
+ let crate_index = *merged_crates_index
+ .get(dep)
+ .expect("failed to find dependency on second lookup");
+ let dep_crate = &project.crates[crate_index as usize];
+ Dependency {
+ crate_index,
+ name: dep_crate
+ .display_name
+ .as_ref()
+ .expect("all crates should have display_name")
+ .clone(),
+ }
+ })
+ .collect(),
+ is_workspace_member: Some(c.is_workspace_member),
+ source: c.source.as_ref().map(|s| Source {
+ exclude_dirs: s.exclude_dirs.clone(),
+ include_dirs: s.include_dirs.clone(),
+ }),
+ cfg: c.cfg.clone(),
+ target: Some(c.target.clone()),
+ env: Some(c.env.clone()),
+ is_proc_macro: c.proc_macro_dylib_path.is_some(),
+ proc_macro_dylib_path: c.proc_macro_dylib_path.clone(),
+ });
+ }
+ }
+
+ // This should not happen, but if it does exit to prevent infinite loop.
+ if unmerged_crates.len() == skipped_crates.len() {
+ log::debug!(
+ "Did not make progress on {} unmerged crates. Crates: {:?}",
+ skipped_crates.len(),
+ skipped_crates
+ );
+ return Err(anyhow!(
+ "Failed to make progress on building crate dependency graph"
+ ));
+ }
+ std::mem::swap(&mut unmerged_crates, &mut skipped_crates);
+ skipped_crates.clear();
+ }
+
+ Ok(project)
+}
+
+pub fn write_rust_project(
+ rust_project_path: &Path,
+ execution_root: &Path,
+ rust_project: &RustProject,
+) -> anyhow::Result<()> {
+ let execution_root = execution_root
+ .to_str()
+ .ok_or_else(|| anyhow!("execution_root is not valid UTF-8"))?;
+
+ // Try to remove the existing rust-project.json. It's OK if the file doesn't exist.
+ match std::fs::remove_file(rust_project_path) {
+ Ok(_) => {}
+ Err(err) if err.kind() == ErrorKind::NotFound => {}
+ Err(err) => {
+ return Err(anyhow!(
+ "Unexpected error removing old rust-project.json: {}",
+ err
+ ))
+ }
+ }
+
+ // Render the `rust-project.json` file and replace the exec root
+ // placeholders with the path to the local exec root.
+ let rust_project_content =
+ serde_json::to_string(rust_project)?.replace("__EXEC_ROOT__", execution_root);
+
+ // Write the new rust-project.json file.
+ std::fs::write(rust_project_path, rust_project_content)?;
+
+ Ok(())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ use std::collections::BTreeSet;
+
+ use crate::aquery::CrateSpec;
+
+ /// A simple example with a single crate and no dependencies.
+ #[test]
+ fn generate_rust_project_single() {
+ let project = generate_rust_project(
+ "sysroot",
+ &BTreeSet::from([CrateSpec {
+ crate_id: "ID-example".into(),
+ display_name: "example".into(),
+ edition: "2018".into(),
+ root_module: "example/lib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ }]),
+ )
+ .expect("expect success");
+
+ assert_eq!(project.crates.len(), 1);
+ let c = &project.crates[0];
+ assert_eq!(c.display_name, Some("example".into()));
+ assert_eq!(c.root_module, "example/lib.rs");
+ assert_eq!(c.deps.len(), 0);
+ }
+
+ /// An example with a one crate having two dependencies.
+ #[test]
+ fn generate_rust_project_with_deps() {
+ let project = generate_rust_project(
+ "sysroot",
+ &BTreeSet::from([
+ CrateSpec {
+ crate_id: "ID-example".into(),
+ display_name: "example".into(),
+ edition: "2018".into(),
+ root_module: "example/lib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-dep_a".into(), "ID-dep_b".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-dep_a".into(),
+ display_name: "dep_a".into(),
+ edition: "2018".into(),
+ root_module: "dep_a/lib.rs".into(),
+ is_workspace_member: false,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-dep_b".into(),
+ display_name: "dep_b".into(),
+ edition: "2018".into(),
+ root_module: "dep_b/lib.rs".into(),
+ is_workspace_member: false,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ crate_type: "rlib".into(),
+ },
+ ]),
+ )
+ .expect("expect success");
+
+ assert_eq!(project.crates.len(), 3);
+ // Both dep_a and dep_b should be one of the first two crates.
+ assert!(
+ Some("dep_a".into()) == project.crates[0].display_name
+ || Some("dep_a".into()) == project.crates[1].display_name
+ );
+ assert!(
+ Some("dep_b".into()) == project.crates[0].display_name
+ || Some("dep_b".into()) == project.crates[1].display_name
+ );
+ let c = &project.crates[2];
+ assert_eq!(c.display_name, Some("example".into()));
+ }
+}
diff --git a/tools/rustdoc/BUILD.bazel b/tools/rustdoc/BUILD.bazel
new file mode 100644
index 0000000..f941759
--- /dev/null
+++ b/tools/rustdoc/BUILD.bazel
@@ -0,0 +1,12 @@
+load("//rust:defs.bzl", "rust_binary")
+
+package(default_visibility = ["//visibility:public"])
+
+rust_binary(
+ name = "rustdoc_test_writer",
+ srcs = ["rustdoc_test_writer.rs"],
+ edition = "2018",
+ deps = [
+ "//tools/runfiles",
+ ],
+)
diff --git a/tools/rustdoc/rustdoc_test_writer.rs b/tools/rustdoc/rustdoc_test_writer.rs
new file mode 100644
index 0000000..6803e8b
--- /dev/null
+++ b/tools/rustdoc/rustdoc_test_writer.rs
@@ -0,0 +1,205 @@
+//! A utility for writing scripts for use as test executables intended to match the
+//! subcommands of Bazel build actions so `rustdoc --test`, which builds and tests
+//! code in a single call, can be run as a test target in a hermetic manner.
+
+use std::cmp::Reverse;
+use std::collections::{BTreeMap, BTreeSet};
+use std::env;
+use std::fs;
+use std::path::{Path, PathBuf};
+
+#[derive(Debug)]
+struct Options {
+ /// A list of environment variable keys to parse from the build action env.
+ env_keys: BTreeSet<String>,
+
+ /// A list of substrings to strip from [Options::action_argv].
+ strip_substrings: Vec<String>,
+
+ /// The path where the script should be written.
+ output: PathBuf,
+
+ /// The `argv` of the configured rustdoc build action.
+ action_argv: Vec<String>,
+}
+
+/// Parse command line arguments
+fn parse_args() -> Options {
+ let args: Vec<String> = env::args().into_iter().collect();
+ let (writer_args, action_args) = {
+ let split = args
+ .iter()
+ .position(|arg| arg == "--")
+ .expect("Unable to find split identifier `--`");
+
+ // Converting each set into a vector makes them easier to parse in
+ // the absence of nightly features
+ let (writer, action) = args.split_at(split);
+ (writer.to_vec(), action.to_vec())
+ };
+
+ // Remove the leading `--` which is expected to be the first
+ // item in `action_args`
+ debug_assert_eq!(action_args[0], "--");
+ let action_argv = action_args[1..].to_vec();
+
+ let output = writer_args
+ .iter()
+ .find(|arg| arg.starts_with("--output="))
+ .and_then(|arg| arg.splitn(2, '=').last())
+ .map(PathBuf::from)
+ .expect("Missing `--output` argument");
+
+ let (strip_substring_args, writer_args): (Vec<String>, Vec<String>) = writer_args
+ .into_iter()
+ .partition(|arg| arg.starts_with("--strip_substring="));
+
+ let mut strip_substrings: Vec<String> = strip_substring_args
+ .into_iter()
+ .map(|arg| {
+ arg.splitn(2, '=')
+ .last()
+ .expect("--strip_substring arguments must have assignments using `=`")
+ .to_owned()
+ })
+ .collect();
+
+ // Strip substrings should always be in reverse order of the length of each
+ // string so when filtering we know that the longer strings are checked
+ // first in order to avoid cases where shorter strings might match longer ones.
+ strip_substrings.sort_by_key(|b| Reverse(b.len()));
+ strip_substrings.dedup();
+
+ let env_keys = writer_args
+ .into_iter()
+ .filter(|arg| arg.starts_with("--action_env="))
+ .map(|arg| {
+ arg.splitn(2, '=')
+ .last()
+ .expect("--env arguments must have assignments using `=`")
+ .to_owned()
+ })
+ .collect();
+
+ Options {
+ env_keys,
+ strip_substrings,
+ output,
+ action_argv,
+ }
+}
+
+/// Write a unix compatible test runner
+fn write_test_runner_unix(
+ path: &Path,
+ env: &BTreeMap<String, String>,
+ argv: &[String],
+ strip_substrings: &[String],
+) {
+ let mut content = vec![
+ "#!/usr/bin/env bash".to_owned(),
+ "".to_owned(),
+ "exec env - \\".to_owned(),
+ ];
+
+ content.extend(env.iter().map(|(key, val)| format!("{}='{}' \\", key, val)));
+
+ let argv_str = argv
+ .iter()
+ // Remove any substrings found in the argument
+ .map(|arg| {
+ let mut stripped_arg = arg.to_owned();
+ strip_substrings
+ .iter()
+ .for_each(|substring| stripped_arg = stripped_arg.replace(substring, ""));
+ stripped_arg
+ })
+ .map(|arg| format!("'{}'", arg))
+ .collect::<Vec<String>>()
+ .join(" ");
+
+ content.extend(vec![argv_str, "".to_owned()]);
+
+ fs::write(path, content.join("\n")).expect("Failed to write test runner");
+}
+
+/// Write a windows compatible test runner
+fn write_test_runner_windows(
+ path: &Path,
+ env: &BTreeMap<String, String>,
+ argv: &[String],
+ strip_substrings: &[String],
+) {
+ let env_str = env
+ .iter()
+ .map(|(key, val)| format!("$env:{}='{}'", key, val))
+ .collect::<Vec<String>>()
+ .join(" ; ");
+
+ let argv_str = argv
+ .iter()
+ // Remove any substrings found in the argument
+ .map(|arg| {
+ let mut stripped_arg = arg.to_owned();
+ strip_substrings
+ .iter()
+ .for_each(|substring| stripped_arg = stripped_arg.replace(substring, ""));
+ stripped_arg
+ })
+ .map(|arg| format!("'{}'", arg))
+ .collect::<Vec<String>>()
+ .join(" ");
+
+ let content = vec![
+ "@ECHO OFF".to_owned(),
+ "".to_owned(),
+ format!("powershell.exe -c \"{} ; & {}\"", env_str, argv_str),
+ "".to_owned(),
+ ];
+
+ fs::write(path, content.join("\n")).expect("Failed to write test runner");
+}
+
+#[cfg(target_family = "unix")]
+fn set_executable(path: &Path) {
+ use std::os::unix::prelude::PermissionsExt;
+
+ let mut perm = fs::metadata(path)
+ .expect("Failed to get test runner metadata")
+ .permissions();
+
+ perm.set_mode(0o755);
+ fs::set_permissions(path, perm).expect("Failed to set permissions on test runner");
+}
+
+#[cfg(target_family = "windows")]
+fn set_executable(_path: &Path) {
+ // Windows determines whether or not a file is executable via the PATHEXT
+ // environment variable. This function is a no-op for this platform.
+}
+
+fn write_test_runner(
+ path: &Path,
+ env: &BTreeMap<String, String>,
+ argv: &[String],
+ strip_substrings: &[String],
+) {
+ if cfg!(target_family = "unix") {
+ write_test_runner_unix(path, env, argv, strip_substrings);
+ } else if cfg!(target_family = "windows") {
+ write_test_runner_windows(path, env, argv, strip_substrings);
+ }
+
+ set_executable(path);
+}
+
+fn main() {
+ let opt = parse_args();
+
+ let env: BTreeMap<String, String> = env::vars()
+ .into_iter()
+ .filter(|(key, _)| opt.env_keys.iter().any(|k| k == key))
+ .collect();
+
+ write_test_runner(&opt.output, &env, &opt.action_argv, &opt.strip_substrings);
+}
diff --git a/tools/rustfmt/BUILD.bazel b/tools/rustfmt/BUILD.bazel
new file mode 100644
index 0000000..1456eb1
--- /dev/null
+++ b/tools/rustfmt/BUILD.bazel
@@ -0,0 +1,65 @@
+load("//rust:defs.bzl", "rust_binary", "rust_clippy", "rust_library")
+load("//tools:tool_utils.bzl", "aspect_repository")
+
+package(default_visibility = ["//visibility:public"])
+
+exports_files([
+ "rustfmt.toml",
+ "rustfmt_utils.bzl",
+])
+
+rust_library(
+ name = "rustfmt_lib",
+ srcs = glob(
+ ["srcs/**/*.rs"],
+ exclude = ["srcs/**/*main.rs"],
+ ),
+ data = [
+ "//:rustfmt.toml",
+ "//rust/toolchain:current_exec_rustfmt_files",
+ ],
+ edition = "2018",
+ rustc_env = {
+ "RUSTFMT": "$(rootpath //rust/toolchain:current_exec_rustfmt_files)",
+ "RUSTFMT_CONFIG": "$(rootpath //:rustfmt.toml)",
+ },
+)
+
+rust_binary(
+ name = "rustfmt",
+ srcs = [
+ "srcs/main.rs",
+ ],
+ data = [
+ "//:rustfmt.toml",
+ ],
+ edition = "2018",
+ rustc_env = {
+ "ASPECT_REPOSITORY": aspect_repository(),
+ },
+ deps = [
+ ":rustfmt_lib",
+ "//util/label",
+ ],
+)
+
+rust_binary(
+ name = "rustfmt_test",
+ srcs = [
+ "srcs/test_main.rs",
+ ],
+ edition = "2018",
+ deps = [
+ ":rustfmt_lib",
+ "//tools/runfiles",
+ ],
+)
+
+rust_clippy(
+ name = "rustfmt_clippy",
+ testonly = True,
+ visibility = ["//visibility:private"],
+ deps = [
+ ":rustfmt",
+ ],
+)
diff --git a/tools/rustfmt/rustfmt.toml b/tools/rustfmt/rustfmt.toml
new file mode 100644
index 0000000..44bdbf2
--- /dev/null
+++ b/tools/rustfmt/rustfmt.toml
@@ -0,0 +1 @@
+# rustfmt options: https://rust-lang.github.io/rustfmt/
diff --git a/tools/rustfmt/srcs/lib.rs b/tools/rustfmt/srcs/lib.rs
new file mode 100644
index 0000000..ad2e86a
--- /dev/null
+++ b/tools/rustfmt/srcs/lib.rs
@@ -0,0 +1,74 @@
+use std::env;
+use std::fs;
+use std::path::{Path, PathBuf};
+
+/// The expected extension of rustfmt manifest files generated by `rustfmt_aspect`.
+pub const RUSTFMT_MANIFEST_EXTENSION: &str = "rustfmt";
+
+/// Generate an absolute path to a file without resolving symlinks
+fn absolutify_existing<T: AsRef<Path>>(path: &T) -> std::io::Result<PathBuf> {
+ let absolute_path = if path.as_ref().is_absolute() {
+ path.as_ref().to_owned()
+ } else {
+ std::env::current_dir()
+ .expect("Failed to get working directory")
+ .join(path)
+ };
+ std::fs::metadata(&absolute_path).map(|_| absolute_path)
+}
+
+/// A struct containing details used for executing rustfmt.
+#[derive(Debug)]
+pub struct RustfmtConfig {
+ /// The rustfmt binary from the currently active toolchain
+ pub rustfmt: PathBuf,
+
+ /// The rustfmt config file containing rustfmt settings.
+ /// https://rust-lang.github.io/rustfmt/
+ pub config: PathBuf,
+}
+
+/// Parse command line arguments and environment variables to
+/// produce config data for running rustfmt.
+pub fn parse_rustfmt_config() -> RustfmtConfig {
+ RustfmtConfig {
+ rustfmt: absolutify_existing(&env!("RUSTFMT")).expect("Unable to find rustfmt binary"),
+ config: absolutify_existing(&env!("RUSTFMT_CONFIG"))
+ .expect("Unable to find rustfmt config file"),
+ }
+}
+
+/// A struct of target specific information for use in running `rustfmt`.
+#[derive(Debug)]
+pub struct RustfmtManifest {
+ /// The Rust edition of the Bazel target
+ pub edition: String,
+
+ /// A list of all (non-generated) source files for formatting.
+ pub sources: Vec<String>,
+}
+
+/// Parse rustfmt flags from a manifest generated by builds using `rustfmt_aspect`.
+pub fn parse_rustfmt_manifest(manifest: &Path) -> RustfmtManifest {
+ let content = fs::read_to_string(manifest)
+ .unwrap_or_else(|_| panic!("Failed to read rustfmt manifest: {}", manifest.display()));
+
+ let mut lines: Vec<String> = content
+ .split('\n')
+ .into_iter()
+ .filter(|s| !s.is_empty())
+ .map(|s| s.to_owned())
+ .collect();
+
+ let edition = lines
+ .pop()
+ .expect("There should always be at least 1 line in the manifest");
+ edition
+ .parse::<i32>()
+ .expect("The edition should be a numeric value. eg `2018`.");
+
+ RustfmtManifest {
+ edition,
+ sources: lines,
+ }
+}
diff --git a/tools/rustfmt/srcs/main.rs b/tools/rustfmt/srcs/main.rs
new file mode 100644
index 0000000..4e4419f
--- /dev/null
+++ b/tools/rustfmt/srcs/main.rs
@@ -0,0 +1,185 @@
+use std::env;
+use std::path::PathBuf;
+use std::process::{Command, Stdio};
+use std::str;
+
+fn main() {
+ // Gather all command line and environment settings
+ let options = parse_args();
+
+ // Gather a list of all formattable targets
+ let targets = query_rustfmt_targets(&options);
+
+ // Run rustfmt on these targets
+ apply_rustfmt(&options, &targets);
+}
+
+/// Perform a `bazel` query to determine a list of Bazel targets which are to be formatted.
+fn query_rustfmt_targets(options: &Config) -> Vec<String> {
+ // Determine what packages to query
+ let scope = match options.packages.is_empty() {
+ true => "//...:all".to_owned(),
+ false => {
+ // Check to see if all the provided packages are actually targets
+ let is_all_targets = options
+ .packages
+ .iter()
+ .all(|pkg| match label::analyze(pkg) {
+ Ok(tgt) => tgt.name != "all",
+ Err(_) => false,
+ });
+
+ // Early return if a list of targets and not packages were provided
+ if is_all_targets {
+ return options.packages.clone();
+ }
+
+ options.packages.join(" + ")
+ }
+ };
+
+ let query_args = vec![
+ "query".to_owned(),
+ format!(
+ r#"kind('{types}', {scope}) except attr(tags, 'norustfmt', kind('{types}', {scope}))"#,
+ types = "^rust_",
+ scope = scope
+ ),
+ ];
+
+ let child = Command::new(&options.bazel)
+ .current_dir(&options.workspace)
+ .args(query_args)
+ .stdout(Stdio::piped())
+ .stderr(Stdio::inherit())
+ .spawn()
+ .expect("Failed to spawn bazel query command");
+
+ let output = child
+ .wait_with_output()
+ .expect("Failed to wait on spawned command");
+
+ if !output.status.success() {
+ std::process::exit(output.status.code().unwrap_or(1));
+ }
+
+ str::from_utf8(&output.stdout)
+ .expect("Invalid stream from command")
+ .split('\n')
+ .filter(|line| !line.is_empty())
+ .map(|line| line.to_string())
+ .collect()
+}
+
+/// Build a list of Bazel targets using the `rustfmt_aspect` to produce the
+/// arguments to use when formatting the sources of those targets.
+fn generate_rustfmt_target_manifests(options: &Config, targets: &[String]) {
+ let build_args = vec![
+ "build".to_owned(),
+ format!(
+ "--aspects={}//rust:defs.bzl%rustfmt_aspect",
+ env!("ASPECT_REPOSITORY")
+ ),
+ "--output_groups=rustfmt_manifest".to_owned(),
+ ];
+
+ let child = Command::new(&options.bazel)
+ .current_dir(&options.workspace)
+ .args(build_args)
+ .args(targets)
+ .stdout(Stdio::piped())
+ .stderr(Stdio::inherit())
+ .spawn()
+ .expect("Failed to spawn command");
+
+ let output = child
+ .wait_with_output()
+ .expect("Failed to wait on spawned command");
+
+ if !output.status.success() {
+ std::process::exit(output.status.code().unwrap_or(1));
+ }
+}
+
+/// Run rustfmt on a set of Bazel targets
+fn apply_rustfmt(options: &Config, targets: &[String]) {
+ // Ensure the targets are first built and a manifest containing `rustfmt`
+ // arguments are generated before formatting source files.
+ generate_rustfmt_target_manifests(options, targets);
+
+ for target in targets.iter() {
+ // Replace any `:` characters and strip leading slashes
+ let target_path = target.replace(':', "/").trim_start_matches('/').to_owned();
+
+ // Find a manifest for the current target. Not all targets will have one
+ let manifest = options.workspace.join("bazel-bin").join(format!(
+ "{}.{}",
+ &target_path,
+ rustfmt_lib::RUSTFMT_MANIFEST_EXTENSION,
+ ));
+
+ if !manifest.exists() {
+ continue;
+ }
+
+ // Load the manifest containing rustfmt arguments
+ let rustfmt_config = rustfmt_lib::parse_rustfmt_manifest(&manifest);
+
+ // Ignore any targets which do not have source files. This can
+ // occur in cases where all source files are generated.
+ if rustfmt_config.sources.is_empty() {
+ continue;
+ }
+
+ // Run rustfmt
+ let status = Command::new(&options.rustfmt_config.rustfmt)
+ .current_dir(&options.workspace)
+ .arg("--edition")
+ .arg(rustfmt_config.edition)
+ .arg("--config-path")
+ .arg(&options.rustfmt_config.config)
+ .args(rustfmt_config.sources)
+ .status()
+ .expect("Failed to run rustfmt");
+
+ if !status.success() {
+ std::process::exit(status.code().unwrap_or(1));
+ }
+ }
+}
+
+/// A struct containing details used for executing rustfmt.
+#[derive(Debug)]
+struct Config {
+ /// The path of the Bazel workspace root.
+ pub workspace: PathBuf,
+
+ /// The Bazel executable to use for builds and queries.
+ pub bazel: PathBuf,
+
+ /// Information about the current rustfmt binary to run.
+ pub rustfmt_config: rustfmt_lib::RustfmtConfig,
+
+ /// Optionally, users can pass a list of targets/packages/scopes
+ /// (eg `//my:target` or `//my/pkg/...`) to control the targets
+ /// to be formatted. If empty, all targets in the workspace will
+ /// be formatted.
+ pub packages: Vec<String>,
+}
+
+/// Parse command line arguments and environment variables to
+/// produce config data for running rustfmt.
+fn parse_args() -> Config {
+ Config{
+ workspace: PathBuf::from(
+ env::var("BUILD_WORKSPACE_DIRECTORY")
+ .expect("The environment variable BUILD_WORKSPACE_DIRECTORY is required for finding the workspace root")
+ ),
+ bazel: PathBuf::from(
+ env::var("BAZEL_REAL")
+ .unwrap_or_else(|_| "bazel".to_owned())
+ ),
+ rustfmt_config: rustfmt_lib::parse_rustfmt_config(),
+ packages: env::args().skip(1).collect(),
+ }
+}
diff --git a/tools/rustfmt/srcs/test_main.rs b/tools/rustfmt/srcs/test_main.rs
new file mode 100644
index 0000000..ea2adba
--- /dev/null
+++ b/tools/rustfmt/srcs/test_main.rs
@@ -0,0 +1,95 @@
+use std::fs;
+use std::path::{Path, PathBuf};
+use std::process::Command;
+
+fn main() {
+ // Gather all and environment settings
+ let options = parse_args();
+
+ // Perform rustfmt for each manifest available
+ run_rustfmt(&options);
+}
+
+/// Run rustfmt on a set of Bazel targets
+fn run_rustfmt(options: &Config) {
+ // In order to ensure the test parses all sources, we separately
+ // track whether or not a failure has occured when checking formatting.
+ let mut is_failure: bool = false;
+
+ for manifest in options.manifests.iter() {
+ // Ignore any targets which do not have source files. This can
+ // occur in cases where all source files are generated.
+ if manifest.sources.is_empty() {
+ continue;
+ }
+
+ // Run rustfmt
+ let status = Command::new(&options.rustfmt_config.rustfmt)
+ .arg("--check")
+ .arg("--edition")
+ .arg(&manifest.edition)
+ .arg("--config-path")
+ .arg(&options.rustfmt_config.config)
+ .args(&manifest.sources)
+ .status()
+ .expect("Failed to run rustfmt");
+
+ if !status.success() {
+ is_failure = true;
+ }
+ }
+
+ if is_failure {
+ std::process::exit(1);
+ }
+}
+
+/// A struct containing details used for executing rustfmt.
+#[derive(Debug)]
+struct Config {
+ /// Information about the current rustfmt binary to run.
+ pub rustfmt_config: rustfmt_lib::RustfmtConfig,
+
+ /// A list of manifests containing information about sources
+ /// to check using rustfmt.
+ pub manifests: Vec<rustfmt_lib::RustfmtManifest>,
+}
+
+/// Parse the runfiles of the current executable for manifests generated
+/// but the `rustfmt_aspect` aspect.
+fn find_manifests(dir: &Path, manifests: &mut Vec<PathBuf>) {
+ if dir.is_dir() {
+ for entry in fs::read_dir(dir).expect("Failed to read directory contents") {
+ let entry = entry.expect("Failed to read directory entry");
+ let path = entry.path();
+ if path.is_dir() {
+ find_manifests(&path, manifests);
+ } else if let Some(ext) = path.extension() {
+ if ext == rustfmt_lib::RUSTFMT_MANIFEST_EXTENSION {
+ manifests.extend(vec![path]);
+ }
+ }
+ }
+ }
+}
+
+/// Parse settings from the environment into a config struct
+fn parse_args() -> Config {
+ let mut manifests: Vec<PathBuf> = Vec::new();
+ find_manifests(
+ &runfiles::find_runfiles_dir().expect("Failed to find runfiles directory"),
+ &mut manifests,
+ );
+
+ if manifests.is_empty() {
+ panic!("No manifests were found");
+ }
+
+ Config {
+ rustfmt_config: rustfmt_lib::parse_rustfmt_config(),
+ manifests: manifests
+ .iter()
+ .map(|manifest| rustfmt_lib::parse_rustfmt_manifest(manifest))
+ .collect(),
+ }
+}
diff --git a/tools/tool_utils.bzl b/tools/tool_utils.bzl
new file mode 100644
index 0000000..de876b1
--- /dev/null
+++ b/tools/tool_utils.bzl
@@ -0,0 +1,15 @@
+"""A helper module for the various targets in the `@rules_rust//tools` package"""
+
+def aspect_repository():
+ """Determines the repository name to use in Bazel commands that use aspects.
+
+ Some tools (`//tools/rustfmt` `//tools/rust_analyzer`) make calls to Bazel
+ and pass the `--aspects` flag. This macro allows those tools to work around
+ the following issue: https://github.com/bazelbuild/bazel/issues/11734
+
+ Returns:
+ str: The string to use for the `--aspects` repository labels
+ """
+ if native.repository_name() == "@":
+ return ""
+ return native.repository_name()