Skip to content

Commit ce09c9a

Browse files
committed
fix(dist): bulk rename triple to tuple for variables and messages
1 parent de46b47 commit ce09c9a

5 files changed

Lines changed: 29 additions & 29 deletions

File tree

src/cli/rustup_mode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,13 +982,13 @@ async fn update(
982982
if !names.is_empty() {
983983
for name in names {
984984
// This needs another pass to fix it all up
985-
if name.has_triple() {
985+
if name.has_tuple() {
986986
let host_arch = TargetTuple::from_host_or_build(cfg.process);
987-
let target_triple = name.clone().resolve(&host_arch)?.target;
987+
let target_tuple = name.clone().resolve(&host_arch)?.target;
988988
common::check_non_host_toolchain(
989989
name.to_string(),
990990
&host_arch,
991-
&target_triple,
991+
&target_tuple,
992992
force_non_host,
993993
)?;
994994
}

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ impl<'a> Cfg<'a> {
636636
// Do not permit architecture/os selection in channels as
637637
// these are host specific and toolchain files are portable.
638638
if let ResolvableToolchainName::Official(name) = &toolchain_name
639-
&& name.has_triple()
639+
&& name.has_tuple()
640640
{
641641
// Permit fully qualified names IFF the toolchain is installed. TODO(robertc): consider
642642
// disabling this and backing out https://github.com/rust-lang/rustup/pull/2141 (but provide

src/dist/manifestation.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub(crate) const CONFIG_FILE: &str = "multirust-config.toml";
4242
#[derive(Debug)]
4343
pub struct Manifestation {
4444
installation: Components,
45-
target_triple: TargetTuple,
45+
target_tuple: TargetTuple,
4646
}
4747

4848
#[derive(Debug)]
@@ -87,12 +87,12 @@ impl Manifestation {
8787
/// it will be created as needed. If there's an existing install
8888
/// then the rust-install installation format will be verified. A
8989
/// bad installer version is the only reason this will fail.
90-
pub fn open(prefix: InstallPrefix, triple: TargetTuple) -> Result<Self> {
91-
// TODO: validate the triple with the existing install as well
90+
pub fn open(prefix: InstallPrefix, target_tuple: TargetTuple) -> Result<Self> {
91+
// TODO: validate the tuple with the existing install as well
9292
// as the metadata format of the existing install
9393
Ok(Self {
9494
installation: Components::open(prefix)?,
95-
target_triple: triple,
95+
target_tuple,
9696
})
9797
}
9898

@@ -146,7 +146,7 @@ impl Manifestation {
146146
{
147147
for component in &components {
148148
match &component.target {
149-
Some(t) if t != &self.target_triple => warn!(
149+
Some(t) if t != &self.target_tuple => warn!(
150150
"skipping unavailable component {} for target {}",
151151
new_manifest.short_name(component),
152152
t
@@ -215,14 +215,14 @@ impl Manifestation {
215215
// Uninstall components
216216
for component in update.components_to_uninstall {
217217
match (implicit_modify, &component.target) {
218-
(true, Some(t)) if t != &self.target_triple => {
218+
(true, Some(t)) if t != &self.target_tuple => {
219219
info!(
220220
"removing previous version of component {} for target {}",
221221
new_manifest.short_name(&component),
222222
t
223223
);
224224
}
225-
(false, Some(t)) if t != &self.target_triple => {
225+
(false, Some(t)) if t != &self.target_tuple => {
226226
info!(
227227
"removing component {} for target {}",
228228
new_manifest.short_name(&component),
@@ -416,11 +416,11 @@ impl Manifestation {
416416

417417
let url = new_manifest
418418
.iter()
419-
.find(|u| u.contains(&format!("{}{}", self.target_triple, ".tar.gz")));
419+
.find(|u| u.contains(&format!("{}{}", self.target_tuple, ".tar.gz")));
420420
if url.is_none() {
421421
return Err(anyhow!(
422422
"binary package was not provided for '{}'",
423-
self.target_triple,
423+
self.target_tuple,
424424
));
425425
}
426426
// Only replace once. The cost is inexpensive.
@@ -595,7 +595,7 @@ impl Update {
595595
) -> Result<Self> {
596596
// The package to install.
597597
let rust_package = new_manifest.get_package("rust")?;
598-
let rust_target_package = rust_package.get_target(Some(&manifestation.target_triple))?;
598+
let rust_target_package = rust_package.get_target(Some(&manifestation.target_tuple))?;
599599

600600
changes.check_invariants(config)?;
601601

@@ -609,7 +609,7 @@ impl Update {
609609
let looks_like_v1 = config.is_none() && !installed_components.is_empty();
610610
if looks_like_v1 {
611611
let mut profile_components = new_manifest
612-
.get_profile_components(Profile::Default, &manifestation.target_triple)?;
612+
.get_profile_components(Profile::Default, &manifestation.target_tuple)?;
613613
starting_list.append(&mut profile_components);
614614
}
615615

@@ -689,7 +689,7 @@ impl Update {
689689
result.components_to_install.push(component.clone());
690690
} else if changes.explicit_add_components.contains(component) {
691691
match &component.target {
692-
Some(t) if t != &manifestation.target_triple => info!(
692+
Some(t) if t != &manifestation.target_tuple => info!(
693693
"component {} for target {} is up to date",
694694
new_manifest.short_name(component),
695695
t,

src/dist/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ impl TargetTuple {
481481

482482
// Default to msvc
483483
let arch = arch_primary().or_else(arch_fallback)?;
484-
let msvc_triple = format!("{arch}-pc-windows-msvc");
485-
Some(TargetTuple(msvc_triple))
484+
let msvc_tuple = format!("{arch}-pc-windows-msvc");
485+
Some(TargetTuple(msvc_tuple))
486486
}
487487

488488
#[cfg(not(windows))]
@@ -504,7 +504,7 @@ impl TargetTuple {
504504
};
505505

506506
#[cfg(not(target_os = "android"))]
507-
let host_triple = match (sysname, machine) {
507+
let host_tuple = match (sysname, machine) {
508508
(b"Linux", b"x86_64") => Some(TRIPLE_X86_64_UNKNOWN_LINUX),
509509
(b"Linux", b"i686") => Some("i686-unknown-linux-gnu"),
510510
(b"Linux", b"mips") => Some(TRIPLE_MIPS_UNKNOWN_LINUX_GNU),
@@ -538,7 +538,7 @@ impl TargetTuple {
538538
};
539539

540540
#[cfg(target_os = "android")]
541-
let host_triple = match (sysname, machine) {
541+
let host_tuple = match (sysname, machine) {
542542
(_, b"arm") => Some("arm-linux-androideabi"),
543543
(_, b"armv7l") => Some("armv7-linux-androideabi"),
544544
(_, b"armv8l") => Some("armv7-linux-androideabi"),
@@ -548,7 +548,7 @@ impl TargetTuple {
548548
_ => None,
549549
};
550550

551-
host_triple.map(TargetTuple::new)
551+
host_tuple.map(TargetTuple::new)
552552
}
553553

554554
if let Ok(tuple) = process.var("RUSTUP_OVERRIDE_HOST_TUPLE") {
@@ -614,7 +614,7 @@ impl PartialToolchainDesc {
614614
pub(crate) fn resolve(self, input_host: &TargetTuple) -> Result<ToolchainDesc> {
615615
let host = PartialTargetTuple::new(&input_host.0).ok_or_else(|| {
616616
anyhow!(format!(
617-
"Provided host '{}' couldn't be converted to partial triple",
617+
"Provided host '{}' couldn't be converted to partial tuple",
618618
input_host.0
619619
))
620620
})?;
@@ -655,7 +655,7 @@ impl PartialToolchainDesc {
655655
})
656656
}
657657

658-
pub(crate) fn has_triple(&self) -> bool {
658+
pub(crate) fn has_tuple(&self) -> bool {
659659
self.target.arch.is_some() || self.target.os.is_some() || self.target.env.is_some()
660660
}
661661
}
@@ -1195,8 +1195,8 @@ async fn try_update_from_dist_(
11951195
}
11961196

11971197
for &target in targets {
1198-
let triple = TargetTuple::new(target);
1199-
all_components.insert(Component::new("rust-std".to_string(), Some(triple), false));
1198+
let tuple = TargetTuple::new(target);
1199+
all_components.insert(Component::new("rust-std".to_string(), Some(tuple), false));
12001200
}
12011201

12021202
let mut explicit_add_components: Vec<_> = all_components.into_iter().collect();
@@ -1457,7 +1457,7 @@ mod tests {
14571457
}
14581458

14591459
#[test]
1460-
fn compatible_host_triples() {
1460+
fn compatible_host_tuples() {
14611461
static CASES: &[(&str, &[&str], &[&str])] = &[
14621462
(
14631463
// 64bit linux

tests/suite/cli_rustup.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,21 +1599,21 @@ Default host: [HOST_TUPLE]
15991599

16001600
// #846
16011601
#[tokio::test]
1602-
async fn set_default_host_invalid_triple() {
1602+
async fn set_default_host_invalid_tuple() {
16031603
let cx = CliTestContext::new(Scenario::None).await;
16041604
cx.config
16051605
.expect(["rustup", "set", "default-host", "foo"])
16061606
.await
16071607
.with_stderr(snapbox::str![[r#"
1608-
error: Provided host 'foo' couldn't be converted to partial triple
1608+
error: Provided host 'foo' couldn't be converted to partial tuple
16091609
16101610
"#]])
16111611
.is_err();
16121612
}
16131613

16141614
// #745
16151615
#[tokio::test]
1616-
async fn set_default_host_invalid_triple_valid_partial() {
1616+
async fn set_default_host_invalid_tuple_valid_partial() {
16171617
let cx = CliTestContext::new(Scenario::None).await;
16181618
cx.config
16191619
.expect(["rustup", "set", "default-host", "x86_64-msvc"])

0 commit comments

Comments
 (0)