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