{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/192736283","pull_request_review_id":125567047,"id":192736283,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjczNjI4Mw==","diff_hunk":"@@ -0,0 +1,145 @@\n+- Feature Name: unicode_idents\n+- Start Date: 2018-06-03\n+- RFC PR: (leave this empty)\n+- Rust Issue: (leave this empty)\n+\n+# Summary\n+[summary]: #summary\n+\n+Allow non-ASCII letters (such as accented characters, Cyrillic, Greek, Kanji, etc.) in Rust identifiers.\n+\n+# Motivation\n+[motivation]: #motivation\n+\n+Rust is written by many people who are not fluent in the English language. Using identifiers in ones native language eases writing and reading code for these developers.\n+\n+The rationale from [PEP 3131] nicely explains it:\n+\n+> ~~Python~~ *Rust* code is written by many people in the world who are not familiar with the English language, or even well-acquainted with the Latin writing system. Such developers often desire to define classes and functions with names in their native languages, rather than having to come up with an (often incorrect) English translation of the concept they want to name. By using identifiers in their native language, code clarity and maintainability of the code among speakers of that language improves.\n+> \n+> For some languages, common transliteration systems exist (in particular, for the Latin-based writing systems). For other languages, users have larger difficulties to use Latin to write their native words.\n+\n+Additionally some math oriented projects may want to use identifiers closely resembling mathematical writing.\n+\n+# Guide-level explanation\n+[guide-level-explanation]: #guide-level-explanation\n+\n+Identifiers include variable names, function and trait names and module names. They start with a letter or an underscore and may be followed by more letters, digits and some connecting punctuation.\n+\n+Examples of valid identifiers are:\n+\n+* English language words: `color`, `image_width`, `line2`, `Photo`, `_unused`, ...\n+* ASCII words in foreign languages: `die_eisenbahn`, `el_tren`, `artikel_1_grundgesetz`\n+* words containing accented characters: `garçon`, `hühnervögel`\n+* identifiers in other scripts: `Москва`, `東京`, ...\n+\n+Examples of invalid identifiers are:\n+\n+* Keywords: `impl`, `fn`, `_` (underscore), ...\n+* Identifiers starting with numbers or \"non letters\": `42_the_answer`, `third√of7`, `◆◆◆`, ...\n+* Emojis: 🙂, 🦀, 💩, ...\n+\n+Similar Unicode identifiers are normalized: `a1` and `a₁` refer to the same variable. This also applies to accented characters which can be represented in different ways.\n+\n+To disallow any Unicode identifiers in a project (for example to ease collaboration or for security reasons) limiting the accepted identifiers to ASCII add this lint to the `lib.rs` or `main.rs` file of your project:\n+\n+```rust\n+#![forbid(unicode_idents)]\n+```\n+\n+Some Unicode character look confusingly similiar to each other or even identical like the Latin **A** and the Cyrillic **А**. The compiler may warn you about easy to confuse names in the same scope. If needed (but not recommended) this warning can be silenced with a `#[allow(confusable_unicode_idents)]` annotation on the enclosing function or module.\n+\n+# Reference-level explanation\n+[reference-level-explanation]: #reference-level-explanation\n+\n+Identifiers in Rust are based on the [Unicode® Standard Annex #31 Unicode Identifier and Pattern Syntax][TR31]. Rust compilers shall use at least Revision 27 of the standard.\n+\n+The lexer defines identifiers as:\n+\n+> **<sup>Lexer:<sup>**  \n+> IDENTIFIER_OR_KEYWORD:  \n+> &nbsp;&nbsp; XID_Start&nbsp;XID_Continue<sup>\\*</sup>  \n+> &nbsp;&nbsp; | `_` XID_Continue<sup>+</sup>  ","path":"text/0000-unicode-idents.md","position":70,"original_position":62,"commit_id":"4c1bda90b334a3ccae278fda6f111b5a414f6419","original_commit_id":"ec728b3e24a2ea2ad802328e4a6d1ac628731ee6","user":{"login":"dscorbett","id":1124347,"node_id":"MDQ6VXNlcjExMjQzNDc=","avatar_url":"https://avatars2.githubusercontent.com/u/1124347?v=4","gravatar_id":"","url":"https://api.github.com/users/dscorbett","html_url":"https://github.com/dscorbett","followers_url":"https://api.github.com/users/dscorbett/followers","following_url":"https://api.github.com/users/dscorbett/following{/other_user}","gists_url":"https://api.github.com/users/dscorbett/gists{/gist_id}","starred_url":"https://api.github.com/users/dscorbett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dscorbett/subscriptions","organizations_url":"https://api.github.com/users/dscorbett/orgs","repos_url":"https://api.github.com/users/dscorbett/repos","events_url":"https://api.github.com/users/dscorbett/events{/privacy}","received_events_url":"https://api.github.com/users/dscorbett/received_events","type":"User","site_admin":false},"body":"So it does. I must have been looking at XID_Start.","created_at":"2018-06-04T13:15:26Z","updated_at":"2018-06-04T13:15:26Z","html_url":"https://github.com/rust-lang/rfcs/pull/2457#discussion_r192736283","pull_request_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/2457","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/192736283"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/2457#discussion_r192736283"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/2457"}},"in_reply_to_id":192605112},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/2457","id":192257989,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMjU3OTg5","html_url":"https://github.com/rust-lang/rfcs/pull/2457","diff_url":"https://github.com/rust-lang/rfcs/pull/2457.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/2457.patch","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2457","number":2457,"state":"open","locked":false,"title":"Allow Unicode Idents","user":{"login":"pyfisch","id":2781017,"node_id":"MDQ6VXNlcjI3ODEwMTc=","avatar_url":"https://avatars0.githubusercontent.com/u/2781017?v=4","gravatar_id":"","url":"https://api.github.com/users/pyfisch","html_url":"https://github.com/pyfisch","followers_url":"https://api.github.com/users/pyfisch/followers","following_url":"https://api.github.com/users/pyfisch/following{/other_user}","gists_url":"https://api.github.com/users/pyfisch/gists{/gist_id}","starred_url":"https://api.github.com/users/pyfisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyfisch/subscriptions","organizations_url":"https://api.github.com/users/pyfisch/orgs","repos_url":"https://api.github.com/users/pyfisch/repos","events_url":"https://api.github.com/users/pyfisch/events{/privacy}","received_events_url":"https://api.github.com/users/pyfisch/received_events","type":"User","site_admin":false},"body":"Allow non-ASCII letters (such as accented characters, Cyrillic, Greek, Kanji, etc.) in Rust identifiers.\r\n\r\n[Rendered](https://github.com/pyfisch/rfcs/blob/unicode-idents/text/0000-unicode-idents.md)\r\nAlternative to #2455\r\n\r\n----\r\n\r\nThe proposal is based on the excellent [PEP 3131](https://www.python.org/dev/peps/pep-3131/) and adapts it for Rusts use. Python accepts Unicode identifiers and normalizes them with NFKC. This proposal adds confusable detection to prevent homoglyph attacks and help fixing typos.\r\n\r\nIt uses the feedback from rust-lang/rust#28979 and #2455.\r\n\r\nThe different options for identifier Unicode support can be summarized in this list, ordered from least complex to most complex:\r\n\r\n0. ASCII identifiers (currently implemented in stable Rust)\r\n1. Immutable Identifiers (implemented in C++)\r\n2. Unicode Identifiers (JavaScript, currently implemented in `feature(non_ascii_idents)`)\r\n3. Normalized Identifiers (Python)\r\n4. Confusable Detection (proposed in this RFC)\r\n\r\nLevel 2 already provides good Unicode support for most uses. Normalizing identifiers and confusable detection improves security and usability.","created_at":"2018-06-03T17:25:37Z","updated_at":"2018-06-04T13:15:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"199e26c2170120c5857848f2a0ad3ec8efd11c91","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":211667886,"node_id":"MDU6TGFiZWwyMTE2Njc4ODY=","url":"https://api.github.com/repos/rust-lang/rfcs/labels/T-lang","name":"T-lang","color":"bfd4f2","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/2457/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/2457/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2457/comments","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/4c1bda90b334a3ccae278fda6f111b5a414f6419","head":{"label":"pyfisch:unicode-idents","ref":"unicode-idents","sha":"4c1bda90b334a3ccae278fda6f111b5a414f6419","user":{"login":"pyfisch","id":2781017,"node_id":"MDQ6VXNlcjI3ODEwMTc=","avatar_url":"https://avatars0.githubusercontent.com/u/2781017?v=4","gravatar_id":"","url":"https://api.github.com/users/pyfisch","html_url":"https://github.com/pyfisch","followers_url":"https://api.github.com/users/pyfisch/followers","following_url":"https://api.github.com/users/pyfisch/following{/other_user}","gists_url":"https://api.github.com/users/pyfisch/gists{/gist_id}","starred_url":"https://api.github.com/users/pyfisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyfisch/subscriptions","organizations_url":"https://api.github.com/users/pyfisch/orgs","repos_url":"https://api.github.com/users/pyfisch/repos","events_url":"https://api.github.com/users/pyfisch/events{/privacy}","received_events_url":"https://api.github.com/users/pyfisch/received_events","type":"User","site_admin":false},"repo":{"id":31169023,"node_id":"MDEwOlJlcG9zaXRvcnkzMTE2OTAyMw==","name":"rfcs","full_name":"pyfisch/rfcs","owner":{"login":"pyfisch","id":2781017,"node_id":"MDQ6VXNlcjI3ODEwMTc=","avatar_url":"https://avatars0.githubusercontent.com/u/2781017?v=4","gravatar_id":"","url":"https://api.github.com/users/pyfisch","html_url":"https://github.com/pyfisch","followers_url":"https://api.github.com/users/pyfisch/followers","following_url":"https://api.github.com/users/pyfisch/following{/other_user}","gists_url":"https://api.github.com/users/pyfisch/gists{/gist_id}","starred_url":"https://api.github.com/users/pyfisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyfisch/subscriptions","organizations_url":"https://api.github.com/users/pyfisch/orgs","repos_url":"https://api.github.com/users/pyfisch/repos","events_url":"https://api.github.com/users/pyfisch/events{/privacy}","received_events_url":"https://api.github.com/users/pyfisch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pyfisch/rfcs","description":"RFCs for changes to Rust","fork":true,"url":"https://api.github.com/repos/pyfisch/rfcs","forks_url":"https://api.github.com/repos/pyfisch/rfcs/forks","keys_url":"https://api.github.com/repos/pyfisch/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyfisch/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyfisch/rfcs/teams","hooks_url":"https://api.github.com/repos/pyfisch/rfcs/hooks","issue_events_url":"https://api.github.com/repos/pyfisch/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/pyfisch/rfcs/events","assignees_url":"https://api.github.com/repos/pyfisch/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/pyfisch/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/pyfisch/rfcs/tags","blobs_url":"https://api.github.com/repos/pyfisch/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyfisch/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyfisch/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyfisch/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyfisch/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/pyfisch/rfcs/languages","stargazers_url":"https://api.github.com/repos/pyfisch/rfcs/stargazers","contributors_url":"https://api.github.com/repos/pyfisch/rfcs/contributors","subscribers_url":"https://api.github.com/repos/pyfisch/rfcs/subscribers","subscription_url":"https://api.github.com/repos/pyfisch/rfcs/subscription","commits_url":"https://api.github.com/repos/pyfisch/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyfisch/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyfisch/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyfisch/rfcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/pyfisch/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/pyfisch/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyfisch/rfcs/merges","archive_url":"https://api.github.com/repos/pyfisch/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyfisch/rfcs/downloads","issues_url":"https://api.github.com/repos/pyfisch/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/pyfisch/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/pyfisch/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/pyfisch/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyfisch/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/pyfisch/rfcs/releases{/id}","deployments_url":"https://api.github.com/repos/pyfisch/rfcs/deployments","created_at":"2015-02-22T16:17:23Z","updated_at":"2015-02-21T14:55:55Z","pushed_at":"2018-06-04T07:24:27Z","git_url":"git://github.com/pyfisch/rfcs.git","ssh_url":"git@github.com:pyfisch/rfcs.git","clone_url":"https://github.com/pyfisch/rfcs.git","svn_url":"https://github.com/pyfisch/rfcs","homepage":"","size":5761,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"09f4844258a2230f00a1aeda37ff689149a6a3c3","user":{"login":"rust-lang","id":5430905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MzA5MDU=","avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":17527989,"node_id":"MDEwOlJlcG9zaXRvcnkxNzUyNzk4OQ==","name":"rfcs","full_name":"rust-lang/rfcs","owner":{"login":"rust-lang","id":5430905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MzA5MDU=","avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rfcs","description":"RFCs for changes to Rust","fork":false,"url":"https://api.github.com/repos/rust-lang/rfcs","forks_url":"https://api.github.com/repos/rust-lang/rfcs/forks","keys_url":"https://api.github.com/repos/rust-lang/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rfcs/teams","hooks_url":"https://api.github.com/repos/rust-lang/rfcs/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rfcs/events","assignees_url":"https://api.github.com/repos/rust-lang/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rfcs/tags","blobs_url":"https://api.github.com/repos/rust-lang/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rfcs/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rfcs/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rfcs/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rfcs/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rfcs/subscription","commits_url":"https://api.github.com/repos/rust-lang/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rfcs/merges","archive_url":"https://api.github.com/repos/rust-lang/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rfcs/downloads","issues_url":"https://api.github.com/repos/rust-lang/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rfcs/releases{/id}","deployments_url":"https://api.github.com/repos/rust-lang/rfcs/deployments","created_at":"2014-03-07T21:29:00Z","updated_at":"2018-06-04T12:26:14Z","pushed_at":"2018-06-04T07:24:29Z","git_url":"git://github.com/rust-lang/rfcs.git","ssh_url":"git@github.com:rust-lang/rfcs.git","clone_url":"https://github.com/rust-lang/rfcs.git","svn_url":"https://github.com/rust-lang/rfcs","homepage":"http://rust-lang.github.io/rfcs/","size":143998,"stargazers_count":1523,"watchers_count":1523,"language":"Shell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":642,"mirror_url":null,"archived":false,"open_issues_count":705,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":642,"open_issues":705,"watchers":1523,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/2457"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/2457"},"issue":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/2457"},"comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/2457/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/2457/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/2457/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rfcs/statuses/4c1bda90b334a3ccae278fda6f111b5a414f6419"}},"author_association":"NONE"}}
{"actor":{"display_login":"dscorbett"}}