about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/expand.rs8
-rw-r--r--src/libsyntax/feature_gate.rs37
2 files changed, 15 insertions, 30 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 281ebaff272..1241e230b26 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1073,7 +1073,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
                 return attrs;
             }
 
-            if self.cx.ecfg.proc_macro_enabled() {
+            if self.cx.ecfg.use_extern_macros_enabled() {
                 attr = find_attr_invoc(&mut attrs);
             }
             traits = collect_derives(&mut self.cx, &mut attrs);
@@ -1096,7 +1096,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
                 return attrs;
             }
 
-            if self.cx.ecfg.proc_macro_enabled() {
+            if self.cx.ecfg.use_extern_macros_enabled() {
                 attr = find_attr_invoc(&mut attrs);
             }
             attrs
@@ -1406,7 +1406,7 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> {
                          foreign_item: ast::ForeignItem) -> SmallVector<ast::ForeignItem> {
         let (attr, traits, foreign_item) = self.classify_item(foreign_item);
 
-        let explain = if self.cx.ecfg.proc_macro_enabled() {
+        let explain = if self.cx.ecfg.use_extern_macros_enabled() {
             feature_gate::EXPLAIN_PROC_MACROS_IN_EXTERN
         } else {
             feature_gate::EXPLAIN_MACROS_IN_EXTERN
@@ -1592,7 +1592,7 @@ impl<'feat> ExpansionConfig<'feat> {
         fn enable_trace_macros = trace_macros,
         fn enable_allow_internal_unstable = allow_internal_unstable,
         fn enable_custom_derive = custom_derive,
-        fn proc_macro_enabled = proc_macro,
+        fn use_extern_macros_enabled = use_extern_macros,
         fn macros_in_extern_enabled = macros_in_extern,
         fn proc_macro_mod = proc_macro_mod,
         fn proc_macro_gen = proc_macro_gen,
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index f033c5006c5..1a73096505f 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -39,13 +39,6 @@ use symbol::{keywords, Symbol};
 use std::{env, path};
 
 macro_rules! set {
-    (proc_macro) => {{
-        fn f(features: &mut Features, span: Span) {
-            features.declared_lib_features.push((Symbol::intern("proc_macro"), span));
-            features.proc_macro = true;
-        }
-        f as fn(&mut Features, Span)
-    }};
     ($field: ident) => {{
         fn f(features: &mut Features, _: Span) {
             features.$field = true;
@@ -303,9 +296,6 @@ declare_features! (
     // rustc internal
     (active, abi_unadjusted, "1.16.0", None, None),
 
-    // Procedural macros 2.0.
-    (active, proc_macro, "1.16.0", Some(38356), Some(Edition::Edition2018)),
-
     // Declarative macros 2.0 (`macro`).
     (active, decl_macro, "1.17.0", Some(39412), None),
 
@@ -626,6 +616,8 @@ declare_features! (
     (accepted, global_allocator, "1.28.0", Some(27389), None),
     // Allows `#[repr(transparent)]` attribute on newtype structs
     (accepted, repr_transparent, "1.28.0", Some(43036), None),
+    // Defining procedural macros in `proc-macro` crates
+    (accepted, proc_macro, "1.29.0", Some(38356), None),
 );
 
 // If you change this, please modify src/doc/unstable-book as well. You must
@@ -1033,15 +1025,8 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
 
     ("windows_subsystem", Whitelisted, Ungated),
 
-    ("proc_macro_attribute", Normal, Gated(Stability::Unstable,
-                                           "proc_macro",
-                                           "attribute proc macros are currently unstable",
-                                           cfg_fn!(proc_macro))),
-
-    ("proc_macro", Normal, Gated(Stability::Unstable,
-                                 "proc_macro",
-                                 "function-like proc macros are currently unstable",
-                                 cfg_fn!(proc_macro))),
+    ("proc_macro_attribute", Normal, Ungated),
+    ("proc_macro", Normal, Ungated),
 
     ("rustc_derive_registrar", Normal, Gated(Stability::Unstable,
                                              "rustc_derive_registrar",
@@ -1542,7 +1527,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
             }
         }
 
-        if self.context.features.proc_macro && attr::is_known(attr) {
+        if self.context.features.use_extern_macros && attr::is_known(attr) {
             return
         }
 
@@ -1990,7 +1975,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
 /// A collector for mutually exclusive and interdependent features and their flag spans.
 #[derive(Default)]
 struct FeatureChecker {
-    proc_macro: Option<Span>,
+    use_extern_macros: Option<Span>,
     custom_attribute: Option<Span>,
 }
 
@@ -1999,9 +1984,9 @@ impl FeatureChecker {
     // the branching can be eliminated by modifying `set!()` to set these spans
     // only for the features that need to be checked for mutual exclusion.
     fn collect(&mut self, features: &Features, span: Span) {
-        if features.proc_macro {
-            // If self.proc_macro is None, set to Some(span)
-            self.proc_macro = self.proc_macro.or(Some(span));
+        if features.use_extern_macros {
+            // If self.use_extern_macros is None, set to Some(span)
+            self.use_extern_macros = self.use_extern_macros.or(Some(span));
         }
 
         if features.custom_attribute {
@@ -2010,8 +1995,8 @@ impl FeatureChecker {
     }
 
     fn check(self, handler: &Handler) {
-        if let (Some(pm_span), Some(ca_span)) = (self.proc_macro, self.custom_attribute) {
-            handler.struct_span_err(pm_span, "Cannot use `#![feature(proc_macro)]` and \
+        if let (Some(pm_span), Some(ca_span)) = (self.use_extern_macros, self.custom_attribute) {
+            handler.struct_span_err(pm_span, "Cannot use `#![feature(use_extern_macros)]` and \
                                               `#![feature(custom_attribute)] at the same time")
                 .span_note(ca_span, "`#![feature(custom_attribute)]` declared here")
                 .emit();