From b51538b224b29e032d324cf3773cd2cf1ca8d885 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 17 Sep 2026 17:09:58 +0200 Subject: [PATCH 1/4] refactor(dist): move missing host toolchain error to a case in `DistError` --- src/dist/manifest.rs | 5 ++--- src/dist/mod.rs | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dist/manifest.rs b/src/dist/manifest.rs index 93f124e6af..4423f91d30 100644 --- a/src/dist/manifest.rs +++ b/src/dist/manifest.rs @@ -23,7 +23,7 @@ use anyhow::{Context, anyhow, bail}; use serde::{Deserialize, Serialize}; use crate::{ - dist::{Profile, TargetTuple, ToolchainDesc, config::Config}, + dist::{DistError, Profile, TargetTuple, ToolchainDesc, config::Config}, errors::RustupError, toolchain::DistributableToolchain, }; @@ -513,8 +513,7 @@ impl Package { if let Some(t) = target { tpkgs .get(t) - .ok_or_else(|| anyhow!(format!("target '{t}' not found in channel. \ - Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets"))) + .ok_or_else(|| DistError::HostTupleUnsupported(t.clone()).into()) } else { Err(anyhow!("no target specified")) } diff --git a/src/dist/mod.rs b/src/dist/mod.rs index 0bad59dd1d..18152112b6 100644 --- a/src/dist/mod.rs +++ b/src/dist/mod.rs @@ -123,6 +123,10 @@ pub enum DistError { MissingReleaseForToolchain(String), #[error("invalid toolchain name: '{0}'")] InvalidOfficialName(String), + #[error( + "target '{0}' not found in channel. Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets" + )] + HostTupleUnsupported(TargetTuple), } #[derive(Debug, PartialEq)] From db0c9382c66f2278e7b98efc50eeaf4af53dc2ea Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 17 Sep 2026 18:17:46 +0200 Subject: [PATCH 2/4] fix(dist): refine message of `DistError::HostTupleUnsupported` --- src/dist/mod.rs | 4 +++- tests/suite/cli_rustup.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dist/mod.rs b/src/dist/mod.rs index 18152112b6..30f04259bf 100644 --- a/src/dist/mod.rs +++ b/src/dist/mod.rs @@ -124,7 +124,9 @@ pub enum DistError { #[error("invalid toolchain name: '{0}'")] InvalidOfficialName(String), #[error( - "target '{0}' not found in channel. Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets" + "host tuple '{0}' not found in channel manifest +help: this could mean that it has been demoted and no longer has a host toolchain +help: see for available targets" )] HostTupleUnsupported(TargetTuple), } diff --git a/tests/suite/cli_rustup.rs b/tests/suite/cli_rustup.rs index 459a0b21d6..7d4ca8a5ba 100644 --- a/tests/suite/cli_rustup.rs +++ b/tests/suite/cli_rustup.rs @@ -4114,7 +4114,9 @@ async fn check_host_goes_away() { .await .with_stderr(snapbox::str![[r#" ... -error: target '[HOST_TUPLE]' not found in channel[..] +error: host tuple '[HOST_TUPLE]' not found in channel manifest +help: this could mean that it has been demoted and no longer has a host toolchain +help: see for available targets ... "#]]) .is_err(); From ae4e4155fcf1c5eb7e4c113554e581b1e2fcfb9d Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 17 Sep 2026 17:34:12 +0200 Subject: [PATCH 3/4] refactor(dist): reduce rightward drift --- src/dist/mod.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/dist/mod.rs b/src/dist/mod.rs index 30f04259bf..00dd8600fb 100644 --- a/src/dist/mod.rs +++ b/src/dist/mod.rs @@ -1080,14 +1080,12 @@ impl<'cfg, 'a> DistOptions<'cfg, 'a> { backtrack_limit = backtrack_limit.map(|n| n - 1); } - Some(DistError::MissingReleaseForToolchain(..)) => { - // no need to even print anything for missing nightlies, - // since we don't really "skip" them - } - _ => { - // All other errors break the loop - break Err(e); - } + // no need to even print anything for missing nightlies, + // since we don't really "skip" them + Some(DistError::MissingReleaseForToolchain(..)) => (), + + // All other errors break the loop + _ => break Err(e), }; if let Some(backtrack_limit) = backtrack_limit From fee254dc4a0a0698ccf481a26b7f282b0e262e17 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 17 Sep 2026 17:34:12 +0200 Subject: [PATCH 4/4] fix(dist): add `DistError::HostTupleUnsupported` to nightly backtracking flow --- src/dist/mod.rs | 4 ++++ tests/suite/cli_rustup.rs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dist/mod.rs b/src/dist/mod.rs index 00dd8600fb..774cecc624 100644 --- a/src/dist/mod.rs +++ b/src/dist/mod.rs @@ -1080,6 +1080,10 @@ impl<'cfg, 'a> DistOptions<'cfg, 'a> { backtrack_limit = backtrack_limit.map(|n| n - 1); } + Some(e @ DistError::HostTupleUnsupported(_)) => { + info!("skipping nightly with unsupported host: {e:#}") + } + // no need to even print anything for missing nightlies, // since we don't really "skip" them Some(DistError::MissingReleaseForToolchain(..)) => (), diff --git a/tests/suite/cli_rustup.rs b/tests/suite/cli_rustup.rs index 7d4ca8a5ba..0dc27db6cd 100644 --- a/tests/suite/cli_rustup.rs +++ b/tests/suite/cli_rustup.rs @@ -4114,12 +4114,12 @@ async fn check_host_goes_away() { .await .with_stderr(snapbox::str![[r#" ... -error: host tuple '[HOST_TUPLE]' not found in channel manifest +info: skipping nightly with unsupported host: host tuple '[HOST_TUPLE]' not found in channel manifest help: this could mean that it has been demoted and no longer has a host toolchain help: see for available targets ... "#]]) - .is_err(); + .is_ok(); } #[cfg(unix)]