diff --git a/src/tools/rust-analyzer/crates/project-model/src/lib.rs b/src/tools/rust-analyzer/crates/project-model/src/lib.rs index f5405438253..dec4f1456ba 100644 --- a/src/tools/rust-analyzer/crates/project-model/src/lib.rs +++ b/src/tools/rust-analyzer/crates/project-model/src/lib.rs @@ -19,7 +19,7 @@ pub mod project_json; pub mod toolchain_info { pub mod rustc_cfg; pub mod target_data_layout; - pub mod target_triple; + pub mod target_tuple; use std::path::Path; diff --git a/src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_triple.rs b/src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_tuple.rs similarity index 88% rename from src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_triple.rs rename to src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_tuple.rs index 163884e5e8b..55e033caecc 100644 --- a/src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_triple.rs +++ b/src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_tuple.rs @@ -14,7 +14,7 @@ pub fn get( target: Option<&str>, extra_env: &FxHashMap, ) -> anyhow::Result> { - let _p = tracing::info_span!("target_triple::get").entered(); + let _p = tracing::info_span!("target_tuple::get").entered(); if let Some(target) = target { return Ok(vec![target.to_owned()]); } @@ -28,10 +28,10 @@ pub fn get( } QueryConfig::Rustc(sysroot, current_dir) => (sysroot, current_dir), }; - rustc_discover_host_triple(extra_env, sysroot, current_dir).map(|it| vec![it]) + rustc_discover_host_tuple(extra_env, sysroot, current_dir).map(|it| vec![it]) } -fn rustc_discover_host_triple( +fn rustc_discover_host_tuple( extra_env: &FxHashMap, sysroot: &Sysroot, current_dir: &Path, @@ -60,14 +60,14 @@ fn cargo_config_build_target( cmd.envs(extra_env); cmd.current_dir(cargo_toml.parent()).env("RUSTC_BOOTSTRAP", "1"); cmd.args(["-Z", "unstable-options", "config", "get", "build.target"]); - // if successful we receive `build.target = "target-triple"` + // if successful we receive `build.target = "target-tuple"` // or `build.target = ["", ..]` // this might be `error: config value `build.target` is not set` in which case we // don't wanna log the error utf8_stdout(&mut cmd).and_then(parse_output_cargo_config_build_target).ok() } -// Parses `"build.target = [target-triple, target-triple, ...]"` or `"build.target = "target-triple"` +// Parses `"build.target = [target-tuple, target-tuple, ...]"` or `"build.target = "target-tuple"` fn parse_output_cargo_config_build_target(stdout: String) -> anyhow::Result> { let trimmed = stdout.trim_start_matches("build.target = ").trim_matches('"'); diff --git a/src/tools/rust-analyzer/crates/project-model/src/workspace.rs b/src/tools/rust-analyzer/crates/project-model/src/workspace.rs index 6dc8e2fa5d8..905e83b27d1 100644 --- a/src/tools/rust-analyzer/crates/project-model/src/workspace.rs +++ b/src/tools/rust-analyzer/crates/project-model/src/workspace.rs @@ -26,7 +26,7 @@ use crate::{ env::{cargo_config_env, inject_cargo_env, inject_cargo_package_env, inject_rustc_tool_env}, project_json::{Crate, CrateArrayIdx}, sysroot::{SysrootCrate, SysrootWorkspace}, - toolchain_info::{rustc_cfg, target_data_layout, target_triple, QueryConfig}, + toolchain_info::{rustc_cfg, target_data_layout, target_tuple, QueryConfig}, utf8_stdout, CargoConfig, CargoWorkspace, CfgOverrides, InvocationStrategy, ManifestPath, Package, ProjectJson, ProjectManifest, Sysroot, SysrootSourceWorkspaceConfig, TargetData, TargetKind, WorkspaceBuildScripts, @@ -242,7 +242,7 @@ impl ProjectWorkspace { .ok_or_else(|| Some("Failed to discover rustc source for sysroot.".to_owned())), None => Err(None), }; - let targets = target_triple::get( + let targets = target_tuple::get( QueryConfig::Cargo(&sysroot, cargo_toml), config.target.as_deref(), &config.extra_env, @@ -397,7 +397,7 @@ impl ProjectWorkspace { } }; - let targets = target_triple::get( + let targets = target_tuple::get( QueryConfig::Cargo(&sysroot, detached_file), config.target.as_deref(), &config.extra_env, diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs index 67e0a208e8c..30f0031905f 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs @@ -600,7 +600,7 @@ config_data! { /// /// This option does not take effect until rust-analyzer is restarted. cargo_sysrootSrc: Option = None, - /// Compilation target override (target triple). + /// Compilation target override (target tuple). // FIXME(@poliorcetics): move to multiple targets here too, but this will need more work // than `checkOnSave_target` cargo_target: Option = None, @@ -2041,7 +2041,7 @@ impl Config { pub(crate) fn cargo_test_options(&self, source_root: Option) -> CargoOptions { CargoOptions { - target_triples: self.cargo_target(source_root).clone().into_iter().collect(), + target_tuples: self.cargo_target(source_root).clone().into_iter().collect(), all_targets: false, no_default_features: *self.cargo_noDefaultFeatures(source_root), all_features: matches!(self.cargo_features(source_root), CargoFeaturesDef::All), @@ -2076,7 +2076,7 @@ impl Config { Some(_) | None => FlycheckConfig::CargoCommand { command: self.check_command(source_root).clone(), options: CargoOptions { - target_triples: self + target_tuples: self .check_targets(source_root) .clone() .and_then(|targets| match &targets.0[..] { diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs index a306302cc0e..98042a2bceb 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs @@ -28,7 +28,7 @@ pub(crate) enum InvocationStrategy { #[derive(Clone, Debug, PartialEq, Eq)] pub(crate) struct CargoOptions { - pub(crate) target_triples: Vec, + pub(crate) target_tuples: Vec, pub(crate) all_targets: bool, pub(crate) no_default_features: bool, pub(crate) all_features: bool, @@ -49,7 +49,7 @@ pub(crate) enum Target { impl CargoOptions { pub(crate) fn apply_on_command(&self, cmd: &mut Command) { - for target in &self.target_triples { + for target in &self.target_tuples { cmd.args(["--target", target.as_str()]); } if self.all_targets { diff --git a/src/tools/rust-analyzer/docs/user/generated_config.adoc b/src/tools/rust-analyzer/docs/user/generated_config.adoc index 2c6ff4fb01e..5b86766aa8e 100644 --- a/src/tools/rust-analyzer/docs/user/generated_config.adoc +++ b/src/tools/rust-analyzer/docs/user/generated_config.adoc @@ -146,7 +146,7 @@ This option does not take effect until rust-analyzer is restarted. [[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`):: + -- -Compilation target override (target triple). +Compilation target override (target tuple). -- [[rust-analyzer.cargo.targetDir]]rust-analyzer.cargo.targetDir (default: `null`):: + diff --git a/src/tools/rust-analyzer/docs/user/manual.adoc b/src/tools/rust-analyzer/docs/user/manual.adoc index da2aa4eae4e..ffc820e9b7f 100644 --- a/src/tools/rust-analyzer/docs/user/manual.adoc +++ b/src/tools/rust-analyzer/docs/user/manual.adoc @@ -769,7 +769,7 @@ interface Crate { /// The set of cfgs activated for a given crate, like /// `["unix", "feature=\"foo\"", "feature=\"bar\""]`. cfg: string[]; - /// Target triple for this Crate. + /// Target tuple for this Crate. /// /// Used when running `rustc --print cfg` /// to get target-specific cfgs. diff --git a/src/tools/rust-analyzer/editors/code/package.json b/src/tools/rust-analyzer/editors/code/package.json index 6ec7032c0b2..80246bf3fea 100644 --- a/src/tools/rust-analyzer/editors/code/package.json +++ b/src/tools/rust-analyzer/editors/code/package.json @@ -888,7 +888,7 @@ "title": "cargo", "properties": { "rust-analyzer.cargo.target": { - "markdownDescription": "Compilation target override (target triple).", + "markdownDescription": "Compilation target override (target tuple).", "default": null, "type": [ "null",