forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#88781 - estebank:emoji-idents, r=oli-obk
Tokenize emoji as if they were valid identifiers In the lexer, consider emojis to be valid identifiers and reject them later to avoid knock down parse errors. Partially address rust-lang#86102.
- Loading branch information
Showing
12 changed files
with
228 additions
and
15 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
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 emoji | ||
struct π; //~ ERROR identifiers cannot contain emoji | ||
impl π { | ||
fn full_of_β¨() -> π { //~ ERROR identifiers cannot contain emoji | ||
π | ||
} | ||
} | ||
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 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 emoji | ||
//~| ERROR unknown start of token: \u{2796} | ||
} |
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,83 @@ | ||
error: unknown start of token: \u{2796} | ||
--> $DIR/emoji-identifiers.rs:13:33 | ||
| | ||
LL | let _ = i_like_to_π_a_lot() β 4; | ||
| ^^ | ||
| | ||
help: Unicode character 'β' (Heavy Minus Sign) looks like '-' (Minus/Hyphen), but it is not | ||
| | ||
LL | let _ = i_like_to_π_a_lot() - 4; | ||
| ~ | ||
|
||
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() β 4; | ||
| ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `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 emoji: `full_of_β¨` | ||
--> $DIR/emoji-identifiers.rs:4:8 | ||
| | ||
LL | fn full_of_β¨() -> π { | ||
| ^^^^^^^^^^ | ||
|
||
error: identifiers cannot contain emoji: `full_ofβ¨` | ||
--> $DIR/emoji-identifiers.rs:9:8 | ||
| | ||
LL | π::full_ofβ¨() | ||
| ^^^^^^^^^ | ||
|
||
error: identifiers cannot contain emoji: `π` | ||
--> $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 emoji: `i_like_to_π _a_lot` | ||
--> $DIR/emoji-identifiers.rs:8:4 | ||
| | ||
LL | fn i_like_to_π _a_lot() -> π { | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: identifiers cannot contain emoji: `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 9 previous errors | ||
|
||
Some errors have detailed explanations: E0425, E0599. | ||
For more information about an error, try `rustc --explain E0425`. |
Oops, something went wrong.