Skip to content

Commit ade7a62

Browse files
Fix restrictions of or-patterns
A small discrepancy in the definition of `or-patterns` was discovered during the `rust-lang/fls` meeting on 2025-12-12 involving Eric Huss and TC - `or-patterns` must not be used in function and closure **parameters**, as opposed to function and closure arguments as stated in the text. Function and closure parameters are the constructs carrying `PatternNoTopAlt`s.
1 parent 50c5de9 commit ade7a62

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ r[patterns.or]
10591059

10601060
_Or-patterns_ are patterns that match on one of two or more sub-patterns (for example `A | B | C`).
10611061
They can nest arbitrarily.
1062-
Syntactically, or-patterns are allowed in any of the places where other patterns are allowed (represented by the [Pattern] production), with the exceptions of `let`-bindings and function and closure arguments (represented by the [PatternNoTopAlt] production).
1062+
Syntactically, or-patterns are allowed in any of the places where other patterns are allowed (represented by the [Pattern] production), with the exceptions of `let`-bindings and function and closure parameters (represented by the [PatternNoTopAlt] production).
10631063

10641064
r[patterns.constraints]
10651065
### Static semantics

0 commit comments

Comments
 (0)