about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorMarvin Löbel <loebel.marvin@gmail.com>2015-11-24 14:56:20 +0100
committerMarvin Löbel <loebel.marvin@gmail.com>2015-11-26 21:47:44 +0100
commit296c3613ca7ed1117788f4e56259d2e426e992d7 (patch)
tree25125bcebe6195c2b1ae6509ef4586bf77fddcd9 /src/libsyntax/ext
parentc56b47ab8cd2906e30960f05d51855f9f7f5255b (diff)
downloadrust-296c3613ca7ed1117788f4e56259d2e426e992d7.tar.gz
rust-296c3613ca7ed1117788f4e56259d2e426e992d7.zip
Added stmt_expr_attribute feature gate
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/base.rs6
-rw-r--r--src/libsyntax/ext/cfg.rs10
-rw-r--r--src/libsyntax/ext/expand.rs6
3 files changed, 14 insertions, 8 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 8c93327c322..41a4fc9e1df 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -17,7 +17,7 @@ use codemap::{CodeMap, Span, ExpnId, ExpnInfo, NO_EXPANSION};
 use ext;
 use ext::expand;
 use ext::tt::macro_rules;
-use feature_gate::GatedCfg;
+use feature_gate::GatedCfgAttr;
 use parse;
 use parse::parser;
 use parse::token;
@@ -572,7 +572,7 @@ pub struct ExtCtxt<'a> {
     pub backtrace: ExpnId,
     pub ecfg: expand::ExpansionConfig<'a>,
     pub crate_root: Option<&'static str>,
-    pub feature_gated_cfgs: &'a mut Vec<GatedCfg>,
+    pub feature_gated_cfgs: &'a mut Vec<GatedCfgAttr>,
 
     pub mod_path: Vec<ast::Ident> ,
     pub exported_macros: Vec<ast::MacroDef>,
@@ -584,7 +584,7 @@ pub struct ExtCtxt<'a> {
 impl<'a> ExtCtxt<'a> {
     pub fn new(parse_sess: &'a parse::ParseSess, cfg: ast::CrateConfig,
                ecfg: expand::ExpansionConfig<'a>,
-               feature_gated_cfgs: &'a mut Vec<GatedCfg>) -> ExtCtxt<'a> {
+               feature_gated_cfgs: &'a mut Vec<GatedCfgAttr>) -> ExtCtxt<'a> {
         let env = initial_syntax_expander_table(&ecfg);
         ExtCtxt {
             parse_sess: parse_sess,
diff --git a/src/libsyntax/ext/cfg.rs b/src/libsyntax/ext/cfg.rs
index 48199026204..e100355e4f8 100644
--- a/src/libsyntax/ext/cfg.rs
+++ b/src/libsyntax/ext/cfg.rs
@@ -20,6 +20,7 @@ use ext::build::AstBuilder;
 use attr;
 use attr::*;
 use parse::token;
+use config::CfgDiagReal;
 
 pub fn expand_cfg<'cx>(cx: &mut ExtCtxt,
                        sp: Span,
@@ -33,7 +34,12 @@ pub fn expand_cfg<'cx>(cx: &mut ExtCtxt,
         return DummyResult::expr(sp);
     }
 
-    let matches_cfg = attr::cfg_matches(&cx.parse_sess.span_diagnostic, &cx.cfg, &cfg,
-                                        cx.feature_gated_cfgs);
+    let matches_cfg = {
+        let mut diag = CfgDiagReal {
+            diag: &cx.parse_sess.span_diagnostic,
+            feature_gated_cfgs: cx.feature_gated_cfgs,
+        };
+        attr::cfg_matches(&cx.cfg, &cfg, &mut diag)
+    };
     MacEager::expr(cx.expr_bool(sp, matches_cfg))
 }
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 908b2bd2429..1512cab9498 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -21,7 +21,7 @@ use attr::{AttrMetaMethods, WithAttrs};
 use codemap;
 use codemap::{Span, Spanned, ExpnInfo, NameAndSpan, MacroBang, MacroAttribute};
 use ext::base::*;
-use feature_gate::{self, Features, GatedCfg};
+use feature_gate::{self, Features, GatedCfgAttr};
 use fold;
 use fold::*;
 use util::move_map::MoveMap;
@@ -586,7 +586,7 @@ fn expand_non_macro_stmt(Spanned {node, span: stmt_span}: Stmt, fld: &mut MacroE
                         // also, don't forget to expand the init:
                         init: init.map(|e| fld.fold_expr(e)),
                         span: span,
-                        attrs: attrs
+                        attrs: fold::fold_thin_attrs(attrs, fld),
                     }
                 });
                 SmallVector::one(P(Spanned {
@@ -1280,7 +1280,7 @@ pub fn expand_crate<'feat>(parse_sess: &parse::ParseSess,
                            // these are the macros being imported to this crate:
                            imported_macros: Vec<ast::MacroDef>,
                            user_exts: Vec<NamedSyntaxExtension>,
-                           feature_gated_cfgs: &mut Vec<GatedCfg>,
+                           feature_gated_cfgs: &mut Vec<GatedCfgAttr>,
                            c: Crate) -> (Crate, HashSet<Name>) {
     let mut cx = ExtCtxt::new(parse_sess, c.config.clone(), cfg,
                               feature_gated_cfgs);