@@ -311,11 +311,11 @@ pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<S
311
311
// We do *not* add the -Ctarget-features there, and instead duplicate the logic for that below.
312
312
// The reason is that if LLVM considers a feature implied but we do not, we don't want that to
313
313
// show up in `cfg`. That way, `cfg` is entirely under our control -- except for the handling of
314
- // the target CPU, that is still expanded to target features (with all their implied features) by
315
- // LLVM.
314
+ // the target CPU, that is still expanded to target features (with all their implied features)
315
+ // by LLVM.
316
316
let target_machine = create_informational_target_machine ( sess, true ) ;
317
- // Compute which of the known target features are enabled in the 'base' target machine.
318
- // We only consider "supported" features; "forbidden" features are not reflected in `cfg` as of now.
317
+ // Compute which of the known target features are enabled in the 'base' target machine. We only
318
+ // consider "supported" features; "forbidden" features are not reflected in `cfg` as of now.
319
319
features. extend (
320
320
sess. target
321
321
. rust_target_features ( )
@@ -341,7 +341,7 @@ pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<S
341
341
. map ( |( feature, _, _) | Symbol :: intern ( feature) ) ,
342
342
) ;
343
343
344
- // Add enabled features
344
+ // Add enabled and remove disabled features.
345
345
for ( enabled, feature) in
346
346
sess. opts . cg . target_feature . split ( ',' ) . filter_map ( |s| match s. chars ( ) . next ( ) {
347
347
Some ( '+' ) => Some ( ( true , Symbol :: intern ( & s[ 1 ..] ) ) ) ,
@@ -395,13 +395,12 @@ pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<S
395
395
if allow_unstable
396
396
|| ( gate. in_cfg ( ) && ( sess. is_nightly_build ( ) || gate. requires_nightly ( ) . is_none ( ) ) )
397
397
{
398
- Some ( * feature)
398
+ Some ( Symbol :: intern ( feature) )
399
399
} else {
400
400
None
401
401
}
402
402
} )
403
- . filter ( |feature| features. contains ( & Symbol :: intern ( feature) ) )
404
- . map ( |feature| Symbol :: intern ( feature) )
403
+ . filter ( |feature| features. contains ( & feature) )
405
404
. collect ( )
406
405
}
407
406
0 commit comments