mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-25 19:35:06 +00:00
target-triple -> target-tuple
This commit is contained in:
parent
f1c0d176f3
commit
2ac803ec71
8 changed files with 17 additions and 17 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ pub fn get(
|
|||
target: Option<&str>,
|
||||
extra_env: &FxHashMap<String, String>,
|
||||
) -> anyhow::Result<Vec<String>> {
|
||||
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<String, String>,
|
||||
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 = ["<target 1>", ..]`
|
||||
// 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<Vec<String>> {
|
||||
let trimmed = stdout.trim_start_matches("build.target = ").trim_matches('"');
|
||||
|
|
@ -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,
|
||||
|
|
|
@ -600,7 +600,7 @@ config_data! {
|
|||
///
|
||||
/// This option does not take effect until rust-analyzer is restarted.
|
||||
cargo_sysrootSrc: Option<String> = 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<String> = None,
|
||||
|
@ -2041,7 +2041,7 @@ impl Config {
|
|||
|
||||
pub(crate) fn cargo_test_options(&self, source_root: Option<SourceRootId>) -> 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[..] {
|
||||
|
|
|
@ -28,7 +28,7 @@ pub(crate) enum InvocationStrategy {
|
|||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub(crate) struct CargoOptions {
|
||||
pub(crate) target_triples: Vec<String>,
|
||||
pub(crate) target_tuples: Vec<String>,
|
||||
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 {
|
||||
|
|
|
@ -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`)::
|
||||
+
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue