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