@@ -313,11 +313,11 @@ pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<S
313313 // We do *not* add the -Ctarget-features there, and instead duplicate the logic for that below.
314314 // The reason is that if LLVM considers a feature implied but we do not, we don't want that to
315315 // 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.
318318 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.
321321 features. extend (
322322 sess. target
323323 . rust_target_features ( )
@@ -343,7 +343,7 @@ pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<S
343343 . map ( |( feature, _, _) | Symbol :: intern ( feature) ) ,
344344 ) ;
345345
346- // Add enabled features
346+ // Add enabled and remove disabled features.
347347 for ( enabled, feature) in
348348 sess. opts . cg . target_feature . split ( ',' ) . filter_map ( |s| match s. chars ( ) . next ( ) {
349349 Some ( '+' ) => Some ( ( true , Symbol :: intern ( & s[ 1 ..] ) ) ) ,
@@ -397,13 +397,12 @@ pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<S
397397 if allow_unstable
398398 || ( gate. in_cfg ( ) && ( sess. is_nightly_build ( ) || gate. requires_nightly ( ) . is_none ( ) ) )
399399 {
400- Some ( * feature)
400+ Some ( Symbol :: intern ( feature) )
401401 } else {
402402 None
403403 }
404404 } )
405- . filter ( |feature| features. contains ( & Symbol :: intern ( feature) ) )
406- . map ( |feature| Symbol :: intern ( feature) )
405+ . filter ( |feature| features. contains ( & feature) )
407406 . collect ( )
408407}
409408
0 commit comments