Skip to content

Commit 9015a51

Browse files
committed
Collect features from #[rustc_default_body_unstable]
1 parent 177af47 commit 9015a51

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

compiler/rustc_passes/src/lib_features.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@ impl<'tcx> LibFeatureCollector<'tcx> {
2929
}
3030

3131
fn extract(&self, attr: &Attribute) -> Option<(Symbol, Option<Symbol>, Span)> {
32-
let stab_attrs =
33-
[sym::stable, sym::unstable, sym::rustc_const_stable, sym::rustc_const_unstable];
32+
let stab_attrs = [
33+
sym::stable,
34+
sym::unstable,
35+
sym::rustc_const_stable,
36+
sym::rustc_const_unstable,
37+
sym::rustc_default_body_unstable,
38+
];
3439

3540
// Find a stability attribute: one of #[stable(…)], #[unstable(…)],
36-
// #[rustc_const_stable(…)], or #[rustc_const_unstable(…)].
41+
// #[rustc_const_stable(…)], #[rustc_const_unstable(…)] or #[rustc_default_body_unstable].
3742
if let Some(stab_attr) = stab_attrs.iter().find(|stab_attr| attr.has_name(**stab_attr)) {
3843
let meta_kind = attr.meta_kind();
3944
if let Some(MetaItemKind::List(ref metas)) = meta_kind {
@@ -53,8 +58,12 @@ impl<'tcx> LibFeatureCollector<'tcx> {
5358
// This additional check for stability is to make sure we
5459
// don't emit additional, irrelevant errors for malformed
5560
// attributes.
56-
let is_unstable =
57-
matches!(*stab_attr, sym::unstable | sym::rustc_const_unstable);
61+
let is_unstable = matches!(
62+
*stab_attr,
63+
sym::unstable
64+
| sym::rustc_const_unstable
65+
| sym::rustc_default_body_unstable
66+
);
5867
if since.is_some() || is_unstable {
5968
return Some((feature, since, attr.span));
6069
}

0 commit comments

Comments
 (0)