From fc1b908322a5a2ebf8aa599d7178accdd3cbaed9 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Fri, 26 Sep 2014 17:14:23 -0700 Subject: Hide the quote_*! macros when the feature gate is off This makes it easier to experiment with improved quasiquoting as an ordinary plugin library. The list of quote macros in feature_gate.rs was already out of sync; this commit also prevents that problem in the future. --- src/libsyntax/feature_gate.rs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'src/libsyntax/feature_gate.rs') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index cd0fa184a09..1c6ee8acc94 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -102,6 +102,7 @@ pub struct Features { pub rustc_diagnostic_macros: bool, pub import_shadowing: bool, pub visible_private_types: bool, + pub quote: bool, } impl Features { @@ -112,6 +113,7 @@ impl Features { rustc_diagnostic_macros: false, import_shadowing: false, visible_private_types: false, + quote: false, } } } @@ -282,10 +284,6 @@ impl<'a, 'v> Visitor<'v> for Context<'a> { fn visit_mac(&mut self, macro: &ast::Mac) { let ast::MacInvocTT(ref path, _, _) = macro.node; let id = path.segments.last().unwrap().identifier; - let quotes = ["quote_tokens", "quote_expr", "quote_ty", - "quote_item", "quote_pat", "quote_stmt"]; - let msg = " is not stable enough for use and are subject to change"; - if id == token::str_to_ident("macro_rules") { self.gate_feature("macro_rules", path.span, "macro definitions are \ @@ -311,16 +309,6 @@ impl<'a, 'v> Visitor<'v> for Context<'a> { self.gate_feature("concat_idents", path.span, "`concat_idents` is not \ stable enough for use and is subject to change"); } - - else { - for "e in quotes.iter() { - if id == token::str_to_ident(quote) { - self.gate_feature("quote", - path.span, - format!("{}{}", quote, msg).as_slice()); - } - } - } } fn visit_foreign_item(&mut self, i: &ast::ForeignItem) { @@ -483,6 +471,7 @@ pub fn check_crate(span_handler: &SpanHandler, krate: &ast::Crate) -> (Features, rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"), import_shadowing: cx.has_feature("import_shadowing"), visible_private_types: cx.has_feature("visible_private_types"), + quote: cx.has_feature("quote"), }, unknown_features) } -- cgit 1.4.1-3-g733a5