@@ -576,8 +576,8 @@ function choose_shards(p::AbstractPlatform;
576576 ps_build:: VersionNumber = v " 2024.08.10" ,
577577 GCC_builds:: Vector{GCCBuild} = available_gcc_builds,
578578 LLVM_builds:: Vector{LLVMBuild} = available_llvm_builds,
579- Rust_build :: VersionNumber = maximum ( getversion .( available_rust_builds)) ,
580- Go_build :: VersionNumber = maximum ( getversion .( available_go_builds)) ,
579+ Rust_builds :: Vector{RustBuild} = available_rust_builds,
580+ Go_builds :: Vector{GoBuild} = available_go_builds,
581581 archive_type:: Symbol = (use_squashfs[] ? :squashfs : :unpacked ),
582582 bootstrap_list:: Vector{Symbol} = bootstrap_list,
583583 # Because GCC has lots of compatibility issues, we always default to
@@ -586,6 +586,11 @@ function choose_shards(p::AbstractPlatform;
586586 # Because LLVM doesn't have compatibility issues, we always default
587587 # to the newest version possible.
588588 preferred_llvm_version:: VersionNumber = getversion (LLVM_builds[end ]),
589+ # Rust can have compatibility issues between versions, but by default choose
590+ # the newest one.
591+ preferred_rust_version:: VersionNumber = maximum (getversion .(Rust_builds)),
592+ # Always default to the latest Go version
593+ preferred_go_version:: VersionNumber = maximum (getversion .(Go_builds)),
589594 )
590595
591596 function find_shard (name, version, archive_type; target = nothing )
@@ -654,9 +659,23 @@ function choose_shards(p::AbstractPlatform;
654659 end
655660
656661 if :rust in compilers
662+ # Make sure the selected Rust toolchain version is available
663+ if preferred_rust_version in getversion .(Rust_builds)
664+ Rust_build = preferred_rust_version
665+ else
666+ error (" Requested Rust toolchain $(preferred_rust_version) not available in $(Rust_builds) " )
667+ end
668+
669+ base_shard = find_shard (" RustBase" , Rust_build, archive_type)
670+ toolchain_shard = find_shard (" RustToolchain" , Rust_build, archive_type; target= p)
671+
672+ if isnothing (toolchain_shard)
673+ error (" Requested Rust toolchain $(preferred_rust_version) not available on platform $(triplet (p)) " )
674+ end
675+
657676 append! (shards, [
658- find_shard ( " RustBase " , Rust_build, archive_type) ,
659- find_shard ( " RustToolchain " , Rust_build, archive_type; target = p) ,
677+ base_shard ,
678+ toolchain_shard ,
660679 ])
661680
662681 if ! platforms_match (p, default_host_platform)
@@ -677,6 +696,13 @@ function choose_shards(p::AbstractPlatform;
677696 end
678697
679698 if :go in compilers
699+ # Make sure the selected Go toolchain version is available
700+ if preferred_go_version in getversion .(Go_builds)
701+ Go_build = preferred_go_version
702+ else
703+ error (" Requested Go toolchain $(preferred_go_version) not available in $(Go_builds) " )
704+ end
705+
680706 push! (shards, find_shard (" Go" , Go_build, archive_type))
681707 end
682708 else
0 commit comments