From 8577343f9eb1024bf77f59e281ba9f4cd1ee0aaa Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Fri, 12 Sep 2014 02:33:08 +0300 Subject: [PATCH] Fix fallout in macro_crate/quote tests. --- src/test/auxiliary/macro_crate_test.rs | 11 +++++------ src/test/run-pass-fulldeps/quote-tokens.rs | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/test/auxiliary/macro_crate_test.rs b/src/test/auxiliary/macro_crate_test.rs index fbbee2e625a..dd1f9c3404f 100644 --- a/src/test/auxiliary/macro_crate_test.rs +++ b/src/test/auxiliary/macro_crate_test.rs @@ -20,10 +20,9 @@ use syntax::codemap::Span; use syntax::ext::base::*; use syntax::parse::token; use syntax::parse; +use syntax::ptr::P; use rustc::plugin::Registry; -use std::gc::{Gc, GC}; - #[macro_export] macro_rules! exported_macro (() => (2i)) @@ -57,12 +56,12 @@ fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) MacExpr::new(quote_expr!(&mut *cx, $expr)) } -fn expand_into_foo(cx: &mut ExtCtxt, sp: Span, attr: Gc, it: Gc) - -> Gc { - box(GC) Item { +fn expand_into_foo(cx: &mut ExtCtxt, sp: Span, attr: &MetaItem, it: P) + -> P { + P(Item { attrs: it.attrs.clone(), ..(*quote_item!(cx, enum Foo { Bar, Baz }).unwrap()).clone() - } + }) } fn expand_forged_ident(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { diff --git a/src/test/run-pass-fulldeps/quote-tokens.rs b/src/test/run-pass-fulldeps/quote-tokens.rs index 60b8f09bb3d..b7c4c146382 100644 --- a/src/test/run-pass-fulldeps/quote-tokens.rs +++ b/src/test/run-pass-fulldeps/quote-tokens.rs @@ -16,24 +16,24 @@ extern crate syntax; use syntax::ext::base::ExtCtxt; -use std::gc::Gc; +use syntax::ptr::P; fn syntax_extension(cx: &ExtCtxt) { let e_toks : Vec = quote_tokens!(cx, 1 + 2); let p_toks : Vec = quote_tokens!(cx, (x, 1 .. 4, *)); - let a: Gc = quote_expr!(cx, 1 + 2); - let _b: Option> = quote_item!(cx, static foo : int = $e_toks; ); - let _c: Gc = quote_pat!(cx, (x, 1 .. 4, *) ); - let _d: Gc = quote_stmt!(cx, let x = $a; ); + let a: P = quote_expr!(cx, 1 + 2); + let _b: Option> = quote_item!(cx, static foo : int = $e_toks; ); + let _c: P = quote_pat!(cx, (x, 1 .. 4, *) ); + let _d: P = quote_stmt!(cx, let x = $a; ); let _d: syntax::ast::Arm = quote_arm!(cx, (ref x, ref y) = (x, y) ); - let _e: Gc = quote_expr!(cx, match foo { $p_toks => 10 } ); + let _e: P = quote_expr!(cx, match foo { $p_toks => 10 } ); - let _f: Gc = quote_expr!(cx, ()); - let _g: Gc = quote_expr!(cx, true); - let _h: Gc = quote_expr!(cx, 'a'); + let _f: P = quote_expr!(cx, ()); + let _g: P = quote_expr!(cx, true); + let _h: P = quote_expr!(cx, 'a'); - let i: Option> = quote_item!(cx, #[deriving(Eq)] struct Foo; ); + let i: Option> = quote_item!(cx, #[deriving(Eq)] struct Foo; ); assert!(i.is_some()); }