rust-lang / rust-lang/fls

Backwards arrow compound punctuator

Open Beginner friendly
#452 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lexer C-bug
Dominant language
reStructuredText
Stars
497
Forks
41
Avg merge
3h 52m
Merged PRs (30d)
4

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the FLS source for spec section 2 and read the compound punctuators table in 2.2.8 alongside the punctuator names table in 2.2.13. Update both tables to account for <-, then verify that the specification consistently describes this lexical case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.