From 5528a9cce8ec8f0dc6ff6ae7961ff67089a9a2cf Mon Sep 17 00:00:00 2001 From: Anup Dhamala Date: Mon, 27 Apr 2020 18:03:31 -0400 Subject: [PATCH] Try to install only available toolchains via rustup This prevents cross from erroring out and exiting when we have a custom target which we know will be available in the docker image (but is not one of the standard rustup targets). An example of such a target is "x86_64-alpine-linux-musl" which is a custom target that the alpine distro uses and is available when using rustc from its repositories. --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index aad231a42..421388fbd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -256,7 +256,10 @@ fn run() -> Result { } .unwrap_or_else(|| !target.is_builtin() || !available_targets.contains(&target)); - if !uses_xargo && !available_targets.is_installed(&target) { + if !uses_xargo + && !available_targets.is_installed(&target) + && available_targets.contains(&target) + { rustup::install(&target, &toolchain, verbose)?; } else if !rustup::component_is_installed("rust-src", &toolchain, verbose)? { rustup::install_component("rust-src", &toolchain, verbose)?;