This commit is contained in:
Zanie Blue 2025-07-06 21:08:25 +02:00 committed by GitHub
commit 4a9ef295c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -163,14 +163,30 @@ impl Arch {
// TODO: Implement `variant` support checks
// Windows ARM64 runs emulated x86_64 binaries transparently
// Similarly, macOS aarch64 runs emulated x86_64 binaries transparently if you have Rosetta
if cfg!(windows) {
match (self.family, other.family) {
// Windows aarch64 runs emulated x86_64 binaries transparently
(
target_lexicon::Architecture::Aarch64(_),
target_lexicon::Architecture::X86_64,
)
// Windows x86_64 runs emulated x86_32 binaries transparently
| (target_lexicon::Architecture::X86_64, target_lexicon::Architecture::X86_32(_)) => {
return true
}
_ => {}
}
} else if cfg!(target_os = "macos") {
match (self.family, other.family) {
// macOS aarch64 runs emulated x86_64 binaries transparently if you have Rosetta
// installed. We don't try to be clever and check if that's the case here, we just assume
// that if x86_64 distributions are available, they're usable.
if (cfg!(windows) || cfg!(target_os = "macos"))
&& matches!(self.family, target_lexicon::Architecture::Aarch64(_))
{
return other.family == target_lexicon::Architecture::X86_64;
(
target_lexicon::Architecture::Aarch64(_),
target_lexicon::Architecture::X86_64,
) => return true,
_ => {}
}
}
false