@@ -297,7 +297,7 @@ pub(crate) fn check_tied_features(
297
297
/// Used to generate cfg variables and apply features
298
298
/// Must express features in the way Rust understands them
299
299
pub fn target_features ( sess : & Session , allow_unstable : bool ) -> Vec < Symbol > {
300
- let mut features = vec ! [ ] ;
300
+ let mut features: FxHashSet < Symbol > = Default :: default ( ) ;
301
301
302
302
// Add base features for the target.
303
303
// We do *not* add the -Ctarget-features there, and instead duplicate the logic for that below.
@@ -306,7 +306,7 @@ pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
306
306
// the target CPU, that is still expanded to target features (with all their implied features) by
307
307
// LLVM.
308
308
let target_machine = create_informational_target_machine ( sess, true ) ;
309
- // Compute which of the known target features are enables in the 'base' target machine.
309
+ // Compute which of the known target features are enabled in the 'base' target machine.
310
310
features. extend (
311
311
sess. target
312
312
. known_target_features ( )
@@ -343,9 +343,12 @@ pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
343
343
if enabled {
344
344
features. extend ( sess. target . implied_target_features ( std:: iter:: once ( feature) ) ) ;
345
345
} else {
346
- features. retain ( |f| {
347
- !sess. target . implied_target_features ( std:: iter:: once ( * f) ) . contains ( & feature)
348
- } ) ;
346
+ // We don't care about the order in `features` since the only thing we use it for is the
347
+ // `features.contains` below.
348
+ #[ allow( rustc:: potential_query_instability) ]
349
+ for feature_to_remove in sess. target . implied_target_features ( std:: iter:: once ( feature) ) {
350
+ features. remove ( & feature_to_remove) ;
351
+ }
349
352
}
350
353
}
351
354
0 commit comments