Skip to content

Commit 3c1b60c

Browse files
committed
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.
1 parent 043a987 commit 3c1b60c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

compiler/rustc_feature/src/active.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,19 @@ enum FeatureStatus {
1414
Internal,
1515
}
1616

17-
macro_rules! declare_features {
18-
(__status_to_enum active) => {
17+
macro_rules! status_to_enum {
18+
(active) => {
1919
FeatureStatus::Default
2020
};
21-
(__status_to_enum incomplete) => {
21+
(incomplete) => {
2222
FeatureStatus::Incomplete
2323
};
24-
(__status_to_enum internal) => {
24+
(internal) => {
2525
FeatureStatus::Internal
2626
};
27+
}
28+
29+
macro_rules! declare_features {
2730
($(
2831
$(#[doc = $doc:tt])* ($status:ident, $feature:ident, $ver:expr, $issue:expr, $edition:expr),
2932
)+) => {
@@ -92,7 +95,7 @@ macro_rules! declare_features {
9295
pub fn incomplete(&self, feature: Symbol) -> bool {
9396
match feature {
9497
$(
95-
sym::$feature => declare_features!(__status_to_enum $status) == FeatureStatus::Incomplete,
98+
sym::$feature => status_to_enum!($status) == FeatureStatus::Incomplete,
9699
)*
97100
// accepted and removed features aren't in this file but are never incomplete
98101
_ if self.declared_lang_features.iter().any(|f| f.0 == feature) => false,
@@ -107,7 +110,7 @@ macro_rules! declare_features {
107110
pub fn internal(&self, feature: Symbol) -> bool {
108111
match feature {
109112
$(
110-
sym::$feature => declare_features!(__status_to_enum $status) == FeatureStatus::Internal,
113+
sym::$feature => status_to_enum!($status) == FeatureStatus::Internal,
111114
)*
112115
// accepted and removed features aren't in this file but are never internal
113116
// (a removed feature might have been internal, but it doesn't matter anymore)

0 commit comments

Comments
 (0)