From 763569017a61f5294750cdd0d4aee02d0bf76166 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Fri, 19 Apr 2019 21:43:41 +0800 Subject: Fix bug for ident to lifetime --- crates/ra_mbe/src/tt_cursor.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'crates/ra_mbe') diff --git a/crates/ra_mbe/src/tt_cursor.rs b/crates/ra_mbe/src/tt_cursor.rs index 818c412a0..741b5ea1c 100644 --- a/crates/ra_mbe/src/tt_cursor.rs +++ b/crates/ra_mbe/src/tt_cursor.rs @@ -134,6 +134,13 @@ impl<'a> TtCursor<'a> { } pub(crate) fn eat_lifetime(&mut self) -> Option { + // 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()) } -- cgit v1.2.3