about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-08-27 02:07:26 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-09-30 21:59:35 +0300
commit349259d55f9b006fe871a26eaa2481b4103dc9d7 (patch)
treed8983834200de0cae04652c508dd1af72d1783c9 /src/libsyntax
parent22bc9e1d9ca49ee4f5cd953088ab09c238a6dd26 (diff)
downloadrust-349259d55f9b006fe871a26eaa2481b4103dc9d7.tar.gz
rust-349259d55f9b006fe871a26eaa2481b4103dc9d7.zip
Stabilize macros in `extern` blocks
Add some tests for macros in extern blocks, remove duplicate tests
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/expand.rs13
-rw-r--r--src/libsyntax/feature_gate/accepted.rs2
-rw-r--r--src/libsyntax/feature_gate/active.rs3
3 files changed, 3 insertions, 15 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 02e7c6775a4..cf8edf54673 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -555,15 +555,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
     }
 
     fn expand_invoc(&mut self, invoc: Invocation, ext: &SyntaxExtensionKind) -> AstFragment {
-        let (fragment_kind, span) = (invoc.fragment_kind, invoc.span());
-        if fragment_kind == AstFragmentKind::ForeignItems && !self.cx.ecfg.macros_in_extern() {
-            if let SyntaxExtensionKind::NonMacroAttr { .. } = ext {} else {
-                emit_feature_err(&self.cx.parse_sess, sym::macros_in_extern,
-                                 span, GateIssue::Language,
-                                 "macro invocations in `extern {}` blocks are experimental");
-            }
-        }
-
         if self.cx.current_expansion.depth > self.cx.ecfg.recursion_limit {
             let expn_data = self.cx.current_expansion.id.expn_data();
             let suggested_limit = self.cx.ecfg.recursion_limit * 2;
@@ -578,6 +569,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
             FatalError.raise();
         }
 
+        let (fragment_kind, span) = (invoc.fragment_kind, invoc.span());
         match invoc.kind {
             InvocationKind::Bang { mac, .. } => match ext {
                 SyntaxExtensionKind::Bang(expander) => {
@@ -1578,9 +1570,6 @@ impl<'feat> ExpansionConfig<'feat> {
         }
     }
 
-    fn macros_in_extern(&self) -> bool {
-        self.features.map_or(false, |features| features.macros_in_extern)
-    }
     fn proc_macro_hygiene(&self) -> bool {
         self.features.map_or(false, |features| features.proc_macro_hygiene)
     }
diff --git a/src/libsyntax/feature_gate/accepted.rs b/src/libsyntax/feature_gate/accepted.rs
index 5538daf388e..cda1ef1436c 100644
--- a/src/libsyntax/feature_gate/accepted.rs
+++ b/src/libsyntax/feature_gate/accepted.rs
@@ -245,6 +245,8 @@ declare_features! (
     (accepted, bind_by_move_pattern_guards, "1.39.0", Some(15287), None),
     /// Allows attributes in formal function parameters.
     (accepted, param_attrs, "1.39.0", Some(60406), None),
+    // Allows macro invocations in `extern {}` blocks.
+    (accepted, macros_in_extern, "1.40.0", Some(49476), None),
 
     // -------------------------------------------------------------------------
     // feature-group-end: accepted features
diff --git a/src/libsyntax/feature_gate/active.rs b/src/libsyntax/feature_gate/active.rs
index 38c16dbac6a..47ee41f0adc 100644
--- a/src/libsyntax/feature_gate/active.rs
+++ b/src/libsyntax/feature_gate/active.rs
@@ -402,9 +402,6 @@ declare_features! (
     /// Allows infering `'static` outlives requirements (RFC 2093).
     (active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),
 
-    /// Allows macro invocations in `extern {}` blocks.
-    (active, macros_in_extern, "1.27.0", Some(49476), None),
-
     /// Allows accessing fields of unions inside `const` functions.
     (active, const_fn_union, "1.27.0", Some(51909), None),