Handle rustc_const_stable attribute in library feature collector
This commit is contained in:
parent
bd1a8692f6
commit
5d30180634
1 changed files with 7 additions and 4 deletions
|
@ -29,10 +29,11 @@ impl<'tcx> LibFeatureCollector<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extract(&self, attr: &Attribute) -> Option<(Symbol, Option<Symbol>, Span)> {
|
fn extract(&self, attr: &Attribute) -> Option<(Symbol, Option<Symbol>, Span)> {
|
||||||
let stab_attrs = [sym::stable, sym::unstable, sym::rustc_const_unstable];
|
let stab_attrs =
|
||||||
|
[sym::stable, sym::unstable, sym::rustc_const_stable, sym::rustc_const_unstable];
|
||||||
|
|
||||||
// Find a stability attribute (i.e., `#[stable (..)]`, `#[unstable (..)]`,
|
// Find a stability attribute: one of #[stable(…)], #[unstable(…)],
|
||||||
// `#[rustc_const_unstable (..)]`).
|
// #[rustc_const_stable(…)], or #[rustc_const_unstable(…)].
|
||||||
if let Some(stab_attr) = stab_attrs.iter().find(|stab_attr| attr.has_name(**stab_attr)) {
|
if let Some(stab_attr) = stab_attrs.iter().find(|stab_attr| attr.has_name(**stab_attr)) {
|
||||||
let meta_kind = attr.meta_kind();
|
let meta_kind = attr.meta_kind();
|
||||||
if let Some(MetaItemKind::List(ref metas)) = meta_kind {
|
if let Some(MetaItemKind::List(ref metas)) = meta_kind {
|
||||||
|
@ -52,7 +53,9 @@ impl<'tcx> LibFeatureCollector<'tcx> {
|
||||||
// This additional check for stability is to make sure we
|
// This additional check for stability is to make sure we
|
||||||
// don't emit additional, irrelevant errors for malformed
|
// don't emit additional, irrelevant errors for malformed
|
||||||
// attributes.
|
// attributes.
|
||||||
if *stab_attr != sym::stable || since.is_some() {
|
let is_unstable =
|
||||||
|
matches!(*stab_attr, sym::unstable | sym::rustc_const_unstable);
|
||||||
|
if since.is_some() || is_unstable {
|
||||||
return Some((feature, since, attr.span));
|
return Some((feature, since, attr.span));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue