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() {