rust-lang / rust-lang/reference
Nomenclature question: what is the `EXPR` in `for PATTERN in EXPR { }` called?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- PR merge metrics
- PR metrics pending
Description
Location
https://doc.rust-lang.org/reference/expressions/loop-expr.html#iterator-loops
Context
I was reviewing a test cleanup PR https://github.com/rust-lang/rust/pull/141974, and I was trying to say something about the EXPR in
for PATTERN in EXPR {
// ^--- what is this expr called?
// ...
}
but I couldn't find a good term for this[^1][^2]. The current grammar calls this EXPR
Expressionexcept struct expression
whereas for e.g. match EXPR { .. } or if let PATTERN = EXPR { .. }, there's a more "meaningful name" for that EXPR, which is the scrutinee expr.
[^1]: In the community discord, terms like "interatee" or "iterable" or "into-iterable" were suggested, but yeah.
[^2]: Nadrieril came up with "loopee", which is an excellent term 😆
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 the iterator-loops section of the Rust Reference at the linked location, then compare its EXPR wording with the scrutinee terminology used for match and if let. The work is done when the project has agreed on a term for the expression and the relevant reference wording reflects that decision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100