Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not consider # an emoji in the lexer #109754

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions compiler/rustc_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ impl Cursor<'_> {
|| self.first().is_digit(10)
// FIXME(#108019): `unic-emoji-char` seems to have data tables only up to Unicode
// 5.0, but Unicode is already newer than this.
|| unic_emoji_char::is_emoji(self.first())
|| !self.first().is_ascii() && unic_emoji_char::is_emoji(self.first())
};

if !can_be_a_lifetime {
Expand All @@ -658,7 +658,7 @@ impl Cursor<'_> {

// FIXME(#108019): `unic-emoji-char` seems to have data tables only up to Unicode
// 5.0, but Unicode is already newer than this.
if unic_emoji_char::is_emoji(self.first()) {
if !self.first().is_ascii() && unic_emoji_char::is_emoji(self.first()) {
contains_emoji = true;
} else {
// Skip the literal contents.
Expand All @@ -671,7 +671,10 @@ impl Cursor<'_> {
true
// FIXME(#108019): `unic-emoji-char` seems to have data tables only up to Unicode
// 5.0, but Unicode is already newer than this.
} else if unic_emoji_char::is_emoji(c) {
// `#` ends an identifier, but is counted as an emoji because of
// https://github.com/open-i18n/rust-unic/issues/280. These can be common on macros, so
// we need to handle them properly. (#109746)
} else if !c.is_ascii() && unic_emoji_char::is_emoji(c) {
contains_emoji = true;
true
} else {
Expand Down