Skip to content

Commit

Permalink
Fix fallout in macro_crate/quote tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Sep 14, 2014
1 parent 5b2837b commit 8577343
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
11 changes: 5 additions & 6 deletions src/test/auxiliary/macro_crate_test.rs
Expand Up @@ -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))

Expand Down Expand Up @@ -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> {
Expand Down
20 changes: 10 additions & 10 deletions src/test/run-pass-fulldeps/quote-tokens.rs
Expand Up @@ -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());
}

Expand Down

5 comments on commit 8577343

@bors
Copy link
Contributor

@bors bors commented on 8577343 Sep 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at eddyb@8577343

@bors
Copy link
Contributor

@bors bors commented on 8577343 Sep 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging eddyb/rust/ast-ptr = 8577343 into auto

@bors
Copy link
Contributor

@bors bors commented on 8577343 Sep 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eddyb/rust/ast-ptr = 8577343 merged ok, testing candidate = 19311b6

@bors
Copy link
Contributor

@bors bors commented on 8577343 Sep 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 8577343 Sep 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 19311b6

Please sign in to comment.