about summary refs log tree commit diff
path: root/src/libsyntax_ext
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-10-03 09:49:39 -0700
committerAlex Crichton <alex@alexcrichton.com>2016-10-06 11:07:23 -0700
commit2148bdfcc7ea7b9614d8cbe596cbe7bb75b57cd1 (patch)
tree4a88c4f26d3a898cb9ac26aa6a06fd074253d5a3 /src/libsyntax_ext
parent7a26aeca77bcf334747eddb630e3b9475149b7f5 (diff)
downloadrust-2148bdfcc7ea7b9614d8cbe596cbe7bb75b57cd1.tar.gz
rust-2148bdfcc7ea7b9614d8cbe596cbe7bb75b57cd1.zip
rustc: Rename rustc_macro to proc_macro
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`,
which reflects the general consensus of #35900. A follow up PR to Cargo will be
required to purge the `rustc-macro` name as well.
Diffstat (limited to 'src/libsyntax_ext')
-rw-r--r--src/libsyntax_ext/Cargo.toml2
-rw-r--r--src/libsyntax_ext/deriving/custom.rs2
-rw-r--r--src/libsyntax_ext/lib.rs8
-rw-r--r--src/libsyntax_ext/proc_macro_registrar.rs (renamed from src/libsyntax_ext/rustc_macro_registrar.rs)60
4 files changed, 36 insertions, 36 deletions
diff --git a/src/libsyntax_ext/Cargo.toml b/src/libsyntax_ext/Cargo.toml
index 6910e6400d4..960db792a62 100644
--- a/src/libsyntax_ext/Cargo.toml
+++ b/src/libsyntax_ext/Cargo.toml
@@ -11,7 +11,7 @@ crate-type = ["dylib"]
 [dependencies]
 fmt_macros = { path = "../libfmt_macros" }
 log = { path = "../liblog" }
+proc_macro = { path = "../libproc_macro" }
 rustc_errors = { path = "../librustc_errors" }
-rustc_macro = { path = "../librustc_macro" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
diff --git a/src/libsyntax_ext/deriving/custom.rs b/src/libsyntax_ext/deriving/custom.rs
index 624fabd1424..f8cb1294a66 100644
--- a/src/libsyntax_ext/deriving/custom.rs
+++ b/src/libsyntax_ext/deriving/custom.rs
@@ -11,7 +11,7 @@
 use std::panic;
 
 use errors::FatalError;
-use rustc_macro::{TokenStream, __internal};
+use proc_macro::{TokenStream, __internal};
 use syntax::ast::{self, ItemKind};
 use syntax::codemap::{ExpnInfo, MacroAttribute, NameAndSpan, Span};
 use syntax::ext::base::*;
diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs
index 6e4f3dde4bd..e9d2c0a503b 100644
--- a/src/libsyntax_ext/lib.rs
+++ b/src/libsyntax_ext/lib.rs
@@ -20,8 +20,8 @@
 #![cfg_attr(not(stage0), deny(warnings))]
 
 #![feature(dotdot_in_tuple_patterns)]
-#![feature(rustc_macro_lib)]
-#![feature(rustc_macro_internals)]
+#![feature(proc_macro_lib)]
+#![feature(proc_macro_internals)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 
@@ -31,7 +31,7 @@ extern crate log;
 #[macro_use]
 extern crate syntax;
 extern crate syntax_pos;
-extern crate rustc_macro;
+extern crate proc_macro;
 extern crate rustc_errors as errors;
 
 mod asm;
@@ -43,7 +43,7 @@ mod format;
 mod log_syntax;
 mod trace_macros;
 
-pub mod rustc_macro_registrar;
+pub mod proc_macro_registrar;
 
 // for custom_derive
 pub mod deriving;
diff --git a/src/libsyntax_ext/rustc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_registrar.rs
index ce3e53cdf97..b96fb08e59e 100644
--- a/src/libsyntax_ext/rustc_macro_registrar.rs
+++ b/src/libsyntax_ext/proc_macro_registrar.rs
@@ -36,45 +36,45 @@ struct CollectCustomDerives<'a> {
     derives: Vec<CustomDerive>,
     in_root: bool,
     handler: &'a errors::Handler,
-    is_rustc_macro_crate: bool,
+    is_proc_macro_crate: bool,
 }
 
 pub fn modify(sess: &ParseSess,
               resolver: &mut ::syntax::ext::base::Resolver,
               mut krate: ast::Crate,
-              is_rustc_macro_crate: bool,
+              is_proc_macro_crate: bool,
               num_crate_types: usize,
               handler: &errors::Handler,
               features: &Features) -> ast::Crate {
-    let ecfg = ExpansionConfig::default("rustc_macro".to_string());
+    let ecfg = ExpansionConfig::default("proc_macro".to_string());
     let mut cx = ExtCtxt::new(sess, Vec::new(), ecfg, resolver);
 
     let mut collect = CollectCustomDerives {
         derives: Vec::new(),
         in_root: true,
         handler: handler,
-        is_rustc_macro_crate: is_rustc_macro_crate,
+        is_proc_macro_crate: is_proc_macro_crate,
     };
     visit::walk_crate(&mut collect, &krate);
 
-    if !is_rustc_macro_crate {
+    if !is_proc_macro_crate {
         return krate
-    } else if !features.rustc_macro {
-        let mut err = handler.struct_err("the `rustc-macro` crate type is \
+    } else if !features.proc_macro {
+        let mut err = handler.struct_err("the `proc-macro` crate type is \
                                           experimental");
-        err.help("add #![feature(rustc_macro)] to the crate attributes to \
+        err.help("add #![feature(proc_macro)] to the crate attributes to \
                   enable");
         err.emit();
     }
 
     if num_crate_types > 1 {
-        handler.err("cannot mix `rustc-macro` crate type with others");
+        handler.err("cannot mix `proc-macro` crate type with others");
     }
 
     krate.module.items.push(mk_registrar(&mut cx, &collect.derives));
 
     if krate.exported_macros.len() > 0 {
-        handler.err("cannot export macro_rules! macros from a `rustc-macro` \
+        handler.err("cannot export macro_rules! macros from a `proc-macro` \
                      crate type currently");
     }
 
@@ -83,13 +83,13 @@ pub fn modify(sess: &ParseSess,
 
 impl<'a> CollectCustomDerives<'a> {
     fn check_not_pub_in_root(&self, vis: &ast::Visibility, sp: Span) {
-        if self.is_rustc_macro_crate &&
+        if self.is_proc_macro_crate &&
            self.in_root &&
            *vis == ast::Visibility::Public {
             self.handler.span_err(sp,
-                                  "`rustc-macro` crate types cannot \
+                                  "`proc-macro` crate types cannot \
                                    export any items other than functions \
-                                   tagged with `#[rustc_macro_derive]` \
+                                   tagged with `#[proc_macro_derive]` \
                                    currently");
         }
     }
