Skip to content

Commit e12b870

Browse files
mikeyhewricochet1k
authored andcommitted
replace parse_lifetime with expect_lifetime
made `parser::Parser::expect_lifetime` public, so it can be called from `macro_parser::parse_nt`
1 parent 03a5101 commit e12b870

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libsyntax/ext/tt/macro_parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal {
603603
"path" => token::NtPath(panictry!(p.parse_path_common(PathStyle::Type, false))),
604604
"meta" => token::NtMeta(panictry!(p.parse_meta_item())),
605605
"vis" => token::NtVis(panictry!(p.parse_visibility(true))),
606-
"lifetime" => token::NtLifetime(panictry!(p.parse_lifetime())),
606+
"lifetime" => token::NtLifetime(p.expect_lifetime()),
607607
// this is not supposed to happen, since it has been checked
608608
// when compiling the macro.
609609
_ => p.span_bug(sp, "invalid fragment specifier")

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,7 @@ impl<'a> Parser<'a> {
20312031
}
20322032

20332033
/// Parse single lifetime 'a or panic.
2034-
fn expect_lifetime(&mut self) -> Lifetime {
2034+
pub fn expect_lifetime(&mut self) -> Lifetime {
20352035
match self.token {
20362036
token::Lifetime(ident) => {
20372037
let ident_span = self.span;

0 commit comments

Comments
 (0)