Skip to content

Commit

Permalink
Do not consider # an emoji in the lexer
Browse files Browse the repository at this point in the history
Fix #109746.
  • Loading branch information
estebank committed Mar 30, 2023
1 parent 2fb0e8d commit a2c1d8a
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit a2c1d8a

Please sign in to comment.