@@ -576,7 +576,7 @@ 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)) ,
579+ Rust_builds :: Vector{RustBuild} = available_rust_builds,
580580 Go_build:: VersionNumber = maximum (getversion .(available_go_builds)),
581581 archive_type:: Symbol = (use_squashfs[] ? :squashfs : :unpacked ),
582582 bootstrap_list:: Vector{Symbol} = bootstrap_list,
@@ -586,6 +586,9 @@ 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)),
589592 )
590593
591594 function find_shard (name, version, archive_type; target = nothing )
@@ -654,6 +657,13 @@ function choose_shards(p::AbstractPlatform;
654657 end
655658
656659 if :rust in compilers
660+ # Make sure the selected Rust toolchain version is available
661+ if preferred_rust_version in getversion .(Rust_builds)
662+ Rust_build = preferred_rust_version
663+ else
664+ error (" Requested Rust toolchain $(preferred_rust_version) not available in $(Rust_builds) " )
665+ end
666+
657667 append! (shards, [
658668 find_shard (" RustBase" , Rust_build, archive_type),
659669 find_shard (" RustToolchain" , Rust_build, archive_type; target= p),
0 commit comments