From ba6b45a35bebf35fa712478e4f50383dd7d0aa21 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Thu, 19 Mar 2015 20:02:03 -0700 Subject: [PATCH] Update to rust HEAD --- Cargo.toml | 7 ++++--- quasi_macros/Cargo.toml | 2 +- quasi_macros/src/lib.rs | 24 +++--------------------- src/lib.rs | 3 +-- tests/test.rs | 2 +- 5 files changed, 10 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b49988b1..410751ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,11 @@ [package] name = "quasi" -version = "0.1.6" +version = "0.1.7" authors = ["Erick Tryzelaar "] license = "MIT/Apache-2.0" description = "A quasi-quoting macro system" repository = "https://github.com/erickt/rust-quasi" -[dev-dependencies] -quasi_macros = "*" +[dev-dependencies.quasi_macros] +path = "quasi_macros" +version = "0.1.7" diff --git a/quasi_macros/Cargo.toml b/quasi_macros/Cargo.toml index dab966e2..d00a2d2e 100644 --- a/quasi_macros/Cargo.toml +++ b/quasi_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "quasi_macros" -version = "0.1.6" +version = "0.1.7" authors = ["Erick Tryzelaar "] license = "MIT/Apache-2.0" description = "A quasi-quoting macro system" diff --git a/quasi_macros/src/lib.rs b/quasi_macros/src/lib.rs index af38dc09..691eb2e5 100644 --- a/quasi_macros/src/lib.rs +++ b/quasi_macros/src/lib.rs @@ -61,15 +61,7 @@ pub fn expand_quote_stmt(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box { - let builder = aster::AstBuilder::new().span(sp); - - let e_attrs = builder.expr().call() - .path().global().ids(&["std", "vec", "Vec", "new"]).build() - .build(); - - let expanded = expand_parse_call(cx, sp, "parse_stmt", - vec!(e_attrs), tts); - + let expanded = expand_parse_call(cx, sp, "parse_stmt", vec!(), tts); base::MacEager::expr(expanded) } @@ -97,20 +89,11 @@ pub fn expand_quote_block<'cx>(cx: &'cx mut ExtCtxt, base::MacEager::expr(expanded) } -pub fn expand_quote_method(cx: &mut ExtCtxt, - sp: Span, - tts: &[ast::TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_method_with_outer_attributes", - vec!(), tts); - base::MacEager::expr(expanded) -} - pub fn expand_quote_item<'cx>(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box { - let expanded = expand_parse_call(cx, sp, "parse_item_with_outer_attributes", + let expanded = expand_parse_call(cx, sp, "parse_item", vec!(), tts); base::MacEager::expr(expanded) } @@ -119,7 +102,7 @@ pub fn expand_quote_impl_item<'cx>(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box { - let expanded = expand_parse_call(cx, sp, "parse_impl_item_with_outer_attributes", + let expanded = expand_parse_call(cx, sp, "parse_impl_item", vec!(), tts); base::MacEager::expr(expanded) } @@ -558,7 +541,6 @@ pub fn plugin_registrar(reg: &mut Registry) { reg.register_macro("quote_pat", expand_quote_pat); reg.register_macro("quote_arm", expand_quote_arm); reg.register_macro("quote_block", expand_quote_block); - reg.register_macro("quote_method", expand_quote_method); reg.register_macro("quote_item", expand_quote_item); reg.register_macro("quote_impl_item", expand_quote_impl_item); //reg.register_macro("quote_where_clause", expand_quote_where_clause); diff --git a/src/lib.rs b/src/lib.rs index c17fc89e..f78b0114 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -391,8 +391,7 @@ impl<'a> ExtParseUtils for ExtCtxt<'a> { parse::parse_stmt_from_source_str("".to_string(), s, self.cfg(), - Vec::new(), - self.parse_sess()) + self.parse_sess()).expect("parse error") } fn parse_expr(&self, s: String) -> P { diff --git a/tests/test.rs b/tests/test.rs index a7aa0638..0f9ba02d 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -79,7 +79,7 @@ fn test_quote_stmt() { let sess = parse::new_parse_sess(); let cx = make_ext_ctxt(&sess); - let stmt = quote_stmt!(&cx, let x = 20;); + let stmt = quote_stmt!(&cx, let x = 20;).unwrap(); assert_eq!(pprust::stmt_to_string(&stmt), "let x = 20;"); }