@@ -29,10 +29,11 @@ impl<'tcx> LibFeatureCollector<'tcx> {
29
29
}
30
30
31
31
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] ;
33
34
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(…)] .
36
37
if let Some ( stab_attr) = stab_attrs. iter ( ) . find ( |stab_attr| attr. has_name ( * * stab_attr) ) {
37
38
let meta_kind = attr. meta_kind ( ) ;
38
39
if let Some ( MetaItemKind :: List ( ref metas) ) = meta_kind {
@@ -52,7 +53,9 @@ impl<'tcx> LibFeatureCollector<'tcx> {
52
53
// This additional check for stability is to make sure we
53
54
// don't emit additional, irrelevant errors for malformed
54
55
// 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 {
56
59
return Some ( ( feature, since, attr. span ) ) ;
57
60
}
58
61
}
0 commit comments