Skip to content
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

Backwards arrow compound punctuator #452

Open
ijackson opened this issue Oct 21, 2023 · 0 comments
Open

Backwards arrow compound punctuator #452

ijackson opened this issue Oct 21, 2023 · 0 comments

Comments

@ijackson
Copy link

Hi. (I read the contribution guidelines and I think I'm flagging this for you as a mistake in the spec, rather than as an upstream change. I hope this is helpful.)

rustc rejects <-: it is lexed as a single token, which isn't legal anywhere. For < followed by - one must write < - :

error: unexpected token: `<-`
 --> src/main.rs:2:22
  |
2 |     println!("{}", 4 <- 3);
  |                      ^^
  |
help: if you meant to write a comparison against a negative value, add a space in between `<` and `-`

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c2ad15c3b9cd3bc8a98f31478b3e78f4

However the spec section 2 doesn't seem to discuss this. I think this should probably be fixed by adding <- to the table of compund punctuators (2.2.8) and the table of punctuator names (2.2.13).

The impact seems very low; it just means that rustc rejects some programs that the spec regards as correct.

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

1 participant