target-triple -> target-tuple

This commit is contained in:
Lukas Wirth 2025-01-07 12:21:27 +01:00
parent f1c0d176f3
commit 2ac803ec71
8 changed files with 17 additions and 17 deletions

View file

@ -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;

View file

@ -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('"');

View file

@ -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,