Refactor ExtCtxt
to use a Resolver
instead of a MacroLoader
.
This commit is contained in:
parent
60440b226d
commit
a9821e1658
11 changed files with 53 additions and 34 deletions
|
@ -39,6 +39,7 @@ use std::rc::Rc;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
|
use syntax::ext::base::LoadedMacro;
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use syntax::parse::token::InternedString;
|
use syntax::parse::token::InternedString;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
@ -488,6 +489,9 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
|
||||||
fn metadata_encoding_version(&self) -> &[u8] { bug!("metadata_encoding_version") }
|
fn metadata_encoding_version(&self) -> &[u8] { bug!("metadata_encoding_version") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait MacroLoader {
|
||||||
|
fn load_crate(&mut self, extern_crate: &ast::Item, allows_macros: bool) -> Vec<LoadedMacro>;
|
||||||
|
}
|
||||||
|
|
||||||
/// Metadata encoding and decoding can make use of thread-local encoding and
|
/// Metadata encoding and decoding can make use of thread-local encoding and
|
||||||
/// decoding contexts. These allow implementers of serialize::Encodable and
|
/// decoding contexts. These allow implementers of serialize::Encodable and
|
||||||
|
|
|
@ -638,6 +638,12 @@ pub fn phase_2_configure_and_expand<'a, F>(sess: &Session,
|
||||||
}
|
}
|
||||||
sess.track_errors(|| sess.lint_store.borrow_mut().process_command_line(sess))?;
|
sess.track_errors(|| sess.lint_store.borrow_mut().process_command_line(sess))?;
|
||||||
|
|
||||||
|
let mut macro_loader =
|
||||||
|
macro_import::MacroLoader::new(sess, &cstore, crate_name, krate.config.clone());
|
||||||
|
|
||||||
|
let resolver_arenas = Resolver::arenas();
|
||||||
|
let mut resolver = Resolver::new(sess, make_glob_map, &mut macro_loader, &resolver_arenas);
|
||||||
|
|
||||||
krate = time(time_passes, "expansion", || {
|
krate = time(time_passes, "expansion", || {
|
||||||
// Windows dlls do not have rpaths, so they don't know how to find their
|
// Windows dlls do not have rpaths, so they don't know how to find their
|
||||||
// dependencies. It's up to us to tell the system where to find all the
|
// dependencies. It's up to us to tell the system where to find all the
|
||||||
|
@ -672,14 +678,10 @@ pub fn phase_2_configure_and_expand<'a, F>(sess: &Session,
|
||||||
trace_mac: sess.opts.debugging_opts.trace_macros,
|
trace_mac: sess.opts.debugging_opts.trace_macros,
|
||||||
should_test: sess.opts.test,
|
should_test: sess.opts.test,
|
||||||
};
|
};
|
||||||
let mut loader = macro_import::MacroLoader::new(sess,
|
|
||||||
&cstore,
|
|
||||||
crate_name,
|
|
||||||
krate.config.clone());
|
|
||||||
let mut ecx = syntax::ext::base::ExtCtxt::new(&sess.parse_sess,
|
let mut ecx = syntax::ext::base::ExtCtxt::new(&sess.parse_sess,
|
||||||
krate.config.clone(),
|
krate.config.clone(),
|
||||||
cfg,
|
cfg,
|
||||||
&mut loader);
|
&mut resolver);
|
||||||
syntax_ext::register_builtins(&mut ecx.syntax_env);
|
syntax_ext::register_builtins(&mut ecx.syntax_env);
|
||||||
let ret = syntax::ext::expand::expand_crate(&mut ecx, syntax_exts, krate);
|
let ret = syntax::ext::expand::expand_crate(&mut ecx, syntax_exts, krate);
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
|
@ -708,9 +710,6 @@ pub fn phase_2_configure_and_expand<'a, F>(sess: &Session,
|
||||||
&sess.features.borrow())
|
&sess.features.borrow())
|
||||||
});
|
});
|
||||||
|
|
||||||
let resolver_arenas = Resolver::arenas();
|
|
||||||
let mut resolver = Resolver::new(sess, make_glob_map, &resolver_arenas);
|
|
||||||
|
|
||||||
let krate = time(sess.time_passes(), "assigning node ids", || resolver.assign_node_ids(krate));
|
let krate = time(sess.time_passes(), "assigning node ids", || resolver.assign_node_ids(krate));
|
||||||
|
|
||||||
if sess.opts.debugging_opts.input_stats {
|
if sess.opts.debugging_opts.input_stats {
|
||||||
|
|
|
@ -18,6 +18,7 @@ use creader::{CrateReader, Macros};
|
||||||
use cstore::CStore;
|
use cstore::CStore;
|
||||||
|
|
||||||
use rustc::hir::def_id::DefIndex;
|
use rustc::hir::def_id::DefIndex;
|
||||||
|
use rustc::middle;
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::util::nodemap::FnvHashMap;
|
use rustc::util::nodemap::FnvHashMap;
|
||||||
use rustc_back::dynamic_lib::DynamicLibrary;
|
use rustc_back::dynamic_lib::DynamicLibrary;
|
||||||
|
@ -26,7 +27,6 @@ use rustc_macro::__internal::Registry;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::ext::base::LoadedMacro;
|
use syntax::ext::base::LoadedMacro;
|
||||||
use syntax::ext;
|
|
||||||
use syntax::parse::token;
|
use syntax::parse::token;
|
||||||
use syntax_ext::deriving::custom::CustomDerive;
|
use syntax_ext::deriving::custom::CustomDerive;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
@ -55,7 +55,7 @@ pub fn call_bad_macro_reexport(a: &Session, b: Span) {
|
||||||
|
|
||||||
pub type MacroSelection = FnvHashMap<token::InternedString, Span>;
|
pub type MacroSelection = FnvHashMap<token::InternedString, Span>;
|
||||||
|
|
||||||
impl<'a> ext::base::MacroLoader for MacroLoader<'a> {
|
impl<'a> middle::cstore::MacroLoader for MacroLoader<'a> {
|
||||||
fn load_crate(&mut self,
|
fn load_crate(&mut self,
|
||||||
extern_crate: &ast::Item,
|
extern_crate: &ast::Item,
|
||||||
allows_macros: bool) -> Vec<LoadedMacro> {
|
allows_macros: bool) -> Vec<LoadedMacro> {
|
||||||
|
|
|
@ -45,6 +45,7 @@ use self::ParentLink::*;
|
||||||
|
|
||||||
use rustc::hir::map::Definitions;
|
use rustc::hir::map::Definitions;
|
||||||
use rustc::hir::{self, PrimTy, TyBool, TyChar, TyFloat, TyInt, TyUint, TyStr};
|
use rustc::hir::{self, PrimTy, TyBool, TyChar, TyFloat, TyInt, TyUint, TyStr};
|
||||||
|
use rustc::middle::cstore::MacroLoader;
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::lint;
|
use rustc::lint;
|
||||||
use rustc::hir::def::*;
|
use rustc::hir::def::*;
|
||||||
|
@ -53,6 +54,8 @@ use rustc::ty;
|
||||||
use rustc::hir::{Freevar, FreevarMap, TraitCandidate, TraitMap, GlobMap};
|
use rustc::hir::{Freevar, FreevarMap, TraitCandidate, TraitMap, GlobMap};
|
||||||
use rustc::util::nodemap::{NodeMap, NodeSet, FnvHashMap, FnvHashSet};
|
use rustc::util::nodemap::{NodeMap, NodeSet, FnvHashMap, FnvHashSet};
|
||||||
|
|
||||||
|
use syntax::ext;
|
||||||
|
use syntax::ext::base::LoadedMacro;
|
||||||
use syntax::ext::hygiene::Mark;
|
use syntax::ext::hygiene::Mark;
|
||||||
use syntax::ast::{self, FloatTy};
|
use syntax::ast::{self, FloatTy};
|
||||||
use syntax::ast::{CRATE_NODE_ID, Name, NodeId, CrateNum, IntTy, UintTy};
|
use syntax::ast::{CRATE_NODE_ID, Name, NodeId, CrateNum, IntTy, UintTy};
|
||||||
|
@ -1068,6 +1071,8 @@ pub struct Resolver<'a> {
|
||||||
arenas: &'a ResolverArenas<'a>,
|
arenas: &'a ResolverArenas<'a>,
|
||||||
dummy_binding: &'a NameBinding<'a>,
|
dummy_binding: &'a NameBinding<'a>,
|
||||||
new_import_semantics: bool, // true if `#![feature(item_like_imports)]`
|
new_import_semantics: bool, // true if `#![feature(item_like_imports)]`
|
||||||
|
|
||||||
|
macro_loader: &'a mut MacroLoader,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ResolverArenas<'a> {
|
pub struct ResolverArenas<'a> {
|
||||||
|
@ -1149,6 +1154,12 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> ext::base::Resolver for Resolver<'a> {
|
||||||
|
fn load_crate(&mut self, extern_crate: &ast::Item, allows_macros: bool) -> Vec<LoadedMacro> {
|
||||||
|
self.macro_loader.load_crate(extern_crate, allows_macros)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
trait Named {
|
trait Named {
|
||||||
fn name(&self) -> Name;
|
fn name(&self) -> Name;
|
||||||
}
|
}
|
||||||
|
@ -1166,7 +1177,10 @@ impl Named for hir::PathSegment {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Resolver<'a> {
|
impl<'a> Resolver<'a> {
|
||||||
pub fn new(session: &'a Session, make_glob_map: MakeGlobMap, arenas: &'a ResolverArenas<'a>)
|
pub fn new(session: &'a Session,
|
||||||
|
make_glob_map: MakeGlobMap,
|
||||||
|
macro_loader: &'a mut MacroLoader,
|
||||||
|
arenas: &'a ResolverArenas<'a>)
|
||||||
-> Resolver<'a> {
|
-> Resolver<'a> {
|
||||||
let root_def_id = DefId::local(CRATE_DEF_INDEX);
|
let root_def_id = DefId::local(CRATE_DEF_INDEX);
|
||||||
let graph_root =
|
let graph_root =
|
||||||
|
@ -1227,6 +1241,8 @@ impl<'a> Resolver<'a> {
|
||||||
vis: ty::Visibility::Public,
|
vis: ty::Visibility::Public,
|
||||||
}),
|
}),
|
||||||
new_import_semantics: session.features.borrow().item_like_imports,
|
new_import_semantics: session.features.borrow().item_like_imports,
|
||||||
|
|
||||||
|
macro_loader: macro_loader,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -546,7 +546,7 @@ fn initial_syntax_expander_table<'feat>(ecfg: &expand::ExpansionConfig<'feat>)
|
||||||
syntax_expanders
|
syntax_expanders
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait MacroLoader {
|
pub trait Resolver {
|
||||||
fn load_crate(&mut self, extern_crate: &ast::Item, allows_macros: bool)
|
fn load_crate(&mut self, extern_crate: &ast::Item, allows_macros: bool)
|
||||||
-> Vec<LoadedMacro>;
|
-> Vec<LoadedMacro>;
|
||||||
}
|
}
|
||||||
|
@ -556,8 +556,8 @@ pub enum LoadedMacro {
|
||||||
CustomDerive(String, Box<MultiItemModifier>),
|
CustomDerive(String, Box<MultiItemModifier>),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct DummyMacroLoader;
|
pub struct DummyResolver;
|
||||||
impl MacroLoader for DummyMacroLoader {
|
impl Resolver for DummyResolver {
|
||||||
fn load_crate(&mut self, _: &ast::Item, _: bool) -> Vec<LoadedMacro> {
|
fn load_crate(&mut self, _: &ast::Item, _: bool) -> Vec<LoadedMacro> {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
}
|
}
|
||||||
|
@ -572,7 +572,7 @@ pub struct ExtCtxt<'a> {
|
||||||
pub backtrace: ExpnId,
|
pub backtrace: ExpnId,
|
||||||
pub ecfg: expand::ExpansionConfig<'a>,
|
pub ecfg: expand::ExpansionConfig<'a>,
|
||||||
pub crate_root: Option<&'static str>,
|
pub crate_root: Option<&'static str>,
|
||||||
pub loader: &'a mut MacroLoader,
|
pub resolver: &'a mut Resolver,
|
||||||
|
|
||||||
pub exported_macros: Vec<ast::MacroDef>,
|
pub exported_macros: Vec<ast::MacroDef>,
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ pub struct ExtCtxt<'a> {
|
||||||
impl<'a> ExtCtxt<'a> {
|
impl<'a> ExtCtxt<'a> {
|
||||||
pub fn new(parse_sess: &'a parse::ParseSess, cfg: ast::CrateConfig,
|
pub fn new(parse_sess: &'a parse::ParseSess, cfg: ast::CrateConfig,
|
||||||
ecfg: expand::ExpansionConfig<'a>,
|
ecfg: expand::ExpansionConfig<'a>,
|
||||||
loader: &'a mut MacroLoader)
|
resolver: &'a mut Resolver)
|
||||||
-> ExtCtxt<'a> {
|
-> ExtCtxt<'a> {
|
||||||
ExtCtxt {
|
ExtCtxt {
|
||||||
syntax_env: initial_syntax_expander_table(&ecfg),
|
syntax_env: initial_syntax_expander_table(&ecfg),
|
||||||
|
@ -594,7 +594,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
ecfg: ecfg,
|
ecfg: ecfg,
|
||||||
crate_root: None,
|
crate_root: None,
|
||||||
exported_macros: Vec::new(),
|
exported_macros: Vec::new(),
|
||||||
loader: loader,
|
resolver: resolver,
|
||||||
derive_modes: HashMap::new(),
|
derive_modes: HashMap::new(),
|
||||||
recursion_count: 0,
|
recursion_count: 0,
|
||||||
}
|
}
|
||||||
|
|
|
@ -644,7 +644,7 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> {
|
||||||
// We need to error on `#[macro_use] extern crate` when it isn't at the
|
// We need to error on `#[macro_use] extern crate` when it isn't at the
|
||||||
// crate root, because `$crate` won't work properly.
|
// crate root, because `$crate` won't work properly.
|
||||||
let is_crate_root = self.cx.syntax_env.is_crate_root();
|
let is_crate_root = self.cx.syntax_env.is_crate_root();
|
||||||
for def in self.cx.loader.load_crate(&*item, is_crate_root) {
|
for def in self.cx.resolver.load_crate(&*item, is_crate_root) {
|
||||||
match def {
|
match def {
|
||||||
LoadedMacro::Def(def) => self.cx.insert_macro(def),
|
LoadedMacro::Def(def) => self.cx.insert_macro(def),
|
||||||
LoadedMacro::CustomDerive(name, ext) => {
|
LoadedMacro::CustomDerive(name, ext) => {
|
||||||
|
@ -809,7 +809,7 @@ fn mark_tts(tts: &[TokenTree], m: Mark) -> Vec<TokenTree> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{expand_crate, ExpansionConfig};
|
use super::{expand_crate, ExpansionConfig};
|
||||||
use ast;
|
use ast;
|
||||||
use ext::base::{ExtCtxt, DummyMacroLoader};
|
use ext::base::{ExtCtxt, DummyResolver};
|
||||||
use parse;
|
use parse;
|
||||||
use util::parser_testing::{string_to_parser};
|
use util::parser_testing::{string_to_parser};
|
||||||
use visit;
|
use visit;
|
||||||
|
@ -850,7 +850,7 @@ mod tests {
|
||||||
src,
|
src,
|
||||||
Vec::new(), &sess).unwrap();
|
Vec::new(), &sess).unwrap();
|
||||||
// should fail:
|
// should fail:
|
||||||
let mut loader = DummyMacroLoader;
|
let mut loader = DummyResolver;
|
||||||
let mut ecx = ExtCtxt::new(&sess, vec![], test_ecfg(), &mut loader);
|
let mut ecx = ExtCtxt::new(&sess, vec![], test_ecfg(), &mut loader);
|
||||||
expand_crate(&mut ecx, vec![], crate_ast);
|
expand_crate(&mut ecx, vec![], crate_ast);
|
||||||
}
|
}
|
||||||
|
@ -865,7 +865,7 @@ mod tests {
|
||||||
"<test>".to_string(),
|
"<test>".to_string(),
|
||||||
src,
|
src,
|
||||||
Vec::new(), &sess).unwrap();
|
Vec::new(), &sess).unwrap();
|
||||||
let mut loader = DummyMacroLoader;
|
let mut loader = DummyResolver;
|
||||||
let mut ecx = ExtCtxt::new(&sess, vec![], test_ecfg(), &mut loader);
|
let mut ecx = ExtCtxt::new(&sess, vec![], test_ecfg(), &mut loader);
|
||||||
expand_crate(&mut ecx, vec![], crate_ast);
|
expand_crate(&mut ecx, vec![], crate_ast);
|
||||||
}
|
}
|
||||||
|
@ -879,7 +879,7 @@ mod tests {
|
||||||
"<test>".to_string(),
|
"<test>".to_string(),
|
||||||
src,
|
src,
|
||||||
Vec::new(), &sess).unwrap();
|
Vec::new(), &sess).unwrap();
|
||||||
let mut loader = DummyMacroLoader;
|
let mut loader = DummyResolver;
|
||||||
let mut ecx = ExtCtxt::new(&sess, vec![], test_ecfg(), &mut loader);
|
let mut ecx = ExtCtxt::new(&sess, vec![], test_ecfg(), &mut loader);
|
||||||
expand_crate(&mut ecx, vec![], crate_ast);
|
expand_crate(&mut ecx, vec![], crate_ast);
|
||||||
}
|
}
|
||||||
|
@ -888,7 +888,7 @@ mod tests {
|
||||||
let ps = parse::ParseSess::new();
|
let ps = parse::ParseSess::new();
|
||||||
let crate_ast = panictry!(string_to_parser(&ps, crate_str).parse_crate_mod());
|
let crate_ast = panictry!(string_to_parser(&ps, crate_str).parse_crate_mod());
|
||||||
// the cfg argument actually does matter, here...
|
// the cfg argument actually does matter, here...
|
||||||
let mut loader = DummyMacroLoader;
|
let mut loader = DummyResolver;
|
||||||
let mut ecx = ExtCtxt::new(&ps, vec![], test_ecfg(), &mut loader);
|
let mut ecx = ExtCtxt::new(&ps, vec![], test_ecfg(), &mut loader);
|
||||||
expand_crate(&mut ecx, vec![], crate_ast)
|
expand_crate(&mut ecx, vec![], crate_ast)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ use errors;
|
||||||
use errors::snippet::{SnippetData};
|
use errors::snippet::{SnippetData};
|
||||||
use config;
|
use config;
|
||||||
use entry::{self, EntryPointType};
|
use entry::{self, EntryPointType};
|
||||||
use ext::base::{ExtCtxt, DummyMacroLoader};
|
use ext::base::{ExtCtxt, DummyResolver};
|
||||||
use ext::build::AstBuilder;
|
use ext::build::AstBuilder;
|
||||||
use ext::expand::ExpansionConfig;
|
use ext::expand::ExpansionConfig;
|
||||||
use fold::Folder;
|
use fold::Folder;
|
||||||
|
@ -276,13 +276,13 @@ fn generate_test_harness(sess: &ParseSess,
|
||||||
let mut cleaner = EntryPointCleaner { depth: 0 };
|
let mut cleaner = EntryPointCleaner { depth: 0 };
|
||||||
let krate = cleaner.fold_crate(krate);
|
let krate = cleaner.fold_crate(krate);
|
||||||
|
|
||||||
let mut loader = DummyMacroLoader;
|
let mut resolver = DummyResolver;
|
||||||
let mut cx: TestCtxt = TestCtxt {
|
let mut cx: TestCtxt = TestCtxt {
|
||||||
sess: sess,
|
sess: sess,
|
||||||
span_diagnostic: sd,
|
span_diagnostic: sd,
|
||||||
ext_cx: ExtCtxt::new(sess, vec![],
|
ext_cx: ExtCtxt::new(sess, vec![],
|
||||||
ExpansionConfig::default("test".to_string()),
|
ExpansionConfig::default("test".to_string()),
|
||||||
&mut loader),
|
&mut resolver),
|
||||||
path: Vec::new(),
|
path: Vec::new(),
|
||||||
testfns: Vec::new(),
|
testfns: Vec::new(),
|
||||||
reexport_test_harness_main: reexport_test_harness_main,
|
reexport_test_harness_main: reexport_test_harness_main,
|
||||||
|
|
|
@ -13,7 +13,7 @@ use std::mem;
|
||||||
use errors;
|
use errors;
|
||||||
use syntax::ast::{self, Ident, NodeId};
|
use syntax::ast::{self, Ident, NodeId};
|
||||||
use syntax::codemap::{ExpnInfo, NameAndSpan, MacroAttribute};
|
use syntax::codemap::{ExpnInfo, NameAndSpan, MacroAttribute};
|
||||||
use syntax::ext::base::{ExtCtxt, DummyMacroLoader};
|
use syntax::ext::base::{ExtCtxt, DummyResolver};
|
||||||
use syntax::ext::build::AstBuilder;
|
use syntax::ext::build::AstBuilder;
|
||||||
use syntax::ext::expand::ExpansionConfig;
|
use syntax::ext::expand::ExpansionConfig;
|
||||||
use syntax::parse::ParseSess;
|
use syntax::parse::ParseSess;
|
||||||
|
@ -44,7 +44,7 @@ pub fn modify(sess: &ParseSess,
|
||||||
num_crate_types: usize,
|
num_crate_types: usize,
|
||||||
handler: &errors::Handler,
|
handler: &errors::Handler,
|
||||||
features: &Features) -> ast::Crate {
|
features: &Features) -> ast::Crate {
|
||||||
let mut loader = DummyMacroLoader;
|
let mut loader = DummyResolver;
|
||||||
let mut cx = ExtCtxt::new(sess,
|
let mut cx = ExtCtxt::new(sess,
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
ExpansionConfig::default("rustc_macro".to_string()),
|
ExpansionConfig::default("rustc_macro".to_string()),
|
||||||
|
|
|
@ -22,11 +22,11 @@ use syntax_pos::DUMMY_SP;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ps = syntax::parse::ParseSess::new();
|
let ps = syntax::parse::ParseSess::new();
|
||||||
let mut loader = syntax::ext::base::DummyMacroLoader;
|
let mut resolver = syntax::ext::base::DummyResolver;
|
||||||
let mut cx = syntax::ext::base::ExtCtxt::new(
|
let mut cx = syntax::ext::base::ExtCtxt::new(
|
||||||
&ps, vec![],
|
&ps, vec![],
|
||||||
syntax::ext::expand::ExpansionConfig::default("qquote".to_string()),
|
syntax::ext::expand::ExpansionConfig::default("qquote".to_string()),
|
||||||
&mut loader);
|
&mut resolver);
|
||||||
cx.bt_push(syntax::codemap::ExpnInfo {
|
cx.bt_push(syntax::codemap::ExpnInfo {
|
||||||
call_site: DUMMY_SP,
|
call_site: DUMMY_SP,
|
||||||
callee: syntax::codemap::NameAndSpan {
|
callee: syntax::codemap::NameAndSpan {
|
||||||
|
|
|
@ -25,11 +25,11 @@ use syntax_pos::DUMMY_SP;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ps = syntax::parse::ParseSess::new();
|
let ps = syntax::parse::ParseSess::new();
|
||||||
let mut loader = syntax::ext::base::DummyMacroLoader;
|
let mut resolver = syntax::ext::base::DummyResolver;
|
||||||
let mut cx = syntax::ext::base::ExtCtxt::new(
|
let mut cx = syntax::ext::base::ExtCtxt::new(
|
||||||
&ps, vec![],
|
&ps, vec![],
|
||||||
syntax::ext::expand::ExpansionConfig::default("qquote".to_string()),
|
syntax::ext::expand::ExpansionConfig::default("qquote".to_string()),
|
||||||
&mut loader);
|
&mut resolver);
|
||||||
cx.bt_push(syntax::codemap::ExpnInfo {
|
cx.bt_push(syntax::codemap::ExpnInfo {
|
||||||
call_site: DUMMY_SP,
|
call_site: DUMMY_SP,
|
||||||
callee: syntax::codemap::NameAndSpan {
|
callee: syntax::codemap::NameAndSpan {
|
||||||
|
|
|
@ -21,11 +21,11 @@ use syntax_pos::DUMMY_SP;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ps = syntax::parse::ParseSess::new();
|
let ps = syntax::parse::ParseSess::new();
|
||||||
let mut loader = syntax::ext::base::DummyMacroLoader;
|
let mut resolver = syntax::ext::base::DummyResolver;
|
||||||
let mut cx = syntax::ext::base::ExtCtxt::new(
|
let mut cx = syntax::ext::base::ExtCtxt::new(
|
||||||
&ps, vec![],
|
&ps, vec![],
|
||||||
syntax::ext::expand::ExpansionConfig::default("qquote".to_string()),
|
syntax::ext::expand::ExpansionConfig::default("qquote".to_string()),
|
||||||
&mut loader);
|
&mut resolver);
|
||||||
cx.bt_push(syntax::codemap::ExpnInfo {
|
cx.bt_push(syntax::codemap::ExpnInfo {
|
||||||
call_site: DUMMY_SP,
|
call_site: DUMMY_SP,
|
||||||
callee: syntax::codemap::NameAndSpan {
|
callee: syntax::codemap::NameAndSpan {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue