diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-10-04 10:00:30 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-10-05 10:23:20 +1100 |
| commit | 3c1b60c1b44b7a6e322982c5e19c0dc5e628680c (patch) | |
| tree | 539b473cde099933e884dd43da973ad6c0353dc1 | |
| parent | 043a9873b9ca6671744cf29c5cd0fe04c54e9032 (diff) | |
| download | rust-3c1b60c1b44b7a6e322982c5e19c0dc5e628680c.tar.gz rust-3c1b60c1b44b7a6e322982c5e19c0dc5e628680c.zip | |
Split `declare_features!`.
It's a macro with four clauses, three of which are doing one thing, and the fourth is doing something completely different. This commit splits it into two macros, which is more sensible.
| -rw-r--r-- | compiler/rustc_feature/src/active.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index c5a25347893..3acc7308e8d 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -14,16 +14,19 @@ enum FeatureStatus { Internal, } -macro_rules! declare_features { - (__status_to_enum active) => { +macro_rules! status_to_enum { + (active) => { FeatureStatus::Default }; - (__status_to_enum incomplete) => { + (incomplete) => { FeatureStatus::Incomplete }; - (__status_to_enum internal) => { + (internal) => { FeatureStatus::Internal }; +} + +macro_rules! declare_features { ($( $(#[doc = $doc:tt])* ($status:ident, $feature:ident, $ver:expr, $issue:expr, $edition:expr), )+) => { @@ -92,7 +95,7 @@ macro_rules! declare_features { pub fn incomplete(&self, feature: Symbol) -> bool { match feature { $( - sym::$feature => declare_features!(__status_to_enum $status) == FeatureStatus::Incomplete, + sym::$feature => status_to_enum!($status) == FeatureStatus::Incomplete, )* // accepted and removed features aren't in this file but are never incomplete _ if self.declared_lang_features.iter().any(|f| f.0 == feature) => false, @@ -107,7 +110,7 @@ macro_rules! declare_features { pub fn internal(&self, feature: Symbol) -> bool { match feature { $( - sym::$feature => declare_features!(__status_to_enum $status) == FeatureStatus::Internal, + sym::$feature => status_to_enum!($status) == FeatureStatus::Internal, )* // accepted and removed features aren't in this file but are never internal // (a removed feature might have been internal, but it doesn't matter anymore) |
