Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tokenize emoji as if they were valid indentifiers
In the lexer, consider emojis to be valid identifiers and reject them later to avoid knock down parse errors.
- Loading branch information
Showing
8 changed files
with
180 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
struct ABig👩👩👧👧Family; //~ ERROR identifiers cannot contain emojis | ||
struct 👀; //~ ERROR identifiers cannot contain emojis | ||
impl 👀 { | ||
fn full_of_✨() -> 👀 { //~ ERROR identifiers cannot contain emojis | ||
👀 | ||
} | ||
} | ||
fn i_like_to_😅_a_lot() -> 👀 { //~ ERROR identifiers cannot contain emojis | ||
👀::full_of✨() //~ ERROR no function or associated item named `full_of✨` found for struct `👀` | ||
//~^ ERROR identifiers cannot contain emojis | ||
} | ||
fn main() { | ||
let _ = i_like_to_😄_a_lot(); //~ ERROR cannot find function `i_like_to_😄_a_lot` in this scope | ||
//~^ ERROR identifiers cannot contain emojis | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
error[E0425]: cannot find function `i_like_to_😄_a_lot` in this scope | ||
--> $DIR/emoji-identifiers.rs:13:13 | ||
| | ||
LL | fn i_like_to_😅_a_lot() -> 👀 { | ||
| ----------------------------- similarly named function `i_like_to_😅_a_lot` defined here | ||
... | ||
LL | let _ = i_like_to_😄_a_lot(); | ||
| ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `i_like_to_😅_a_lot` | ||
|
||
error: identifiers cannot contain emojis: `i_like_to_😄_a_lot` | ||
--> $DIR/emoji-identifiers.rs:13:13 | ||
| | ||
LL | let _ = i_like_to_😄_a_lot(); | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: identifiers cannot contain emojis: `full_of_✨` | ||
--> $DIR/emoji-identifiers.rs:4:8 | ||
| | ||
LL | fn full_of_✨() -> 👀 { | ||
| ^^^^^^^^^^ | ||
|
||
error: identifiers cannot contain emojis: `full_of✨` | ||
--> $DIR/emoji-identifiers.rs:9:8 | ||
| | ||
LL | 👀::full_of✨() | ||
| ^^^^^^^^^ | ||
|
||
error: identifiers cannot contain emojis: `👀` | ||
--> $DIR/emoji-identifiers.rs:2:8 | ||
| | ||
LL | struct 👀; | ||
| ^^ | ||
LL | impl 👀 { | ||
| ^^ | ||
LL | fn full_of_✨() -> 👀 { | ||
| ^^ | ||
LL | 👀 | ||
| ^^ | ||
... | ||
LL | fn i_like_to_😅_a_lot() -> 👀 { | ||
| ^^ | ||
LL | 👀::full_of✨() | ||
| ^^ | ||
|
||
error: identifiers cannot contain emojis: `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` | ||
--> $DIR/emoji-identifiers.rs:1:8 | ||
| | ||
LL | struct ABig👩👩👧👧Family; | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0599]: no function or associated item named `full_of✨` found for struct `👀` in the current scope | ||
--> $DIR/emoji-identifiers.rs:9:8 | ||
| | ||
LL | struct 👀; | ||
| ---------- function or associated item `full_of✨` not found for this | ||
... | ||
LL | 👀::full_of✨() | ||
| ^^^^^^^^^ | ||
| | | ||
| function or associated item not found in `👀` | ||
| help: there is an associated function with a similar name: `full_of_✨` | ||
|
||
error: aborting due to 8 previous errors | ||
|
||
Some errors have detailed explanations: E0425, E0599. | ||
For more information about an error, try `rustc --explain E0425`. |