about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustc_feature/active.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs
index 363621b3ca4..8794d830961 100644
--- a/src/librustc_feature/active.rs
+++ b/src/librustc_feature/active.rs
@@ -53,6 +53,18 @@ macro_rules! declare_features {
                 $(f(stringify!($feature), self.$feature);)+
             }
         }
+
+        impl std::ops::Index<Symbol> for Features {
+            type Output = bool;
+
+            fn index(&self, feature: Symbol) -> &Self::Output {
+                match feature {
+                    $( sym::$feature => &self.$feature, )*
+
+                    _ => panic!("{} was not defined in `declare_features`", feature),
+                }
+            }
+        }
     };
 }