6.18:14 for match arms appears inconsistent with expr.match.guard.next
Nobody has claimed this yet.
- Dominant language
- reStructuredText
- Stars
- 497
- Forks
- 41
- Avg merge
- 3h 52m
- Merged PRs (30d)
- 4
Description
From 6.18:14 of FLS:
A match arm is selected when its pattern matches the value of the subject expression and its match arm guard (if any) evaluates to true.
From expr.match.guard.next of The Rust Reference:
Otherwise, the next pattern, including other matches with the | operator in the same arm, is tested.
The ambiguity here is that, in FLS, pattern refers to the whole pattern (so the guard is for the whole arm), while in rustc, the guard can be invoked multiple times once for each alternative, depending on how many times an alternative in a pattern matches.
CC: @vapdrs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with FLS §6.18:14 and its linked definitions, then compare the wording with the Rust Reference's expr.match.guard.next and the described rustc behavior. Clarify whether the specification should describe guard evaluation for the whole arm or for each alternative, and update the relevant FLS text once the semantics are reconciled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100