File tree 1 file changed +8
-10
lines changed
1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -113,17 +113,15 @@ pub fn to_llvm_feature(s: &str) -> &str {
113
113
}
114
114
115
115
pub fn target_features ( sess : & Session ) -> Vec < Symbol > {
116
- let whitelist = target_feature_whitelist ( sess) ;
117
116
let target_machine = create_target_machine ( sess) ;
118
- let mut features = Vec :: new ( ) ;
119
- for feature in whitelist {
120
- let llvm_feature = to_llvm_feature ( feature) ;
121
- let ptr = CString :: new ( llvm_feature) . as_ptr ( ) ;
122
- if unsafe { llvm:: LLVMRustHasFeature ( target_machine, ptr) } {
123
- features. push ( Symbol :: intern ( feature) ) ;
124
- }
125
- }
126
- features
117
+ target_feature_whitelist ( sess)
118
+ . iter ( )
119
+ . filter ( |feature| {
120
+ let llvm_feature = to_llvm_feature ( feature) ;
121
+ let ptr = CString :: new ( llvm_feature) . as_ptr ( ) ;
122
+ unsafe { llvm:: LLVMRustHasFeature ( target_machine, ptr) }
123
+ } )
124
+ . map ( Symbol :: intern) . collect ( )
127
125
}
128
126
129
127
pub fn target_feature_whitelist ( sess : & Session ) -> & ' static [ & ' static str ] {
You can’t perform that action at this time.
0 commit comments