about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate.rs
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2018-02-14 16:11:02 +0100
committerMichael Woerister <michaelwoerister@posteo>2018-03-05 11:05:01 +0100
commit542bc75deaaf4e84dcd7a196685bc1a1cb100d32 (patch)
treeaf895d8de41f2569ac3235ab8b244e2853dfe54c /src/libsyntax/feature_gate.rs
parente2746d870017c869b84fc56ecd63f5e4f9646c96 (diff)
downloadrust-542bc75deaaf4e84dcd7a196685bc1a1cb100d32.tar.gz
rust-542bc75deaaf4e84dcd7a196685bc1a1cb100d32.zip
Turn features() into a query.
Diffstat (limited to 'src/libsyntax/feature_gate.rs')
-rw-r--r--src/libsyntax/feature_gate.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 058df1d5169..45d82bc7af3 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -62,6 +62,7 @@ macro_rules! declare_features {
             &[$((stringify!($feature), $ver, $issue, set!($feature))),+];
 
         /// A set of features to be used by later passes.
+        #[derive(Clone)]
         pub struct Features {
             /// `#![feature]` attrs for stable language features, for error reporting
             pub declared_stable_lang_features: Vec<(Symbol, Span)>,
@@ -78,6 +79,12 @@ macro_rules! declare_features {
                     $($feature: false),+
                 }
             }
+
+            pub fn walk_feature_fields<F>(&self, mut f: F)
+                where F: FnMut(&str, bool)
+            {
+                $(f(stringify!($feature), self.$feature);)+
+            }
         }
     };