diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2014-09-12 02:33:08 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2014-09-14 04:20:36 +0300 |
| commit | 8577343f9eb1024bf77f59e281ba9f4cd1ee0aaa (patch) | |
| tree | 2f3118430b415a311624aae721fa33d20bf398d6 | |
| parent | 5b2837b9189d8ae85142d78679a217ca5b8e5767 (diff) | |
| download | rust-8577343f9eb1024bf77f59e281ba9f4cd1ee0aaa.tar.gz rust-8577343f9eb1024bf77f59e281ba9f4cd1ee0aaa.zip | |
Fix fallout in macro_crate/quote tests.
| -rw-r--r-- | src/test/auxiliary/macro_crate_test.rs | 11 | ||||
| -rw-r--r-- | 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<MetaItem>, it: Gc<Item>) - -> Gc<Item> { - box(GC) Item { +fn expand_into_foo(cx: &mut ExtCtxt, sp: Span, attr: &MetaItem, it: P<Item>) + -> P<Item> { + 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<MacResult+'static> { 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<syntax::ast::TokenTree> = quote_tokens!(cx, 1 + 2); let p_toks : Vec<syntax::ast::TokenTree> = quote_tokens!(cx, (x, 1 .. 4, *)); - let a: Gc<syntax::ast::Expr> = quote_expr!(cx, 1 + 2); - let _b: Option<Gc<syntax::ast::Item>> = quote_item!(cx, static foo : int = $e_toks; ); - let _c: Gc<syntax::ast::Pat> = quote_pat!(cx, (x, 1 .. 4, *) ); - let _d: Gc<syntax::ast::Stmt> = quote_stmt!(cx, let x = $a; ); + let a: P<syntax::ast::Expr> = quote_expr!(cx, 1 + 2); + let _b: Option<P<syntax::ast::Item>> = quote_item!(cx, static foo : int = $e_toks; ); + let _c: P<syntax::ast::Pat> = quote_pat!(cx, (x, 1 .. 4, *) ); + let _d: P<syntax::ast::Stmt> = quote_stmt!(cx, let x = $a; ); let _d: syntax::ast::Arm = quote_arm!(cx, (ref x, ref y) = (x, y) ); - let _e: Gc<syntax::ast::Expr> = quote_expr!(cx, match foo { $p_toks => 10 } ); + let _e: P<syntax::ast::Expr> = quote_expr!(cx, match foo { $p_toks => 10 } ); - let _f: Gc<syntax::ast::Expr> = quote_expr!(cx, ()); - let _g: Gc<syntax::ast::Expr> = quote_expr!(cx, true); - let _h: Gc<syntax::ast::Expr> = quote_expr!(cx, 'a'); + let _f: P<syntax::ast::Expr> = quote_expr!(cx, ()); + let _g: P<syntax::ast::Expr> = quote_expr!(cx, true); + let _h: P<syntax::ast::Expr> = quote_expr!(cx, 'a'); - let i: Option<Gc<syntax::ast::Item>> = quote_item!(cx, #[deriving(Eq)] struct Foo; ); + let i: Option<P<syntax::ast::Item>> = quote_item!(cx, #[deriving(Eq)] struct Foo; ); assert!(i.is_some()); } |
