@@ -18,14 +18,9 @@ use syn::fold::Fold;
18
18
use syn:: spanned:: Spanned ;
19
19
use syn:: { Token , LitFloat , Ident , Item , Field , Variant , Attribute } ;
20
20
21
- const FEATURES_ENV : & str = env ! ( "INKWELL_FEATURES" ) ;
22
-
23
- /// Fetches a vector of feature version strings, e.g. llvm8-0
24
- fn get_feature_versions ( ) -> Vec < & ' static str > {
25
- FEATURES_ENV
26
- . split ( ',' )
27
- . collect ( )
28
- }
21
+ // This array should match the LLVM features in the top level Cargo manifest
22
+ const FEATURE_VERSIONS : [ & str ; 9 ] =
23
+ [ "llvm3-6" , "llvm3-7" , "llvm3-8" , "llvm3-9" , "llvm4-0" , "llvm5-0" , "llvm6-0" , "llvm7-0" , "llvm8-0" ] ;
29
24
30
25
/// Gets the index of the feature version that represents `latest`
31
26
fn get_latest_feature_index ( features : & [ & str ] ) -> usize {
@@ -43,7 +38,7 @@ fn get_feature_index(features: &[&str], feature: String, span: Span) -> Result<u
43
38
44
39
/// Gets a vector of feature versions represented by the given VersionType
45
40
fn get_features ( vt : VersionType ) -> Result < Vec < & ' static str > > {
46
- let features = get_feature_versions ( ) ;
41
+ let features = FEATURE_VERSIONS ;
47
42
let latest = get_latest_feature_index ( & features) ;
48
43
match vt {
49
44
VersionType :: Specific ( version, span) => {
@@ -189,7 +184,7 @@ struct FeatureSet(Vec<&'static str>, Option<Error>);
189
184
impl Default for FeatureSet {
190
185
fn default ( ) -> Self {
191
186
// Default to all versions
192
- Self ( get_feature_versions ( ) , None )
187
+ Self ( FEATURE_VERSIONS . to_vec ( ) , None )
193
188
}
194
189
}
195
190
impl Parse for FeatureSet {
0 commit comments