about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Hewson <mah957@gmail.com>2017-05-11 22:59:48 +0000
committerMatt Peterson <ricochet1k@gmail.com>2017-12-28 11:32:05 -0500
commite12b87096a9c1856db9874c3af0bc64423b5477a (patch)
treea44154701cb6ffb810abc86a6f0a4e6399d1cd17
parent03a51019a40c1c5e2ab1635f993fc71517d1edc2 (diff)
downloadrust-e12b87096a9c1856db9874c3af0bc64423b5477a.tar.gz
rust-e12b87096a9c1856db9874c3af0bc64423b5477a.zip
replace parse_lifetime with expect_lifetime
made `parser::Parser::expect_lifetime` public, so it can be called from `macro_parser::parse_nt`
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs2
-rw-r--r--src/libsyntax/parse/parser.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 91074ec4734..124477620c2 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -603,7 +603,7 @@ fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal {
         "path" => token::NtPath(panictry!(p.parse_path_common(PathStyle::Type, false))),
         "meta" => token::NtMeta(panictry!(p.parse_meta_item())),
         "vis" => token::NtVis(panictry!(p.parse_visibility(true))),
-        "lifetime" => token::NtLifetime(panictry!(p.parse_lifetime())),
+        "lifetime" => token::NtLifetime(p.expect_lifetime()),
         // this is not supposed to happen, since it has been checked
         // when compiling the macro.
         _ => p.span_bug(sp, "invalid fragment specifier")
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index a4aad81f5f5..29f0e2a0fee 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2031,7 +2031,7 @@ impl<'a> Parser<'a> {
     }
 
     /// Parse single lifetime 'a or panic.
-    fn expect_lifetime(&mut self) -> Lifetime {
+    pub fn expect_lifetime(&mut self) -> Lifetime {
         match self.token {
             token::Lifetime(ident) => {
                 let ident_span = self.span;