Skip to content

Backwards arrow compound punctuator #452

Open
@ijackson

Description

@ijackson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions