about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMatthew Russo <matthew@edapp.com>2018-10-05 11:32:57 -0400
committerMatthew Russo <mcr431@nyu.edu>2018-10-08 22:50:34 -0400
commit344747330c5f88d204ee99507aa0bd6358d0fbec (patch)
treec7b39795d81b403c6e1629c1ee7d873855fa1f51 /src/libsyntax/parse
parent1c5e9c68ea6c76fe400528de17ebe03e338bac68 (diff)
downloadrust-344747330c5f88d204ee99507aa0bd6358d0fbec.tar.gz
rust-344747330c5f88d204ee99507aa0bd6358d0fbec.zip
parse_trait_item_ now handles interpolated blocks as function body decls
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 5571a18b596..a5a13fa3029 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1430,6 +1430,23 @@ impl<'a> Parser<'a> {
                     attrs.extend(inner_attrs.iter().cloned());
                     Some(body)
                 }
+                token::Interpolated(ref nt) => {
+                    match &nt.0 {
+                        token::NtBlock(..) => {
+                            *at_end = true;
+                            let (inner_attrs, body) = self.parse_inner_attrs_and_block()?;
+                            attrs.extend(inner_attrs.iter().cloned());
+                            Some(body)
+                        }
+                        _ => {
+                            let token_str = self.this_token_to_string();
+                            let mut err = self.fatal(&format!("expected `;` or `{{`, found `{}`",
+                                                              token_str));
+                            err.span_label(self.span, "expected `;` or `{`");
+                            return Err(err);
+                        }
+                    }
+                }
                 _ => {
                     let token_str = self.this_token_to_string();
                     let mut err = self.fatal(&format!("expected `;` or `{{`, found `{}`",