@@ -164,7 +164,9 @@ fn plugin_deps() {
164
164
use rustc_plugin::Registry;
165
165
use syntax::tokenstream::TokenTree;
166
166
use syntax::codemap::Span;
167
+ use syntax::ast::*;
167
168
use syntax::ext::base::{ExtCtxt, MacEager, MacResult};
169
+ use syntax::ext::build::AstBuilder;
168
170
169
171
#[plugin_registrar]
170
172
pub fn foo(reg: &mut Registry) {
@@ -173,7 +175,7 @@ fn plugin_deps() {
173
175
174
176
fn expand_bar(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
175
177
-> Box<MacResult + 'static> {
176
- MacEager::expr(quote_expr!(cx, 1 ))
178
+ MacEager::expr(cx.expr_lit(sp, LitKind::Int(1, LitIntType::Unsuffixed) ))
177
179
}
178
180
"# )
179
181
. build ( ) ;
@@ -247,7 +249,10 @@ fn plugin_to_the_max() {
247
249
use rustc_plugin::Registry;
248
250
use syntax::tokenstream::TokenTree;
249
251
use syntax::codemap::Span;
252
+ use syntax::ast::*;
250
253
use syntax::ext::base::{ExtCtxt, MacEager, MacResult};
254
+ use syntax::ext::build::AstBuilder;
255
+ use syntax::ptr::P;
251
256
252
257
#[plugin_registrar]
253
258
pub fn foo(reg: &mut Registry) {
@@ -256,7 +261,9 @@ fn plugin_to_the_max() {
256
261
257
262
fn expand_bar(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
258
263
-> Box<MacResult + 'static> {
259
- MacEager::expr(quote_expr!(cx, baz::baz()))
264
+ let bar = Ident::from_str("baz");
265
+ let path = cx.path(sp, vec![bar.clone(), bar]);
266
+ MacEager::expr(cx.expr_call(sp, cx.expr_path(path), vec![]))
260
267
}
261
268
"# )
262
269
. build ( ) ;
0 commit comments