Skip to content

Wrong definition of identifiers in Rust Reference #28706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matklad opened this issue Sep 28, 2015 · 0 comments
Closed

Wrong definition of identifiers in Rust Reference #28706

matklad opened this issue Sep 28, 2015 · 0 comments

Comments

@matklad
Copy link
Member

matklad commented Sep 28, 2015

Rust reference says:

An identifier is any nonempty Unicode2 string of the following form:

  • The first character has property XID_start
  • The remaining characters have property XID_continue

The problem with this is that _ (LOW LINE) is not XID_start (reference: http://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt), but _ignored is a valid Rust identifier. Rust lexer explicitly tests for the _ https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/lexer/mod.rs#L1399.

I guess the correct wording would be (keeping in mind that _ by itself is not a valid identifier):

EIther
   * The first character has property XID_start
   * The remaining characters have property XID_continue
Or
   * The first character is _
   * The second character has property XID_continue
   * The remaining characters have property XID_continue
matklad added a commit to intellij-rust/intellij-rust that referenced this issue Sep 28, 2015
`_` is a valid rust identifier start, but it is not XID_Start, so there
is a bug in rust reference. rust-lang/rust#28706
steveklabnik added a commit to steveklabnik/rust that referenced this issue Sep 30, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Sep 30, 2015
Fixes rust-lang#28706 

I am pretty sure that this is accurate, bout would love a double check.
steveklabnik added a commit to steveklabnik/rust that referenced this issue Sep 30, 2015
Fixes rust-lang#28706 

I am pretty sure that this is accurate, bout would love a double check.
dlrobertson pushed a commit to dlrobertson/rust that referenced this issue Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants