about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-03-02 14:53:46 -0500
committerGitHub <noreply@github.com>2017-03-02 14:53:46 -0500
commitc883f4f584bf55ec3c3d0bbd22957a7e6654e3b9 (patch)
tree4f88f98fa7272576b878096fd4045c332599a4be /src/libsyntax
parent0536fd6396133189fb4a41377d3972cd312078a0 (diff)
parent2fcbb48c727e82ea8751d6476d86fd3c6fe16b42 (diff)
downloadrust-c883f4f584bf55ec3c3d0bbd22957a7e6654e3b9.tar.gz
rust-c883f4f584bf55ec3c3d0bbd22957a7e6654e3b9.zip
Rollup merge of #40129 - abonander:proc_macro_bang, r=jseyfried
Implement function-like procedural macros ( `#[proc_macro]`)

Adds the `#[proc_macro]` attribute, which expects bare functions of the kind `fn(TokenStream) -> TokenStream`, which can be invoked like `my_macro!()`.

cc rust-lang/rfcs#1913, #38356

r? @jseyfried
cc @nrc
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index e4256ff1c84..6eb7d449f26 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -774,6 +774,11 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
                                            "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))),
+
     ("rustc_derive_registrar", Normal, Gated(Stability::Unstable,
                                              "rustc_derive_registrar",
                                              "used internally by rustc",