File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -1084,8 +1084,8 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
1084
1084
1085
1085
let mut changed_auto_active_status = None ;
1086
1086
1087
- // First we get all `doc(auto_cfg)` attributes.
1088
- for attr in attrs. clone ( ) {
1087
+ // We get all `doc(auto_cfg)`, `cfg` and `target_feature ` attributes.
1088
+ for attr in attrs {
1089
1089
if let Some ( ident) = attr. ident ( )
1090
1090
&& ident. name == sym:: doc
1091
1091
&& let Some ( attrs) = attr. meta_item_list ( )
@@ -1146,15 +1146,9 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
1146
1146
}
1147
1147
}
1148
1148
}
1149
- }
1150
- }
1151
-
1152
- // If there is no `doc(cfg())`, then we retrieve the `cfg()` attributes (because
1153
- // `doc(cfg())` overrides `cfg()`).
1154
- for attr in attrs {
1155
- if let hir:: Attribute :: Parsed ( AttributeKind :: TargetFeature { features, .. } ) = attr {
1156
- // treat #[target_feature(enable = "feat")] attributes as if they were
1157
- // #[doc(cfg(target_feature = "feat"))] attributes as well
1149
+ } else if let hir:: Attribute :: Parsed ( AttributeKind :: TargetFeature { features, .. } ) = attr {
1150
+ // Treat `#[target_feature(enable = "feat")]` attributes as if they were
1151
+ // `#[doc(cfg(target_feature = "feat"))]` attributes as well.
1158
1152
for ( feature, _) in features {
1159
1153
cfg_info. current_cfg &= Cfg :: Cfg ( sym:: target_feature, Some ( * feature) ) ;
1160
1154
}
You can’t perform that action at this time.
0 commit comments