Skip to content

Commit 40b86ba

Browse files
committed
auto merge of #17409 : farcaller/rust/patch-1, r=huonw
Parser.parse_method now has a second argument, I assume ast::Inherited is the correct visibility in this case.
2 parents eb816ee + 75d49c8 commit 40b86ba

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/libsyntax/ext/quote.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,13 @@ pub fn expand_quote_method(cx: &mut ExtCtxt,
464464
sp: Span,
465465
tts: &[ast::TokenTree])
466466
-> Box<base::MacResult+'static> {
467-
let e_param_colons = cx.expr_none(sp);
467+
let e_attrs = cx.expr_vec_ng(sp);
468+
let e_visibility = cx.expr_path(cx.path_global(sp, vec!(
469+
id_ext("syntax"),
470+
id_ext("ast"),
471+
id_ext("Inherited"))));
468472
let expanded = expand_parse_call(cx, sp, "parse_method",
469-
vec!(e_param_colons), tts);
473+
vec!(e_attrs, e_visibility), tts);
470474
base::MacExpr::new(expanded)
471475
}
472476

src/test/run-pass-fulldeps/quote-tokens.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ fn syntax_extension(cx: &ExtCtxt) {
3535

3636
let i: Option<P<syntax::ast::Item>> = quote_item!(cx, #[deriving(Eq)] struct Foo; );
3737
assert!(i.is_some());
38+
39+
let _j: P<syntax::ast::Method> = quote_method!(cx, fn foo(&self) {});
3840
}
3941

4042
fn main() {

0 commit comments

Comments
 (0)