@@ -24,21 +24,31 @@ fn minos(file: &str, version: &str) {
2424
2525fn main ( ) {
2626 // These versions should generally be higher than the default versions
27- let ( env_var , example_version, higher_example_version) = match apple_os ( ) {
28- "macos" => ( "MACOSX_DEPLOYMENT_TARGET" , " 12.0", "13.0" ) ,
27+ let ( example_version, higher_example_version) = match apple_os ( ) {
28+ "macos" => ( "12.0" , "13.0" ) ,
2929 // armv7s-apple-ios and i386-apple-ios only supports iOS 10.0
30- "ios" if target ( ) == "armv7s-apple-ios" || target ( ) == "i386-apple-ios" => {
31- ( "IPHONEOS_DEPLOYMENT_TARGET" , "10.0" , "10.0" )
32- }
33- "ios" => ( "IPHONEOS_DEPLOYMENT_TARGET" , "15.0" , "16.0" ) ,
34- "watchos" => ( "WATCHOS_DEPLOYMENT_TARGET" , "7.0" , "9.0" ) ,
35- "tvos" => ( "TVOS_DEPLOYMENT_TARGET" , "14.0" , "15.0" ) ,
36- "visionos" => ( "XROS_DEPLOYMENT_TARGET" , "1.1" , "1.2" ) ,
30+ "ios" if target ( ) == "armv7s-apple-ios" || target ( ) == "i386-apple-ios" => ( "10.0" , "10.0" ) ,
31+ "ios" => ( "15.0" , "16.0" ) ,
32+ "watchos" => ( "7.0" , "9.0" ) ,
33+ "tvos" => ( "14.0" , "15.0" ) ,
34+ "visionos" => ( "1.1" , "1.2" ) ,
3735 _ => unreachable ! ( ) ,
3836 } ;
39- let default_version =
40- rustc ( ) . target ( target ( ) ) . env_remove ( env_var) . print ( "deployment-target" ) . run ( ) . stdout_utf8 ( ) ;
41- let default_version = default_version. strip_prefix ( "deployment_target=" ) . unwrap ( ) . trim ( ) ;
37+
38+ // Remove env vars to get `rustc`'s default
39+ let output = rustc ( )
40+ . target ( target ( ) )
41+ . env_remove ( "MACOSX_DEPLOYMENT_TARGET" )
42+ . env_remove ( "IPHONEOS_DEPLOYMENT_TARGET" )
43+ . env_remove ( "WATCHOS_DEPLOYMENT_TARGET" )
44+ . env_remove ( "TVOS_DEPLOYMENT_TARGET" )
45+ . env_remove ( "XROS_DEPLOYMENT_TARGET" )
46+ . print ( "deployment-target" )
47+ . run ( )
48+ . stdout_utf8 ( ) ;
49+ let ( env_var, default_version) = output. split_once ( '=' ) . unwrap ( ) ;
50+ let env_var = env_var. trim ( ) ;
51+ let default_version = default_version. trim ( ) ;
4252
4353 // Test that version makes it to the object file.
4454 run_in_tmpdir ( || {
0 commit comments