Reserve prefixed identifiers and string literals (RFC 3101)

This commit denies any identifiers immediately followed by
one of three tokens `"`, `'` or `#`, which is stricter than
the requirements of RFC 3101 but may be necessary according
to the discussion at [Zulip].

[Zulip]: https://rust-lang.zulipchat.com/#narrow/stream/268952-edition-2021/topic/reserved.20prefixes/near/238470099
This commit is contained in:
lrh2000 2021-05-16 11:10:05 +08:00
parent 831ae3c136
commit 8dee9bc8fc
5 changed files with 172 additions and 7 deletions

View file

@ -413,7 +413,7 @@ impl<'a> Classifier<'a> {
},
c => c,
},
TokenKind::RawIdent => Class::Ident,
TokenKind::RawIdent | TokenKind::BadPrefix => Class::Ident,
TokenKind::Lifetime { .. } => Class::Lifetime,
};
// Anything that didn't return above is the simple case where we the