about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2019-10-31 18:35:41 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2019-10-31 19:08:12 +0200
commitada4a6430d7bcfb542b0c0fa6a43c9dd3291f2ff (patch)
treed725b924fe940c3d03121d0f2a12050a73fbffc7
parent680089c2d906ac33e4ae16a184fce12b610af434 (diff)
downloadrust-ada4a6430d7bcfb542b0c0fa6a43c9dd3291f2ff.tar.gz
rust-ada4a6430d7bcfb542b0c0fa6a43c9dd3291f2ff.zip
Revert "pre-expansion gate decl_macro"
This reverts commit 1f470ceac2202ecffe8a15acc1139edb9ad4a03b.
-rw-r--r--src/libsyntax/feature_gate/check.rs5
-rw-r--r--src/test/ui/feature-gates/feature-gate-decl_macro.rs4
-rw-r--r--src/test/ui/feature-gates/feature-gate-decl_macro.stderr11
3 files changed, 6 insertions, 14 deletions
diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs
index 33dfe386a4d..bcafb9e03ff 100644
--- a/src/libsyntax/feature_gate/check.rs
+++ b/src/libsyntax/feature_gate/check.rs
@@ -443,6 +443,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                                    "auto traits are experimental and possibly buggy");
             }
 
+            ast::ItemKind::MacroDef(ast::MacroDef { legacy: false, .. }) => {
+                let msg = "`macro` is experimental";
+                gate_feature_post!(&self, decl_macro, i.span, msg);
+            }
+
             ast::ItemKind::OpaqueTy(..) => {
                 gate_feature_post!(
                     &self,
diff --git a/src/test/ui/feature-gates/feature-gate-decl_macro.rs b/src/test/ui/feature-gates/feature-gate-decl_macro.rs
index b208a047481..d002c5dbbd2 100644
--- a/src/test/ui/feature-gates/feature-gate-decl_macro.rs
+++ b/src/test/ui/feature-gates/feature-gate-decl_macro.rs
@@ -2,8 +2,4 @@
 
 macro m() {} //~ ERROR `macro` is experimental
 
-macro_rules! accept_item { ($i:item) => {} }
-accept_item! {
-    macro m() {} //~ ERROR `macro` is experimental
-}
 fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-decl_macro.stderr b/src/test/ui/feature-gates/feature-gate-decl_macro.stderr
index c6690ebd4d9..905a1b15310 100644
--- a/src/test/ui/feature-gates/feature-gate-decl_macro.stderr
+++ b/src/test/ui/feature-gates/feature-gate-decl_macro.stderr
@@ -7,15 +7,6 @@ LL | macro m() {}
    = note: for more information, see https://github.com/rust-lang/rust/issues/39412
    = help: add `#![feature(decl_macro)]` to the crate attributes to enable
 
-error[E0658]: `macro` is experimental
-  --> $DIR/feature-gate-decl_macro.rs:7:5
-   |
-LL |     macro m() {}
-   |     ^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/39412
-   = help: add `#![feature(decl_macro)]` to the crate attributes to enable
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0658`.