Skip to content

Commit

Permalink
Try to install only available toolchains via rustup
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anupdhml committed Jun 4, 2020
1 parent aeaf3f1 commit 5528a9c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ fn run() -> Result<ExitStatus> {
}
.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)?;
Expand Down

0 comments on commit 5528a9c

Please sign in to comment.