@@ -100,7 +100,7 @@ impl<'a> Visitor for CollectCustomDerives<'a> {
         // First up, make sure we're checking a bare function. If we're not then
         // we're just not interested in this item.
         //
-        // If we find one, try to locate a `#[rustc_macro_derive]` attribute on
+        // If we find one, try to locate a `#[proc_macro_derive]` attribute on
         // it.
         match item.node {
             ast::ItemKind::Fn(..) => {}
@@ -111,7 +111,7 @@ impl<'a> Visitor for CollectCustomDerives<'a> {
         }
 
         let mut attrs = item.attrs.iter()
-                            .filter(|a| a.check_name("rustc_macro_derive"));
+                            .filter(|a| a.check_name("proc_macro_derive"));
         let attr = match attrs.next() {
             Some(attr) => attr,
             None => {
@@ -121,25 +121,25 @@ impl<'a> Visitor for CollectCustomDerives<'a> {
         };
 
         if let Some(a) = attrs.next() {
-            self.handler.span_err(a.span(), "multiple `#[rustc_macro_derive]` \
+            self.handler.span_err(a.span(), "multiple `#[proc_macro_derive]` \
                                              attributes found");
         }
 
-        if !self.is_rustc_macro_crate {
+        if !self.is_proc_macro_crate {
             self.handler.span_err(attr.span(),
-                                  "the `#[rustc_macro_derive]` attribute is \
-                                   only usable with crates of the `rustc-macro` \
+                                  "the `#[proc_macro_derive]` attribute is \
+                                   only usable with crates of the `proc-macro` \
                                    crate type");
         }
 
-        // Once we've located the `#[rustc_macro_derive]` attribute, verify
-        // that it's of the form `#[rustc_macro_derive(Foo)]`
+        // Once we've located the `#[proc_macro_derive]` attribute, verify
+        // that it's of the form `#[proc_macro_derive(Foo)]`
         let list = match attr.meta_item_list() {
             Some(list) => list,
             None => {
                 self.handler.span_err(attr.span(),
                                       "attribute must be of form: \
-                                       #[rustc_macro_derive(TraitName)]");
+                                       #[proc_macro_derive(TraitName)]");
                 return
             }
         };
@@ -177,7 +177,7 @@ impl<'a> Visitor for CollectCustomDerives<'a> {
                 function_name: item.ident,
             });
         } else {
-            let msg = "functions tagged with `#[rustc_macro_derive]` must \
+            let msg = "functions tagged with `#[proc_macro_derive]` must \
                        currently reside in the root of the crate";
             self.handler.span_err(item.span, msg);
         }
@@ -202,9 +202,9 @@ impl<'a> Visitor for CollectCustomDerives<'a> {
 // Creates a new module which looks like:
 //
 //      mod $gensym {
-//          extern crate rustc_macro;
+//          extern crate proc_macro;
 //
-//          use rustc_macro::__internal::Registry;
+//          use proc_macro::__internal::Registry;
 //
 //          #[plugin_registrar]
 //          fn registrar(registrar: &mut Registry) {
@@ -218,16 +218,16 @@ fn mk_registrar(cx: &mut ExtCtxt,
     let eid = cx.codemap().record_expansion(ExpnInfo {
         call_site: DUMMY_SP,
         callee: NameAndSpan {
-            format: MacroAttribute(token::intern("rustc_macro")),
+            format: MacroAttribute(token::intern("proc_macro")),
             span: None,
             allow_internal_unstable: true,
         }
     });
     let span = Span { expn_id: eid, ..DUMMY_SP };
 
-    let rustc_macro = token::str_to_ident("rustc_macro");
+    let proc_macro = token::str_to_ident("proc_macro");
     let krate = cx.item(span,
-                        rustc_macro,
+                        proc_macro,
                         Vec::new(),
                         ast::ItemKind::ExternCrate(None));
 
@@ -241,7 +241,7 @@ fn mk_registrar(cx: &mut ExtCtxt,
         (path, trait_name)
     }).map(|(path, trait_name)| {
         let registrar = cx.expr_ident(span, registrar);
-        let ufcs_path = cx.path(span, vec![rustc_macro, __internal, registry,
+        let ufcs_path = cx.path(span, vec![proc_macro, __internal, registry,
                                            register_custom_derive]);
         cx.expr_call(span,
                      cx.expr_path(ufcs_path),
@@ -250,7 +250,7 @@ fn mk_registrar(cx: &mut ExtCtxt,
         cx.stmt_expr(expr)
     }).collect::<Vec<_>>();
 
-    let path = cx.path(span, vec![rustc_macro, __internal, registry]);
+    let path = cx.path(span, vec![proc_macro, __internal, registry]);
     let registrar_path = cx.ty_path(path);
     let arg_ty = cx.ty_rptr(span, registrar_path, None, ast::Mutability::Mutable);
     let func = cx.item_fn(span,