Represent lifetimes as two joint tokens in proc macros

This commit is contained in:
Vadim Petrochenkov
2018-05-14 00:01:56 +03:00
parent 5b820a694c
commit c106125431
12 changed files with 158 additions and 21 deletions

View File

@@ -1773,10 +1773,7 @@ fn ident_continue(c: Option<char>) -> bool {
// The string is a valid identifier or a lifetime identifier.
pub fn is_valid_ident(s: &str) -> bool {
let mut chars = s.chars();
match chars.next() {
Some('\'') => ident_start(chars.next()) && chars.all(|ch| ident_continue(Some(ch))),
ch => ident_start(ch) && chars.all(|ch| ident_continue(Some(ch)))
}
ident_start(chars.next()) && chars.all(|ch| ident_continue(Some(ch)))
}
#[cfg(test)]