about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-07 23:12:08 +0000
committerbors <bors@rust-lang.org>2014-10-07 23:12:08 +0000
commit3b945dcae6dcedd0917652d66edd8ceefb4f73c1 (patch)
tree7548c57395f80dd9535a4a5c8677a8068a3885f4 /src/libsyntax
parent8881c3524b33d45fd632331d51b8de5e9b104ad9 (diff)
parenta5a11a8ef0ac9d66660d93b0db951eae9497705f (diff)
downloadrust-3b945dcae6dcedd0917652d66edd8ceefb4f73c1.tar.gz
rust-3b945dcae6dcedd0917652d66edd8ceefb4f73c1.zip
auto merge of #17787 : bgamari/rust/fix-quote-method, r=huonw
The previous fix introduced in 75d49c8203405ab0af7a2b8b8698af02868fdbc2 neglected to parse outer attributes as described in #17782.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/quote.rs9
-rw-r--r--src/libsyntax/parse/parser.rs7
2 files changed, 9 insertions, 7 deletions
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 0503c1e8cc2..e8949c4aa4f 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -464,13 +464,8 @@ pub fn expand_quote_method(cx: &mut ExtCtxt,
                            sp: Span,
                            tts: &[ast::TokenTree])
                            -> Box<base::MacResult+'static> {
-    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_attrs, e_visibility), tts);
+    let expanded = expand_parse_call(cx, sp, "parse_method_with_outer_attributes",
+                                     vec!(), tts);
     base::MacExpr::new(expanded)
 }
 
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 6ab14417265..9bfb593786e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4371,6 +4371,13 @@ impl<'a> Parser<'a> {
         (ident, ItemFn(decl, fn_style, abi, generics, body), Some(inner_attrs))
     }
 
+    /// Parse a method in a trait impl
+    pub fn parse_method_with_outer_attributes(&mut self) -> P<Method> {
+        let attrs = self.parse_outer_attributes();
+        let visa = self.parse_visibility();
+        self.parse_method(attrs, visa)
+    }
+
     /// Parse a method in a trait impl, starting with `attrs` attributes.
     pub fn parse_method(&mut self,
                         attrs: Vec<Attribute>,