Fix bug for ident to lifetime

This commit is contained in:
Edwin Cheng 2019-04-19 21:43:41 +08:00
parent 87ff908135
commit 763569017a

View File

@ -134,6 +134,13 @@ pub(crate) fn eat_item(&mut self) -> Option<tt::TokenTree> {
}
pub(crate) fn eat_lifetime(&mut self) -> Option<tt::TokenTree> {
// check if it start from "`"
if let Some(ident) = self.at_ident() {
if ident.text.chars().next()? != '\'' {
return None;
}
}
self.eat_ident().cloned().map(|ident| tt::Leaf::from(ident).into())
}