@@ -178,8 +178,9 @@ fn parse_rust_feature_flag<'a>(
178178 if let Some ( base_feature) = feature. strip_prefix ( '+' ) {
179179 callback ( base_feature, sess. target . implied_target_features ( base_feature) , true )
180180 } else if let Some ( base_feature) = feature. strip_prefix ( '-' ) {
181- // If `f1` implies `f2`, then `!f2` implies `!f1` -- this is standard logical contraposition.
182- // So we have to find all the reverse implications of `base_feature` and disable them, too.
181+ // If `f1` implies `f2`, then `!f2` implies `!f1` -- this is standard logical
182+ // contraposition. So we have to find all the reverse implications of `base_feature` and
183+ // disable them, too.
183184
184185 let inverse_implied_features = inverse_implied_features. get_or_insert_with ( || {
185186 let mut set: FxHashMap < & str , FxHashSet < & str > > = FxHashMap :: default ( ) ;
@@ -191,7 +192,7 @@ fn parse_rust_feature_flag<'a>(
191192 set
192193 } ) ;
193194
194- // Inverse mplied target features have their own inverse implied target features, so we
195+ // Inverse implied target features have their own inverse implied target features, so we
195196 // traverse the map until there are no more features to add.
196197 let mut features = FxHashSet :: default ( ) ;
197198 let mut new_features = vec ! [ base_feature] ;
@@ -214,8 +215,8 @@ fn parse_rust_feature_flag<'a>(
214215/// to populate `sess.unstable_target_features` and `sess.target_features` (these are the first and
215216/// 2nd component of the return value, respectively).
216217///
217- /// `target_base_has_feature` should check whether the given feature (a Rust feature name!) is enabled
218- /// in the "base" target machine, i.e., without applying `-Ctarget-feature`.
218+ /// `target_base_has_feature` should check whether the given feature (a Rust feature name!) is
219+ /// enabled in the "base" target machine, i.e., without applying `-Ctarget-feature`.
219220///
220221/// We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled elsewhere.
221222pub fn cfg_target_feature (
@@ -231,6 +232,8 @@ pub fn cfg_target_feature(
231232 . filter ( |( feature, _, _) | {
232233 // Skip checking special features, those are not known to the backend.
233234 if RUSTC_SPECIAL_FEATURES . contains ( feature) {
235+ // FIXME: `true` here means we'll always think the feature is enabled.
236+ // Does that really make sense?
234237 return true ;
235238 }
236239 target_base_has_feature ( feature)
@@ -241,7 +244,10 @@ pub fn cfg_target_feature(
241244 // Add enabled and remove disabled features.
242245 parse_rust_feature_flag (
243246 sess,
244- /* err_callback */ |_| { } ,
247+ /* err_callback */
248+ |_| {
249+ // Errors are already emitted in `flag_to_backend_features`; avoid duplicates.
250+ } ,
245251 |_base_feature, new_features, enabled| {
246252 // Iteration order is irrelevant since this only influences an `UnordSet`.
247253 #[ allow( rustc:: potential_query_instability) ]
@@ -339,8 +345,8 @@ pub fn flag_to_backend_features<'a, const N: usize>(
339345 let feature_state = known_features. iter ( ) . find ( |& & ( v, _, _) | v == base_feature) ;
340346 match feature_state {
341347 None => {
342- // This is definitely not a valid Rust feature name. Maybe it is a backend feature name?
343- // If so, give a better error message.
348+ // This is definitely not a valid Rust feature name. Maybe it is a backend
349+ // feature name? If so, give a better error message.
344350 let rust_feature =
345351 known_features. iter ( ) . find_map ( |& ( rust_feature, _, _) | {
346352 let backend_features = to_backend_features ( rust_feature) ;
@@ -452,7 +458,8 @@ pub(crate) fn provide(providers: &mut Providers) {
452458 Stability :: Unstable { .. } | Stability :: Forbidden { .. } ,
453459 )
454460 | ( Stability :: Forbidden { .. } , Stability :: Forbidden { .. } ) => {
455- // The stability in the entry is at least as good as the new one, just keep it.
461+ // The stability in the entry is at least as good as the new
462+ // one, just keep it.
456463 }
457464 _ => {
458465 // Overwrite stabilite.
0 commit comments