In the 2015 and 2018 editions, the following compiles (with warnings):
macro_rules! lexes {($($_:tt)*) => {}}
lexes!(🐛#);
lexes!(🐛"foo");
lexes!(🐛'q');
lexes!(🐛'q);
playground
The 🐛 is taken as an identifier, although emoji aren't generally permitted in identifiers in any edition.
I tested with rustc 1.77.1.
I think the underlying problem is that ident_or_unknown_prefix() and fake_ident_or_unknown_prefix() in rustc_lexer distinguish "identifiers" containing emoji (as InvalidIdent rather than Ident), but don't have a way to make that distinction for UnknownPrefix.
In the 2015 and 2018 editions, the following compiles (with warnings):
playground
The 🐛 is taken as an identifier, although emoji aren't generally permitted in identifiers in any edition.
I tested with
rustc1.77.1.I think the underlying problem is that
ident_or_unknown_prefix()andfake_ident_or_unknown_prefix()inrustc_lexerdistinguish "identifiers" containing emoji (asInvalidIdentrather thanIdent), but don't have a way to make that distinction forUnknownPrefix.