about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-05 01:06:32 -0800
committerbors <bors@rust-lang.org>2014-02-05 01:06:32 -0800
commit53864ce5121b1b36679dfb901f85a98172cde19b (patch)
treea4593929efc7662840740cb47f9ee173f3240f06
parent1bcc73fe9d5bddb43816fd9a15303b784fbfa40f (diff)
parent124938bcf5381bf6e686dfe5741d2d411574acac (diff)
downloadrust-53864ce5121b1b36679dfb901f85a98172cde19b.tar.gz
rust-53864ce5121b1b36679dfb901f85a98172cde19b.zip
auto merge of #12025 : lilac/rust/feature-gate-quote, r=brson
Closes #11630.
-rw-r--r--src/librustc/front/feature_gate.rs20
-rw-r--r--src/librustc/lib.rs2
-rw-r--r--src/libsyntax/lib.rs2
-rw-r--r--src/test/auxiliary/macro_crate_test.rs2
-rw-r--r--src/test/compile-fail/qquote-1.rs1
-rw-r--r--src/test/compile-fail/qquote-2.rs1
-rw-r--r--src/test/run-pass-fulldeps/qquote.rs1
-rw-r--r--src/test/run-pass-fulldeps/quote-tokens.rs2
-rw-r--r--src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs2
9 files changed, 26 insertions, 7 deletions
diff --git a/src/librustc/front/feature_gate.rs b/src/librustc/front/feature_gate.rs
index ed4455c2f89..15056d9d2d8 100644
--- a/src/librustc/front/feature_gate.rs
+++ b/src/librustc/front/feature_gate.rs
@@ -49,6 +49,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
     ("trace_macros", Active),
     ("simd", Active),
     ("default_type_params", Active),
+    ("quote", Active),
 
     // These are used to test this portion of the compiler, they don't actually
     // mean anything
@@ -189,24 +190,35 @@ impl Visitor<()> for Context {
 
     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 path.segments.last().unwrap().identifier == self.sess.ident_of("macro_rules") {
+
+        if id == self.sess.ident_of("macro_rules") {
             self.gate_feature("macro_rules", path.span, "macro definitions are \
                 not stable enough for use and are subject to change");
         }
 
-        else if path.segments.last().unwrap().identifier == self.sess.ident_of("asm") {
+        else if id == self.sess.ident_of("asm") {
             self.gate_feature("asm", path.span, "inline assembly is not \
                 stable enough for use and is subject to change");
         }
 
-        else if path.segments.last().unwrap().identifier == self.sess.ident_of("log_syntax") {
+        else if id == self.sess.ident_of("log_syntax") {
             self.gate_feature("log_syntax", path.span, "`log_syntax!` is not \
                 stable enough for use and is subject to change");
         }
-        else if path.segments.last().unwrap().identifier == self.sess.ident_of("trace_macros") {
+        else if id == self.sess.ident_of("trace_macros") {
             self.gate_feature("trace_macros", path.span, "`trace_macros` is not \
                 stable enough for use and is subject to change");
+        } else {
+            for &quote in quotes.iter() {
+                if id == self.sess.ident_of(quote) {
+                  self.gate_feature("quote", path.span, quote + msg);
+                }
+            }
         }
     }
 
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 36f44c8870d..8e722fae13a 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -28,6 +28,8 @@ This API is completely unstable and subject to change.
       html_root_url = "http://static.rust-lang.org/doc/master")];
 
 #[feature(macro_rules, globs, struct_variant, managed_boxes)];
+#[allow(unknown_features)]; // Note: remove it after a snapshot.
+#[feature(quote)];
 
 extern mod extra;
 extern mod flate;
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index e2460b0171a..bcad19f2122 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -27,6 +27,8 @@ This API is completely unstable and subject to change.
       html_root_url = "http://static.rust-lang.org/doc/master")];
 
 #[feature(macro_rules, globs, managed_boxes)];
+#[allow(unknown_features)];// Note: remove it after a snapshot.
+#[feature(quote)];
 
 #[deny(non_camel_case_types)];
 
diff --git a/src/test/auxiliary/macro_crate_test.rs b/src/test/auxiliary/macro_crate_test.rs
index e5bf8574366..2867e0f8143 100644
--- a/src/test/auxiliary/macro_crate_test.rs
+++ b/src/test/auxiliary/macro_crate_test.rs
@@ -10,7 +10,7 @@
 
 // force-host
 
-#[feature(globs, macro_registrar, macro_rules)];
+#[feature(globs, macro_registrar, macro_rules, quote)];
 
 extern mod syntax;
 
diff --git a/src/test/compile-fail/qquote-1.rs b/src/test/compile-fail/qquote-1.rs
index f55fcfc204b..6dcbf3df9d6 100644
--- a/src/test/compile-fail/qquote-1.rs
+++ b/src/test/compile-fail/qquote-1.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // xfail-test Can't use syntax crate here
+#[feature(quote)];
 
 extern mod extra;
 extern mod syntax;
diff --git a/src/test/compile-fail/qquote-2.rs b/src/test/compile-fail/qquote-2.rs
index 262abc045a4..0e5c852fd6e 100644
--- a/src/test/compile-fail/qquote-2.rs
+++ b/src/test/compile-fail/qquote-2.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // xfail-test Can't use syntax crate here
+#[feature(quote)];
 
 extern mod extra;
 extern mod syntax;
diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs
index 05225eb0e7a..dc67ff21585 100644
--- a/src/test/run-pass-fulldeps/qquote.rs
+++ b/src/test/run-pass-fulldeps/qquote.rs
@@ -10,6 +10,7 @@
 
 // xfail-pretty
 // xfail-test
+#[feature(quote)];
 
 extern mod extra;
 extern mod syntax;
diff --git a/src/test/run-pass-fulldeps/quote-tokens.rs b/src/test/run-pass-fulldeps/quote-tokens.rs
index dc95faa1986..7429ac45904 100644
--- a/src/test/run-pass-fulldeps/quote-tokens.rs
+++ b/src/test/run-pass-fulldeps/quote-tokens.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // xfail-test
-
+#[feature(quote)];
 #[feature(managed_boxes)];
 
 extern mod syntax;
diff --git a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs
index a8b7dc3d382..0411c0b1cea 100644
--- a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs
+++ b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs
@@ -10,7 +10,7 @@
 
 // xfail-fast
 // xfail-android
-
+#[feature(quote)];
 #[deny(unused_variable)];
 
 extern mod syntax;