From 75d49c8203405ab0af7a2b8b8698af02868fdbc2 Mon Sep 17 00:00:00 2001 From: Vladimir Pouzanov Date: Sat, 20 Sep 2014 17:02:48 +0100 Subject: [PATCH] Fixed quote_method!() implementation Parser.parse_method now has a second argument, I assume ast::Inherited is the correct visibility in this case. --- src/libsyntax/ext/quote.rs | 8 ++++++-- src/test/run-pass-fulldeps/quote-tokens.rs | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index aa2a23dd276..0503c1e8cc2 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -464,9 +464,13 @@ pub fn expand_quote_method(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box { - let e_param_colons = cx.expr_none(sp); + let e_attrs = cx.expr_vec_ng(sp); + let e_visibility = cx.expr_path(cx.path_global(sp, vec!( + id_ext("syntax"), + id_ext("ast"), + id_ext("Inherited")))); let expanded = expand_parse_call(cx, sp, "parse_method", - vec!(e_param_colons), tts); + vec!(e_attrs, e_visibility), tts); base::MacExpr::new(expanded) } diff --git a/src/test/run-pass-fulldeps/quote-tokens.rs b/src/test/run-pass-fulldeps/quote-tokens.rs index b7c4c146382..7b48e7a84b6 100644 --- a/src/test/run-pass-fulldeps/quote-tokens.rs +++ b/src/test/run-pass-fulldeps/quote-tokens.rs @@ -35,6 +35,8 @@ fn syntax_extension(cx: &ExtCtxt) { let i: Option> = quote_item!(cx, #[deriving(Eq)] struct Foo; ); assert!(i.is_some()); + + let _j: P = quote_method!(cx, fn foo(&self) {}); } fn main() { -- 2.44.0