@@ -29,10 +29,11 @@ impl<'tcx> LibFeatureCollector<'tcx> {
2929 }
3030
3131 fn extract ( & self , attr : & Attribute ) -> Option < ( Symbol , Option < Symbol > , Span ) > {
32- let stab_attrs = [ sym:: stable, sym:: unstable, sym:: rustc_const_unstable] ;
32+ let stab_attrs =
33+ [ sym:: stable, sym:: unstable, sym:: rustc_const_stable, sym:: rustc_const_unstable] ;
3334
34- // Find a stability attribute (i.e., ` #[stable (..)]`, ` #[unstable (..)]` ,
35- // `#[rustc_const_unstable (..)]`) .
35+ // Find a stability attribute: one of #[stable(…)], #[unstable(…)] ,
36+ // #[rustc_const_stable(…)], or #[rustc_const_unstable(…)] .
3637 if let Some ( stab_attr) = stab_attrs. iter ( ) . find ( |stab_attr| attr. has_name ( * * stab_attr) ) {
3738 let meta_kind = attr. meta_kind ( ) ;
3839 if let Some ( MetaItemKind :: List ( ref metas) ) = meta_kind {
@@ -52,7 +53,9 @@ impl<'tcx> LibFeatureCollector<'tcx> {
5253 // This additional check for stability is to make sure we
5354 // don't emit additional, irrelevant errors for malformed
5455 // attributes.
55- if * stab_attr != sym:: stable || since. is_some ( ) {
56+ let is_unstable =
57+ matches ! ( * stab_attr, sym:: unstable | sym:: rustc_const_unstable) ;
58+ if since. is_some ( ) || is_unstable {
5659 return Some ( ( feature, since, attr. span ) ) ;
5760 }
5861 }
0 commit comments