@@ -305,8 +305,6 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
305
305
///
306
306
/// We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled outside codegen.
307
307
pub ( crate ) fn target_features_cfg ( sess : & Session ) -> ( Vec < Symbol > , Vec < Symbol > ) {
308
- let mut features: FxHashSet < Symbol > = Default :: default ( ) ;
309
-
310
308
// Add base features for the target.
311
309
// We do *not* add the -Ctarget-features there, and instead duplicate the logic for that below.
312
310
// 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>)
316
314
let target_machine = create_informational_target_machine ( sess, true ) ;
317
315
// Compute which of the known target features are enabled in the 'base' target machine. We only
318
316
// 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 ;
338
335
}
339
- true
340
- } else {
341
- false
342
336
}
343
- } )
344
- . map ( |( feature, _, _) | Symbol :: intern ( feature) ) ,
345
- ) ;
337
+ true
338
+ } else {
339
+ false
340
+ }
341
+ } )
342
+ . map ( |( feature, _, _) | Symbol :: intern ( feature) )
343
+ . collect ( ) ;
346
344
347
345
// Add enabled and remove disabled features.
348
346
for ( enabled, feature) in
0 commit comments