about summary refs log tree commit diff
path: root/src/librustc/middle
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-11-05 20:30:40 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-11-10 11:19:34 +0000
commit0a998b86e977912dfabd4fddb3c7efe87accf2c2 (patch)
tree317c4bdf9d17873a49bc449fa7217273c2a6e7b0 /src/librustc/middle
parentad5345239850a6d9f16ad30e7f2d220ac1c0ae9d (diff)
downloadrust-0a998b86e977912dfabd4fddb3c7efe87accf2c2.tar.gz
rust-0a998b86e977912dfabd4fddb3c7efe87accf2c2.zip
Support `#[macro_reexport]`ing custom derives.
Diffstat (limited to 'src/librustc/middle')
-rw-r--r--src/librustc/middle/cstore.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs
index db3c7d0450b..3583ccdb97b 100644
--- a/src/librustc/middle/cstore.rs
+++ b/src/librustc/middle/cstore.rs
@@ -34,6 +34,7 @@ use session::Session;
 use session::search_paths::PathKind;
 use util::nodemap::{NodeSet, DefIdMap};
 use std::path::PathBuf;
+use std::rc::Rc;
 use syntax::ast;
 use syntax::attr;
 use syntax::ext::base::SyntaxExtension;
@@ -106,6 +107,11 @@ pub enum InlinedItemRef<'a> {
     ImplItem(DefId, &'a hir::ImplItem)
 }
 
+pub enum LoadedMacro {
+    MacroRules(ast::MacroDef),
+    ProcMacro(Rc<SyntaxExtension>),
+}
+
 #[derive(Copy, Clone, Debug)]
 pub struct ExternCrate {
     /// def_id of an `extern crate` in the current crate that caused
@@ -211,7 +217,7 @@ pub trait CrateStore<'tcx> {
     fn relative_def_path(&self, def: DefId) -> Option<hir_map::DefPath>;
     fn struct_field_names(&self, def: DefId) -> Vec<ast::Name>;
     fn item_children(&self, did: DefId) -> Vec<def::Export>;
-    fn load_macro(&self, did: DefId, sess: &Session) -> ast::MacroDef;
+    fn load_macro(&self, did: DefId, sess: &Session) -> LoadedMacro;
 
     // misc. metadata
     fn maybe_get_item_ast<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
@@ -383,7 +389,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
     }
     fn struct_field_names(&self, def: DefId) -> Vec<ast::Name> { bug!("struct_field_names") }
     fn item_children(&self, did: DefId) -> Vec<def::Export> { bug!("item_children") }
-    fn load_macro(&self, did: DefId, sess: &Session) -> ast::MacroDef { bug!("load_macro") }
+    fn load_macro(&self, did: DefId, sess: &Session) -> LoadedMacro { bug!("load_macro") }
 
     // misc. metadata
     fn maybe_get_item_ast<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
@@ -424,7 +430,6 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
 }
 
 pub trait CrateLoader {
-    fn process_item(&mut self, item: &ast::Item, defs: &Definitions, load_macros: bool)
-                    -> Vec<(ast::Name, SyntaxExtension)>;
+    fn process_item(&mut self, item: &ast::Item, defs: &Definitions);
     fn postprocess(&mut self, krate: &ast::Crate);
 }