syntax: Introduce Ident::can_be_raw

This commit is contained in:
Vadim Petrochenkov 2019-02-27 22:06:26 +03:00
parent 5cb5083909
commit 6ad55b3dec
10 changed files with 33 additions and 36 deletions

View file

@ -895,9 +895,7 @@ impl<'a> Parser<'a> {
&format!("expected identifier, found {}",
self.this_token_descr()));
if let token::Ident(ident, false) = &self.token {
if ident.is_reserved() && !ident.is_path_segment_keyword() &&
ident.name != keywords::Underscore.name()
{
if ident.is_raw_guess() {
err.span_suggestion(
self.span,
"you can escape reserved keywords to use them as identifiers",