Skip to content

Commit

Permalink
review comment: plural of emoji is emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 23, 2021
1 parent 21224e6 commit d68add9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/passes.rs
Expand Up @@ -455,7 +455,7 @@ pub fn configure_and_expand(
for (ident, spans) in identifiers.drain() {
sess.diagnostic().span_err(
MultiSpan::from(spans),
&format!("identifiers cannot contain emojis: `{}`", ident),
&format!("identifiers cannot contain emoji: `{}`", ident),
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/lexer/mod.rs
Expand Up @@ -224,7 +224,7 @@ impl<'a> StringReader<'a> {
token::Ident(sym, is_raw_ident)
}
rustc_lexer::TokenKind::InvalidIdent
// Do not recover an identifier with emojis if the codepoint is a confusable
// Do not recover an identifier with emoji if the codepoint is a confusable
// with a recoverable substitution token, like `➖`.
if UNICODE_ARRAY
.iter()
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/parse.rs
Expand Up @@ -123,7 +123,7 @@ pub struct ParseSess {
/// clashing with keywords in new editions.
pub raw_identifier_spans: Lock<Vec<Span>>,
/// Places where identifiers that contain invalid Unicode codepoints but that look like they
/// should be. Useful to avoid bad tokenization when encountering emojis. We group them to
/// should be. Useful to avoid bad tokenization when encountering emoji. We group them to
/// provide a single error per unique incorrect identifier.
pub bad_unicode_identifiers: Lock<FxHashMap<Symbol, Vec<Span>>>,
source_map: Lrc<SourceMap>,
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/parser/emoji-identifiers.rs
@@ -1,16 +1,16 @@
struct ABig👩‍👩‍👧‍👧Family; //~ ERROR identifiers cannot contain emojis
struct 👀; //~ ERROR identifiers cannot contain emojis
struct ABig👩‍👩‍👧‍👧Family; //~ ERROR identifiers cannot contain emoji
struct 👀; //~ ERROR identifiers cannot contain emoji
impl 👀 {
fn full_of_() -> 👀 { //~ ERROR identifiers cannot contain emojis
fn full_of_() -> 👀 { //~ ERROR identifiers cannot contain emoji
👀
}
}
fn i_like_to_😅_a_lot() -> 👀 { //~ ERROR identifiers cannot contain emojis
fn i_like_to_😅_a_lot() -> 👀 { //~ ERROR identifiers cannot contain emoji
👀::full_of() //~ ERROR no function or associated item named `full_of✨` found for struct `👀`
//~^ ERROR identifiers cannot contain emojis
//~^ ERROR identifiers cannot contain emoji
}
fn main() {
let _ = i_like_to_😄_a_lot()4; //~ ERROR cannot find function `i_like_to_😄_a_lot` in this scope
//~^ ERROR identifiers cannot contain emojis
//~^ ERROR identifiers cannot contain emoji
//~| ERROR unknown start of token: \u{2796}
}
12 changes: 6 additions & 6 deletions src/test/ui/parser/emoji-identifiers.stderr
Expand Up @@ -18,25 +18,25 @@ LL | fn i_like_to_😅_a_lot() -> 👀 {
LL | let _ = i_like_to_😄_a_lot() ➖ 4;
| ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `i_like_to_😅_a_lot`

error: identifiers cannot contain emojis: `i_like_to_😄_a_lot`
error: identifiers cannot contain emoji: `i_like_to_😄_a_lot`
--> $DIR/emoji-identifiers.rs:13:13
|
LL | let _ = i_like_to_😄_a_lot() ➖ 4;
| ^^^^^^^^^^^^^^^^^^

error: identifiers cannot contain emojis: `full_of_✨`
error: identifiers cannot contain emoji: `full_of_✨`
--> $DIR/emoji-identifiers.rs:4:8
|
LL | fn full_of_✨() -> 👀 {
| ^^^^^^^^^^

error: identifiers cannot contain emojis: `full_of✨`
error: identifiers cannot contain emoji: `full_of✨`
--> $DIR/emoji-identifiers.rs:9:8
|
LL | 👀::full_of✨()
| ^^^^^^^^^

error: identifiers cannot contain emojis: `👀`
error: identifiers cannot contain emoji: `👀`
--> $DIR/emoji-identifiers.rs:2:8
|
LL | struct 👀;
Expand All @@ -53,13 +53,13 @@ LL | fn i_like_to_😅_a_lot() -> 👀 {
LL | 👀::full_of✨()
| ^^

error: identifiers cannot contain emojis: `i_like_to_😅_a_lot`
error: identifiers cannot contain emoji: `i_like_to_😅_a_lot`
--> $DIR/emoji-identifiers.rs:8:4
|
LL | fn i_like_to_😅_a_lot() -> 👀 {
| ^^^^^^^^^^^^^^^^^^

error: identifiers cannot contain emojis: `ABig👩👩👧👧Family`
error: identifiers cannot contain emoji: `ABig👩👩👧👧Family`
--> $DIR/emoji-identifiers.rs:1:8
|
LL | struct ABig👩👩👧👧Family;
Expand Down

0 comments on commit d68add9

Please sign in to comment.