diff options
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 5beec702f8c..2275d95c7c2 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -116,7 +116,7 @@ pub fn parse_expr_from_source_str(name: String, sess: &ParseSess) -> P<ast::Expr> { let mut p = new_parser_from_source_str(sess, cfg, name, source); - maybe_aborted(p.parse_expr(), p) + maybe_aborted(panictry!(p.parse_expr_nopanic()), p) } pub fn parse_item_from_source_str(name: String, @@ -125,7 +125,7 @@ pub fn parse_item_from_source_str(name: String, sess: &ParseSess) -> Option<P<ast::Item>> { let mut p = new_parser_from_source_str(sess, cfg, name, source); - maybe_aborted(p.parse_item(),p) + maybe_aborted(panictry!(p.parse_item_nopanic()), p) } pub fn parse_meta_from_source_str(name: String, @@ -134,7 +134,7 @@ pub fn parse_meta_from_source_str(name: String, sess: &ParseSess) -> P<ast::MetaItem> { let mut p = new_parser_from_source_str(sess, cfg, name, source); - maybe_aborted(p.parse_meta_item(),p) + maybe_aborted(p.parse_meta_item(), p) } pub fn parse_stmt_from_source_str(name: String, @@ -148,7 +148,7 @@ pub fn parse_stmt_from_source_str(name: String, name, source ); - maybe_aborted(p.parse_stmt(), p) + maybe_aborted(panictry!(p.parse_stmt_nopanic()), p) } // Warning: This parses with quote_depth > 0, which is not the default. diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6cee7b86a61..6afcd61aa3d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -359,7 +359,8 @@ impl<'a> Parser<'a> { } // Panicing fns (for now!) - // This is so that the quote_*!() syntax extensions + // These functions are used by the quote_*!() syntax extensions, but shouldn't + // be used otherwise. pub fn parse_expr(&mut self) -> P<Expr> { panictry!(self.parse_expr_nopanic()) } |
