IdentifierPattern's right-hand side Pattern cannot be an IdentifierPattern

Open
#439 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Read the IdentifierPattern section in src/patterns.md and reproduce the linked playground example to confirm the parsing behavior. Update the reference so the right-hand-side Pattern is explicitly described as disallowing another IdentifierPattern, then verify the wording matches the example's behavior.

Written by the indexing model from the issue text.

Description

A-patterns C-bug New Content

https://github.com/rust-lang-nursery/reference/blob/master/src/patterns.md currently mentions that IdentifierPattern's right-hand side is a Pattern, which is allowed to be an IdentifierPattern.

However, the following code doesn't parse let x @ y @ () = (); println!("{:?} {:?}", x, y); (playground) due to pattern bindings not being allowed after the @.

As a consequence, I think the reference should be updated to mention that an IdentifierPattern's right-hand-side Pattern is not actually a full Pattern, but is instead not allowed to be another IdentifierPattern.

Dominant language
Rust
Stars
1.6k
Forks
607
Avg merge
1d 1h
Merged PRs (30d)
12

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.

More from rust-lang/reference

All issues in rust-lang/reference

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.