@@ -34,8 +34,25 @@ use LiteralKind::*;
3434use TokenKind :: * ;
3535use cursor:: EOF_CHAR ;
3636pub use cursor:: { Cursor , FrontmatterAllowed } ;
37+ pub use unicode_ident:: UNICODE_VERSION ;
3738use unicode_properties:: UnicodeEmoji ;
38- pub use unicode_xid:: UNICODE_VERSION as UNICODE_XID_VERSION ;
39+
40+ // Make sure that the Unicode version of the dependencies is the same.
41+ const _: ( ) = {
42+ let properties = unicode_properties:: UNICODE_VERSION ;
43+ let ident = unicode_ident:: UNICODE_VERSION ;
44+
45+ if properties. 0 != ident. 0 as u64
46+ || properties. 1 != ident. 1 as u64
47+ || properties. 2 != ident. 2 as u64
48+ {
49+ panic ! (
50+ "unicode-properties and unicode-ident must use the same Unicode version, \
51+ `unicode_properties::UNICODE_VERSION` and `unicode_ident::UNICODE_VERSION` are \
52+ different."
53+ ) ;
54+ }
55+ } ;
3956
4057/// Parsed token.
4158/// It doesn't contain information about data that has been parsed,
@@ -370,14 +387,14 @@ pub fn is_horizontal_whitespace(c: char) -> bool {
370387/// a formal definition of valid identifier name.
371388pub fn is_id_start ( c : char ) -> bool {
372389 // This is XID_Start OR '_' (which formally is not a XID_Start).
373- c == '_' || unicode_xid :: UnicodeXID :: is_xid_start ( c)
390+ c == '_' || unicode_ident :: is_xid_start ( c)
374391}
375392
376393/// True if `c` is valid as a non-first character of an identifier.
377394/// See [Rust language reference](https://doc.rust-lang.org/reference/identifiers.html) for
378395/// a formal definition of valid identifier name.
379396pub fn is_id_continue ( c : char ) -> bool {
380- unicode_xid :: UnicodeXID :: is_xid_continue ( c)
397+ unicode_ident :: is_xid_continue ( c)
381398}
382399
383400/// The passed string is lexically an identifier.
0 commit comments