@@ -22,7 +22,7 @@ use std::{
2222
2323pub use target_lexicon:: Triple ;
2424
25- use target_lexicon:: { Environment , OperatingSystem } ;
25+ use target_lexicon:: { Architecture , Environment , OperatingSystem } ;
2626
2727use crate :: {
2828 bail, ensure,
@@ -944,7 +944,9 @@ impl CrossCompileConfig {
944944
945945 // Not cross-compiling to compile for 32-bit Python from windows 64-bit
946946 compatible |= target. operating_system == OperatingSystem :: Windows
947- && host. operating_system == OperatingSystem :: Windows ;
947+ && host. operating_system == OperatingSystem :: Windows
948+ && matches ! ( target. architecture, Architecture :: X86_32 ( _) )
949+ && host. architecture == Architecture :: X86_64 ;
948950
949951 // Not cross-compiling to compile for x86-64 Python from macOS arm64 and vice versa
950952 compatible |= target. operating_system == OperatingSystem :: Darwin
@@ -2955,6 +2957,16 @@ mod tests {
29552957 . is_none( ) ) ;
29562958 }
29572959
2960+ #[ test]
2961+ fn test_is_cross_compiling_from_to ( ) {
2962+ assert ! ( cross_compiling_from_to(
2963+ & triple!( "x86_64-pc-windows-msvc" ) ,
2964+ & triple!( "aarch64-pc-windows-msvc" )
2965+ )
2966+ . unwrap( )
2967+ . is_some( ) ) ;
2968+ }
2969+
29582970 #[ test]
29592971 fn test_run_python_script ( ) {
29602972 // as above, this should be okay in CI where Python is presumed installed
0 commit comments