@@ -36,21 +36,21 @@ impl Features {
36
36
self . with_feature ( "c_compiler" ) . unwrap ( ) . insert ( "freestanding" ) ;
37
37
}
38
38
if let Some ( components) = self . with_feature ( "threading" ) {
39
- if !have_custom_threading && env_have_target_cfg ( "family" , "unix" ) {
39
+ if !have_custom_threading && env_have_target_family ( "unix" ) {
40
40
components. insert ( "pthread" ) ;
41
41
} else {
42
42
components. insert ( "custom" ) ;
43
43
}
44
44
}
45
45
if let Some ( components) = self . with_feature ( "std" ) {
46
- if env_have_target_cfg ( "family" , " unix") || env_have_target_cfg ( "family" , "windows" ) {
46
+ if env_have_target_family ( " unix") || env_have_target_family ( "windows" ) {
47
47
components. insert ( "net" ) ;
48
48
components. insert ( "fs" ) ;
49
49
components. insert ( "entropy" ) ;
50
50
}
51
51
}
52
52
if let Some ( components) = self . with_feature ( "time" ) {
53
- if !have_custom_gmtime_r && ( env_have_target_cfg ( "family" , " unix") || env_have_target_cfg ( "family" , "windows" ) ) {
53
+ if !have_custom_gmtime_r && ( env_have_target_family ( " unix") || env_have_target_family ( "windows" ) ) {
54
54
components. insert ( "libc" ) ;
55
55
} else {
56
56
components. insert ( "custom" ) ;
@@ -100,6 +100,10 @@ fn env_have_target_cfg(var: &'static str, value: &'static str) -> bool {
100
100
env:: var_os ( env) . map_or ( false , |s| s == value)
101
101
}
102
102
103
+ fn env_have_target_family ( value : & ' static str ) -> bool {
104
+ env:: var ( "CARGO_CFG_TARGET_FAMILY" ) . map_or ( false , |var| var. split ( "," ) . any ( |s| s == value) )
105
+ }
106
+
103
107
fn env_have_feature ( feature : & ' static str ) -> bool {
104
108
let env = format ! ( "CARGO_FEATURE_{}" , feature) . to_uppercase ( ) . replace ( "-" , "_" ) ;
105
109
env:: var_os ( env) . is_some ( )
0 commit comments