about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-01-06 20:30:55 +0000
committerbors <bors@rust-lang.org>2016-01-06 20:30:55 +0000
commit5daa75373d870f255923aed37d99db73a661bd51 (patch)
treeb710e88ec637e966bd24234e357ccb7ec68f5f45 /src/libsyntax/ext/tt
parente8c337b5ca883285e6215f1f669d5556842d1520 (diff)
parent9023c659af8a43dd5e284d7b311e5f19721c9bd8 (diff)
Auto merge of #30654 - nrc:panictry, r=brson
The motivation (other than removing boilerplate) is that this is a baby step towards a parser with error recovery.

[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
Diffstat (limited to 'src/libsyntax/ext/tt')
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs4
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 166d32a8cc6..ae8ab054105 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -512,7 +512,7 @@ pub fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal {
         _ => {}
     }
     // check at the beginning and the parser checks after each bump
-    panictry!(p.check_unknown_macro_variable());
+    p.check_unknown_macro_variable();
     match name {
         "item" => match panictry!(p.parse_item()) {
             Some(i) => token::NtItem(i),
@@ -535,7 +535,7 @@ pub fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal {
         // this could be handled like a token, since it is one
         "ident" => match p.token {
             token::Ident(sn,b) => {
-                panictry!(p.bump());
+                p.bump();
                 token::NtIdent(Box::new(Spanned::<Ident>{node: sn, span: p.span}),b)
             }
             _ => {
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 38e6c21375c..c61b91df092 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -47,7 +47,7 @@ impl<'a> ParserAnyMacro<'a> {
     fn ensure_complete_parse(&self, allow_semi: bool, context: &str) {
         let mut parser = self.parser.borrow_mut();
         if allow_semi && parser.token == token::Semi {
-            panictry!(parser.bump())
+            parser.bump();
         }
         if parser.token != token::Eof {
             let token_str = parser.this_token_to_string();
@@ -194,7 +194,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
                                            imported_from,
                                            rhs);
                 let mut p = Parser::new(cx.parse_sess(), cx.cfg(), Box::new(trncbr));
-                panictry!(p.check_unknown_macro_variable());
+                p.check_unknown_macro_variable();
                 // Let the context choose how to interpret the result.
                 // Weird, but useful for X-macros.
                 return Box::new(ParserAnyMacro {