You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- When updating the version, update the UAX links, too. -->
19
+
r[ident.unicode]
16
20
Identifiers follow the specification in [Unicode Standard Annex #31][UAX31] for Unicode version 15.0, with the additions described below. Some examples of identifiers:
17
21
18
22
*`foo`
@@ -21,6 +25,7 @@ Identifiers follow the specification in [Unicode Standard Annex #31][UAX31] for
21
25
*`Москва`
22
26
*`東京`
23
27
28
+
r[ident.profile]
24
29
The profile used from UAX #31 is:
25
30
26
31
* Start := [`XID_Start`], plus the underscore character (U+005F)
@@ -31,10 +36,13 @@ with the additional constraint that a single underscore character is not an iden
31
36
32
37
> **Note**: Identifiers starting with an underscore are typically used to indicate an identifier that is intentionally unused, and will silence the unused warning in `rustc`.
33
38
39
+
r[ident.keyword]
34
40
Identifiers may not be a [strict] or [reserved] keyword without the `r#` prefix described below in [raw identifiers](#raw-identifiers).
35
41
42
+
r[ident.zero-width-chars]
36
43
Zero width non-joiner (ZWNJ U+200C) and zero width joiner (ZWJ U+200D) characters are not allowed in identifiers.
37
44
45
+
r[ident.ascii-limitations]
38
46
Identifiers are restricted to the ASCII subset of [`XID_Start`] and [`XID_Continue`] in the following situations:
39
47
40
48
*[`extern crate`] declarations
@@ -45,14 +53,21 @@ Identifiers are restricted to the ASCII subset of [`XID_Start`] and [`XID_Contin
45
53
46
54
## Normalization
47
55
56
+
r[ident.normalization]
57
+
48
58
Identifiers are normalized using Normalization Form C (NFC) as defined in [Unicode Standard Annex #15][UAX15]. Two identifiers are equal if their NFC forms are equal.
49
59
50
60
[Procedural][proc-macro] and [declarative][mbe] macros receive normalized identifiers in their input.
51
61
52
62
## Raw identifiers
53
63
64
+
r[ident.raw]
65
+
66
+
r[ident.raw.intro]
54
67
A raw identifier is like a normal identifier, but prefixed by `r#`. (Note that
55
68
the `r#` prefix is not included as part of the actual identifier.)
69
+
70
+
r[ident.raw.allowed]
56
71
Unlike a normal identifier, a raw identifier may be any strict or reserved
57
72
keyword except the ones listed above for `RAW_IDENTIFIER`.
0 commit comments