11use std:: collections:: HashSet ;
22
3+ mod builtins_configure {
4+ include ! ( "../configure.rs" ) ;
5+ }
6+
37/// Features to enable
4- #[ derive( Debug , PartialEq , Eq , Hash ) ]
8+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
59enum Feature {
610 NoSysF128 ,
711 NoSysF128IntConvert ,
@@ -10,8 +14,16 @@ enum Feature {
1014 NoSysF16F128Convert ,
1115}
1216
13- mod builtins_configure {
14- include ! ( "../configure.rs" ) ;
17+ impl Feature {
18+ fn implies ( self ) -> & ' static [ Self ] {
19+ match self {
20+ Self :: NoSysF128 => [ Self :: NoSysF128IntConvert , Self :: NoSysF16F128Convert ] . as_slice ( ) ,
21+ Self :: NoSysF128IntConvert => [ ] . as_slice ( ) ,
22+ Self :: NoSysF16 => [ Self :: NoSysF16F64Convert , Self :: NoSysF16F128Convert ] . as_slice ( ) ,
23+ Self :: NoSysF16F64Convert => [ ] . as_slice ( ) ,
24+ Self :: NoSysF16F128Convert => [ ] . as_slice ( ) ,
25+ }
26+ }
1527}
1628
1729fn main ( ) {
@@ -40,8 +52,6 @@ fn main() {
4052 || target. arch == "powerpc64"
4153 {
4254 features. insert ( Feature :: NoSysF128 ) ;
43- features. insert ( Feature :: NoSysF128IntConvert ) ;
44- features. insert ( Feature :: NoSysF16F128Convert ) ;
4555 }
4656
4757 if target. arch == "x86" {
@@ -67,15 +77,22 @@ fn main() {
6777 || target. arch == "wasm64"
6878 {
6979 features. insert ( Feature :: NoSysF16 ) ;
70- features. insert ( Feature :: NoSysF16F64Convert ) ;
71- features. insert ( Feature :: NoSysF16F128Convert ) ;
7280 }
7381
7482 // These platforms are missing either `__extendhfdf2` or `__truncdfhf2`.
7583 if target. vendor == "apple" || target. os == "windows" {
7684 features. insert ( Feature :: NoSysF16F64Convert ) ;
7785 }
7886
87+ // Add implied features. Collection is required for borrows.
88+ features. extend (
89+ features
90+ . iter ( )
91+ . flat_map ( |x| x. implies ( ) )
92+ . copied ( )
93+ . collect :: < Vec < _ > > ( ) ,
94+ ) ;
95+
7996 for feature in features {
8097 let ( name, warning) = match feature {
8198 Feature :: NoSysF128 => ( "no-sys-f128" , "using apfloat fallback for f128" ) ,
0 commit comments