@@ -305,8 +305,6 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
305305///
306306/// We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled outside codegen.
307307pub ( crate ) fn target_features_cfg ( sess : & Session ) -> ( Vec < Symbol > , Vec < Symbol > ) {
308- let mut features: FxHashSet < Symbol > = Default :: default ( ) ;
309-
310308 // Add base features for the target.
311309 // We do *not* add the -Ctarget-features there, and instead duplicate the logic for that below.
312310 // The reason is that if LLVM considers a feature implied but we do not, we don't want that to
@@ -316,33 +314,33 @@ pub(crate) fn target_features_cfg(sess: &Session) -> (Vec<Symbol>, Vec<Symbol>)
316314 let target_machine = create_informational_target_machine ( sess, true ) ;
317315 // Compute which of the known target features are enabled in the 'base' target machine. We only
318316 // consider "supported" features; "forbidden" features are not reflected in `cfg` as of now.
319- features. extend (
320- sess. target
321- . rust_target_features ( )
322- . iter ( )
323- . filter ( |( feature, _, _) | {
324- // skip checking special features, as LLVM may not understand them
325- if RUSTC_SPECIAL_FEATURES . contains ( feature) {
326- return true ;
327- }
328- // check that all features in a given smallvec are enabled
329- if let Some ( feat) = to_llvm_features ( sess, feature) {
330- for llvm_feature in feat {
331- let cstr = SmallCStr :: new ( llvm_feature) ;
332- // `LLVMRustHasFeature` is moderately expensive. On targets with many
333- // features (e.g. x86) these calls take a non-trivial fraction of runtime
334- // when compiling very small programs.
335- if !unsafe { llvm:: LLVMRustHasFeature ( & target_machine, cstr. as_ptr ( ) ) } {
336- return false ;
337- }
317+ let mut features: FxHashSet < Symbol > = sess
318+ . target
319+ . rust_target_features ( )
320+ . iter ( )
321+ . filter ( |( feature, _, _) | {
322+ // skip checking special features, as LLVM may not understand them
323+ if RUSTC_SPECIAL_FEATURES . contains ( feature) {
324+ return true ;
325+ }
326+ // check that all features in a given smallvec are enabled
327+ if let Some ( feat) = to_llvm_features ( sess, feature) {
328+ for llvm_feature in feat {
329+ let cstr = SmallCStr :: new ( llvm_feature) ;
330+ // `LLVMRustHasFeature` is moderately expensive. On targets with many
331+ // features (e.g. x86) these calls take a non-trivial fraction of runtime
332+ // when compiling very small programs.
333+ if !unsafe { llvm:: LLVMRustHasFeature ( & target_machine, cstr. as_ptr ( ) ) } {
334+ return false ;
338335 }
339- true
340- } else {
341- false
342336 }
343- } )
344- . map ( |( feature, _, _) | Symbol :: intern ( feature) ) ,
345- ) ;
337+ true
338+ } else {
339+ false
340+ }
341+ } )
342+ . map ( |( feature, _, _) | Symbol :: intern ( feature) )
343+ . collect ( ) ;
346344
347345 // Add enabled and remove disabled features.
348346 for ( enabled, feature) in
0 commit comments